Diff for /embedaddon/libnet/src/libnet_build_802.1x.c between versions 1.1 and 1.1.1.3

version 1.1, 2012/02/21 22:14:23 version 1.1.1.3, 2023/09/27 11:11:38
Line 30 Line 30
  *   *
  */   */
   
#if (HAVE_CONFIG_H)#include "common.h"
#include "../include/config.h" 
#endif 
#if (!(_WIN32) || (__CYGWIN__))  
#include "../include/libnet.h" 
#else 
#include "../include/win32/libnet.h" 
#endif 
   
 libnet_ptag_t  libnet_ptag_t
libnet_build_802_1x(u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length,libnet_build_802_1x(uint8_t eap_ver, uint8_t eap_type, uint16_t length,
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_1x_hdr dot1x_hdr;      struct libnet_802_1x_hdr dot1x_hdr;
   
Line 70  u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l Line 63  u_int8_t *payload, u_int32_t payload_s, libnet_t *l, l
     dot1x_hdr.dot1x_type = eap_type;      dot1x_hdr.dot1x_type = eap_type;
     dot1x_hdr.dot1x_length = htons(length);      dot1x_hdr.dot1x_length = htons(length);
   
    n = libnet_pblock_append(l, p, (u_int8_t *)&dot1x_hdr, LIBNET_802_1X_H);    n = libnet_pblock_append(l, p, (uint8_t *)&dot1x_hdr, LIBNET_802_1X_H);
    if (n == -1)    if (n == (uint32_t)-1)
     {      {
         goto bad;          goto bad;
     }      }
       
       LIBNET_DO_PAYLOAD(l, p);
   
     if ((payload && !payload_s) || (!payload && payload_s))  
     {  
         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,      return (ptag ? ptag : libnet_pblock_update(l, p, h,
             LIBNET_PBLOCK_802_1X_H));              LIBNET_PBLOCK_802_1X_H));
 bad:  bad:
Line 99  bad: Line 78  bad:
     return (-1);      return (-1);
 }  }
   
/**
/* EOF */ * Local Variables:
  *  indent-tabs-mode: nil
  *  c-file-style: "stroustrup"
  * End:
  */

Removed from v.1.1  
changed lines
  Added in v.1.1.1.3


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