Changeset 11c0f44


Ignore:
Timestamp:
06/18/08 11:06:45 (13 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, 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:
41c254d
Parents:
c5f3398
Message:
  • Added support for skipping past PPPoE headers when calling trace_get_layer3
  • Fixed byte order issues in the libpacketdump PPPoE decoder
  • Fixed PPP header definition to match the RFC definition
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    rae8ec56 r11c0f44  
    579579
    580580/** PPP header */
    581 typedef struct libtrace_pps
     581typedef struct libtrace_ppp
    582582{
    583  uint8_t addres;                /**< PPP Address (0xFF - All stations) */
    584  uint8_t header;                /**< PPP Control (0x03 - Unnumbered info) */
     583 /* I can't figure out where the hell these two variables come from. They're
     584  * definitely not in RFC 1661 which defines PPP. Probably some weird thing
     585  * relating to the lack of distinction between PPP, HDLC and CHDLC */
     586       
     587/* uint8_t address; */          /**< PPP Address (0xFF - All stations) */
     588/* uint8_t header;  */          /**< PPP Control (0x03 - Unnumbered info) */
    585589 uint16_t protocol;             /**< PPP Protocol (htons(0x0021) - IPv4 */
    586590} PACKED libtrace_ppp_t;
     591
     592/** PPPoE header */
     593typedef struct libtrace_pppoe
     594{
     595 LT_BITFIELD8 version:4;        /**< Protocol version number */
     596 LT_BITFIELD8 type:4;           /**< PPPoE Type */
     597 uint8_t code;                  /**< PPPoE Code */
     598 uint16_t session_id;           /**< Session Identifier */
     599 uint16_t length;               /**< Total Length of the PPP packet */
     600} PACKED libtrace_pppoe_t;
    587601
    588602/** 802.11 header */
  • lib/protocols.h

    ra07a0ec r11c0f44  
    1818                uint16_t *type,
    1919                uint32_t *remaining);
     20void *trace_get_payload_from_pppoe(void *link, uint16_t *type,
     21                uint32_t *remaining);
    2022/* l3 definitions */
    2123struct ports_t {
  • lib/protocols_l2.c

    r35782f6 r11c0f44  
    182182                switch(ntohs(ppp->protocol)) {
    183183                        case 0x0021: *type = 0x0800; break;
     184                        /* If it isn't IP, then it is probably PPP control and
     185                         * I can't imagine anyone caring about that too much
     186                         */
     187                        default: *type = 0; break;
    184188                }
    185189        }
     
    188192        return (void*)((char *)ppp+sizeof(*ppp));
    189193}
     194
     195void *trace_get_payload_from_pppoe(void *link, uint16_t *type,
     196                uint32_t *remaining) {
     197        if (remaining) {
     198                if (*remaining <= sizeof(libtrace_pppoe_t)) {
     199                        *remaining = 0;
     200                        return NULL;
     201                }
     202                *remaining -= sizeof(libtrace_pppoe_t);
     203        }
     204       
     205        /* PPPoE is always followed by PPP */
     206        return trace_get_payload_from_ppp(link + sizeof(libtrace_pppoe_t),
     207                        type, remaining);
     208}
     209       
    190210
    191211typedef struct libtrace_chdlc_t {
  • lib/protocols_l3.c

    r3a87f4f r11c0f44  
    153153        for(;;) {
    154154                if (!iphdr || *remaining == 0)
    155                         return NULL;
     155                        break;
    156156                switch(*ethertype) {
    157157                case 0x8100: /* VLAN */
     
    167167                                                iphdr,ethertype,remaining);
    168168                        }
     169                        continue;
     170                case 0x8864: /* PPPoE */
     171                        iphdr = trace_get_payload_from_pppoe(iphdr, ethertype,
     172                                        remaining);
    169173                        continue;
    170174                default:
  • libpacketdump/eth_34916.c

    r11a7f9c r11c0f44  
    2727        printf(" PPPoE: Type: %d\n",pppoe->type);
    2828        printf(" PPPoE: Code: %d\n",pppoe->code);
    29         printf(" PPPoE: Session: %d\n",pppoe->session);
    30         printf(" PPPoE: Length: %d\n",pppoe->length);
     29        printf(" PPPoE: Session: %d\n",ntohs(pppoe->session));
     30        printf(" PPPoE: Length: %d\n",ntohs(pppoe->length));
    3131
    3232        /* Meh.. pass it off to eth decoder */
Note: See TracChangeset for help on using the changeset viewer.