Diff for /embedaddon/libnet/src/libnet_build_802.3.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 22:14:23 version 1.1.1.2, 2013/07/22 11:54:42
Line 40 Line 40
 #endif  #endif
   
 libnet_ptag_t  libnet_ptag_t
libnet_build_802_3(u_int8_t *dst, u_int8_t *src, u_int16_t len, libnet_build_802_3(const uint8_t *dst, const uint8_t *src, uint16_t len, 
u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
 {  {
    u_int32_t n, h;    uint32_t n, h;
     libnet_pblock_t *p;      libnet_pblock_t *p;
     struct libnet_802_3_hdr _802_3_hdr;      struct libnet_802_3_hdr _802_3_hdr;
   
Line 70  u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l Line 70  u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l
     memcpy(_802_3_hdr._802_3_shost, src, ETHER_ADDR_LEN);  /* src address */      memcpy(_802_3_hdr._802_3_shost, src, ETHER_ADDR_LEN);  /* src address */
     _802_3_hdr._802_3_len = htons(len);                   /* packet length */      _802_3_hdr._802_3_len = htons(len);                   /* packet length */
   
    n = libnet_pblock_append(l, p, (u_int8_t *)&_802_3_hdr, LIBNET_802_3_H);    n = libnet_pblock_append(l, p, (uint8_t *)&_802_3_hdr, LIBNET_802_3_H);
     if (n == -1)      if (n == -1)
     {      {
         goto bad;          goto bad;
     }      }
   
    if ((payload && !payload_s) || (!payload && payload_s))    /* boilerplate payload sanity check / append macro */
    {    LIBNET_DO_PAYLOAD(l, p);
        snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, 
                "%s(): payload inconsistency\n", __func__); 
        goto bad; 
    } 
  
    if (payload && payload_s) 
    { 
        n = libnet_pblock_append(l, p, payload, payload_s); 
        if (n == -1) 
        { 
            goto bad; 
        } 
    } 
     
     return (ptag ? ptag : libnet_pblock_update(l, p, h, LIBNET_PBLOCK_802_3_H));      return (ptag ? ptag : libnet_pblock_update(l, p, h, LIBNET_PBLOCK_802_3_H));
 bad:  bad:

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>