Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting
diff -rbu Libnet-latest/src/libnet_raw.c Libnet-1.1.0/src/libnet_raw.c --- Libnet-latest/src/libnet_raw.c 2002-08-05 23:26:03.000000000 +0100 +++ Libnet-1.1.0/src/libnet_raw.c 2003-02-22 03:27:59.000000000 +0000 @@ -131,22 +131,7 @@ goto bad; } -#if !(__WIN32__) - if (setsockopt(l->fd, IPPROTO_IP, IP_HDRINCL, oneptr, sizeof(one)) == -1) -#else -/* XXX need to port this - one = TRUE; - if (setsockopt(l->fd, IPPROTO_IP, IP_HDRINCL, (char *)&one, - sizeof(one)) == -1) -*/ -#endif - { - snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "libnet_open_raw6(): set IP_HDRINCL failed: %s\n", - strerror(errno)); - goto bad; - } #if (__linux__) if (setsockopt(l->fd, SOL_SOCKET, SO_BROADCAST, oneptr, sizeof(one)) == -1) diff -rbu Libnet-latest/src/libnet_resolve.c Libnet-1.1.0/src/libnet_resolve.c --- Libnet-latest/src/libnet_resolve.c 2002-08-05 23:26:03.000000000 +0100 +++ Libnet-1.1.0/src/libnet_resolve.c 2003-02-22 05:19:47.000000000 +0000 @@ -190,15 +190,8 @@ } if (!host_ent) { - sprintf(hostname, "%x:%x:%x:%x:%x:%x:%x:%x", - ntohs(addr.libnet_s6_addr[0]), - ntohs(addr.libnet_s6_addr[1]), - ntohs(addr.libnet_s6_addr[2]), - ntohs(addr.libnet_s6_addr[3]), - ntohs(addr.libnet_s6_addr[4]), - ntohs(addr.libnet_s6_addr[5]), - ntohs(addr.libnet_s6_addr[6]), - ntohs(addr.libnet_s6_addr[7])); + inet_ntop(AF_INET6,&addr,hostname,hostname_len); + } else { @@ -211,10 +204,9 @@ struct libnet_in6_addr libnet_name2addr6(libnet_t *l, u_char *host_name, u_short use_name) { - unsigned int tmp[8]; struct libnet_in6_addr addr; struct hostent *host_ent; - int i; + if (use_name == LIBNET_RESOLVE) { @@ -229,30 +221,14 @@ } else { - if (!isxdigit(host_name[0])) - { + if(!inet_pton(AF_INET6,host_name,&addr)) { if (l) { snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "libnet_name2addr6(): expecting hexadecimal format\n"); + "libnet_name2addr6(): invalid IPv6 address\n"); } return (in6addr_error); } - if (sscanf(host_name,"%x:%x:%x:%x:%x:%x:%x:%x", - &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5], - &tmp[6], &tmp[7]) < 8) - { - if (l) - { - snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, - "libnet_name2addr6(): value greater than 0xffff\n"); - } - return (in6addr_error); - } - for (i = 0; i < 8; i++) - { - addr.libnet_s6_addr[i] = htons(tmp[i]); - } return (addr); } }

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library