Ignore:
Timestamp:
07/04/14 11:37:25 (7 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
d14e23d
Parents:
9ad7a35
Message:

Remove duplicate macros in libpacketdump

Ensure OSPF libpacketdump module won't segfault or print garbage
if a truncated OSPF header is passed into it.

Renamed 'len' field in OSPF header to 'ospf_len' to avoid
potential conflict with variables named len in libpacketdump
code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpacketdump/ip_1.c

    rec0b927 r387d299  
    33#include <dlfcn.h>
    44#include "libpacketdump.h"
    5 
    6 #define STRUCT icmp
    7 
    8 #define SAFE(x) \
    9         ((unsigned int)len>=((char*)&STRUCT->x-(char*)STRUCT+sizeof(STRUCT->x)))
    10 #define DISPLAY_EXP(x,fmt,exp) \
    11         if (SAFE(x)) \
    12                 printf(fmt,exp); \
    13         else \
    14                 return;
    15 
    16 #define DISPLAY(x,fmt) DISPLAY_EXP(x,fmt,STRUCT->x)
    17 
    18 #define DISPLAYS(x,fmt) DISPLAY_EXP(x,fmt,htons(STRUCT->x))
    19 #define DISPLAYL(x,fmt) DISPLAY_EXP(x,fmt,htonl(STRUCT->x))
    20 #define DISPLAYIP(x,fmt) DISPLAY_EXP(x,fmt,inet_ntoa(*(struct in_addr*)&STRUCT->x))
    215
    226static char *unreach_types[]={
Note: See TracChangeset for help on using the changeset viewer.