Index: libdnet-stripped/configure.in =================================================================== --- libdnet-stripped/configure.in.orig 2011-09-23 03:26:48.383238556 +0000 +++ libdnet-stripped/configure.in 2011-09-24 03:02:39.730965478 +0000 @@ -170,7 +174,9 @@ net/if_arp.h net/if_dl.h net/pfilt.h \ net/pfvar.h net/radix.h net/raw.h net/route.h netinet/in_var.h \ net/if_tun.h linux/if_tun.h netinet/ip_fw.h linux/ip_fw.h \ - linux/ip_fwchains.h linux/netfilter_ipv4/ipchains_core.h) + linux/ip_fwchains.h linux/netfilter_ipv4/ipchains_core.h, + [],[],[AC_INCLUDES_DEFAULT[ +#include ]]) AC_CHECK_HEADERS(ip_fil_compat.h netinet/ip_fil_compat.h ip_compat.h \ netinet/ip_compat.h ip_fil.h netinet/ip_fil.h) AC_CHECK_HEADERS(hpsecurity.h stropts.h) @@ -228,6 +234,8 @@ dnl Check for Ethernet interface. if test "$ac_cv_header_Iphlpapi_h" = yes ; then AC_LIBOBJ([eth-win32]) +elif test "$ac_cv_header_sys_ndd_var_h" = yes ; then + AC_LIBOBJ([eth-ndd]) elif test "$ac_cv_header_net_pfilt_h" = yes ; then AC_LIBOBJ([eth-pfilt]) elif test "$ac_cv_dnet_bsd_bpf" = yes ; then @@ -236,8 +244,6 @@ AC_LIBOBJ([eth-linux]) elif test "$ac_cv_header_net_raw_h" = yes ; then AC_LIBOBJ([eth-snoop]) -elif test "$ac_cv_header_sys_ndd_var_h" = yes ; then - AC_LIBOBJ([eth-ndd]) elif test "$ac_cv_header_sys_dlpi_h" = yes || \ test "$ac_cv_header_sys_dlpihdr_h" = yes ; then AC_LIBOBJ([eth-dlpi]) Index: libdnet-stripped/src/eth-ndd.c =================================================================== --- libdnet-stripped/src/eth-ndd.c.orig 2011-09-27 15:49:27.000000000 +0000 +++ libdnet-stripped/src/eth-ndd.c 2011-09-27 16:12:33.162216761 +0000 @@ -35,20 +35,19 @@ if ((e = calloc(1, sizeof(*e))) == NULL) return (NULL); - + memset(&sa,0,sizeof(sa)); if ((e->fd = socket(AF_NDD, SOCK_DGRAM, NDD_PROT_ETHER)) < 0) return (eth_close(e)); sa.sndd_8022_family = AF_NDD; sa.sndd_8022_len = sizeof(sa); sa.sndd_8022_filtertype = NS_ETHERTYPE; - sa.sndd_8022_ethertype = ETH_TYPE_IP; sa.sndd_8022_filterlen = sizeof(struct ns_8022); strlcpy(sa.sndd_8022_nddname, device, sizeof(sa.sndd_8022_nddname)); + strlcpy(e->device, device, sizeof(e->device)); if (bind(e->fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) return (eth_close(e)); - if (connect(e->fd, (struct sockaddr *)&sa, sizeof(sa)) < 0) return (eth_close(e)); @@ -60,7 +59,16 @@ ssize_t eth_send(eth_t *e, const void *buf, size_t len) { - return (write(e->fd, buf, len)); + char bufc[60]; + int result = 0; + if (len < 60) { + memset(bufc,0,sizeof(buf)); + memcpy(bufc,buf,len); + result=write(e->fd,bufc, sizeof(bufc)); + if (result == sizeof(bufc)) result = len; + } + else result=write(e->fd, buf, len); + return result; } eth_t * @@ -98,6 +106,7 @@ if (strcmp(nddp->ndd_alias, e->device) == 0 || strcmp(nddp->ndd_name, e->device) == 0) { memcpy(ea, nddp->ndd_addr, sizeof(*ea)); + break; } } free(nddp);