From 'man inet_ntoa': The inet_ntoa() function converts the Internet host address in, given in network byte order, to a string in IPv4 dotted-decimal notation. The string is returned in a statically allocated buffer, which subsequent calls will overwrite.
So you must copy s_ipad and s_host before calling inet_ntoa and ether_ntoa again. Something like this:
const char *aux = inet_ntoa(ip->ip_src);
const char *s_ipad = strcpy(new char[strlen(aux)+1], aux);
aux = inet_ntoa(ip->ip_dst);
const char *d_ipad = strcpy(new char[strlen(aux)+1], aux);
aux = ether_ntoa((struct ether_addr *)head->ether_shost);
const char *s_host = strcpy(new char[strlen(aux)+1], aux);
aux = ether_ntoa((struct ether_addr *)head->ether_dhost);
const char *d_host = strcpy(new char[strlen(aux)+1], aux);
//do whatever...
delete[] s_ipad; delete[] d_ipad;delete[] s_host; delete[] d_host;