$NetBSD: patch-aa,v 1.2 2006/10/07 07:49:01 obache Exp $ --- decode.c.orig 2006-08-07 02:26:32.000000000 +0200 +++ decode.c @@ -54,6 +54,8 @@ static void decode_ether(u_char *, const const u_char *); static void decode_loop(u_char *, const struct pcap_pkthdr *, const u_char *); +static void decode_ppp(u_char *, const struct pcap_pkthdr *, + const u_char *); static void decode_pppoe(u_char *, const struct pcap_pkthdr *, const u_char *); static void decode_linux_sll(u_char *, const struct pcap_pkthdr *, @@ -67,7 +69,10 @@ static const linkhdr_t linkhdrs[] = { { DLT_EN10MB, ETHER_HDR_LEN, decode_ether }, { DLT_LOOP, NULL_HDR_LEN, decode_loop }, { DLT_NULL, NULL_HDR_LEN, decode_loop }, - { DLT_PPP, PPP_HDR_LEN, NULL }, + { DLT_PPP, PPP_HDR_LEN, decode_ppp }, +#if defined(__NetBSD__) + { DLT_PPP_SERIAL, PPP_HDR_LEN, decode_ppp }, +#endif { DLT_FDDI, FDDI_HDR_LEN, NULL }, { DLT_PPP_ETHER, PPPOE_HDR_LEN, decode_pppoe }, { DLT_LINUX_SLL, SLL_HDR_LEN, decode_linux_sll }, @@ -172,6 +177,22 @@ decode_loop(u_char *user _unused_, } static void +decode_ppp(u_char *user _unused_, + const struct pcap_pkthdr *pheader, + const u_char *pdata) +{ + pktsummary sm; + memset(&sm, 0, sizeof(sm)); + + if (pdata[2] == 0x00 && pdata[3] == 0x21) { + decode_ip(pdata + PPP_HDR_LEN, pheader->caplen - PPP_HDR_LEN, &sm); + sm.time = pheader->ts.tv_sec; + acct_for(&sm); + } else + verbosef("non-IP PPP packet; ignoring."); +} + +static void decode_pppoe(u_char *user _unused_, const struct pcap_pkthdr *pheader, const u_char *pdata)