Show
Ignore:
Timestamp:
07/28/06 22:42:30 (2 years ago)
Author:
aturner
Message:

fix libnet support
refs #4

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/sendpacket.c

    r1535 r1536  
    5757  * Please note that some of this code was copied from Libnet 1.1.3 
    5858  */ 
     59 
     60#include "config.h" 
    5961#include "defines.h" 
    6062#include "common.h" 
     
    108110 
    109111#elif defined HAVE_LIBNET 
    110 #include <libnet.h> 
    111112static sendpacket_t *sendpacket_open_libnet(const char *, char *); 
    112113static struct tcpr_ether_addr *get_hwaddr_libnet(sendpacket_t *); 
     
    182183        goto TRY_SEND_AGAIN; 
    183184    } else if (retcode < 0) { 
    184         sendpacket_seterr(sp, "Error with libnet_adv_write_link: %s", libnet_geterr(sp->lnet)); 
     185        sendpacket_seterr(sp, "Error with libnet_adv_write_link: %s", libnet_geterror(sp->handle.lnet)); 
    185186    } 
    186187#endif 
     
    345346    assert(errbuf); 
    346347     
    347     if ((lnet = libnet_init(LIBNET_LINK_ADV, device, errbuf)) == NULL) 
     348    if ((sp->handle.lnet = libnet_init(LIBNET_LINK_ADV, device, errbuf)) == NULL) 
    348349        return NULL; 
    349350 
     
    360361    assert(sp); 
    361362     
    362     addr = (struct tcpr_ether_addr *)libnet_get_hwaddr(sp->lnet); 
    363      
    364     if (ether == NULL) { 
    365         sendpacket_seterr(sp, "Error getting hwaddr via libnet: %s", libnet_geterr(sp->lnet)); 
    366         return NULL 
    367     }  
    368      
    369     mempcy(sp->ether, addr, sizeof(struct tcpr_ether_addr)); 
     363    addr = (struct tcpr_ether_addr *)libnet_get_hwaddr(sp->handle.lnet); 
     364     
     365    if (addr == NULL) { 
     366        sendpacket_seterr(sp, "Error getting hwaddr via libnet: %s", libnet_geterror(sp->handle.lnet)); 
     367        return NULL; 
     368    } 
     369     
     370    memcpy(&sp->ether, addr, sizeof(struct tcpr_ether_addr)); 
    370371    return(&sp->ether); 
    371372}