-static void
-decode_pppoe(u_char *user _unused_,
- const struct pcap_pkthdr *pheader,
- const u_char *pdata)
-{
- struct pktsummary sm;
- memset(&sm, 0, sizeof(sm));
- sm.time = pheader->ts.tv_sec;
- decode_pppoe_real(pdata, pheader->caplen, &sm);
-}
-
-static void
-decode_pppoe_real(const u_char *pdata, const uint32_t len,
- struct pktsummary *sm)
-{
- if (len < PPPOE_HDR_LEN) {
- verbosef("pppoe: packet too short (%u bytes)", len);
- return;
- }
-
- if (pdata[1] != 0x00) {
- verbosef("pppoe: code = 0x%02x, expecting 0; ignoring.", pdata[1]);
- return;
- }
-
- if ((pdata[6] == 0xc0) && (pdata[7] == 0x21)) return; /* LCP */
- if ((pdata[6] == 0xc0) && (pdata[7] == 0x25)) return; /* LQR */
-
- if ((pdata[6] == 0x00) && (pdata[7] == 0x21)) {
- decode_ip(pdata + PPPOE_HDR_LEN, len - PPPOE_HDR_LEN, sm);
- acct_for(sm);
- } else
- verbosef("pppoe: non-IP PPPoE packet (0x%02x%02x); ignoring.",
- pdata[6], pdata[7]);
+static int decode_pppoe(DECODER_ARGS) {
+ return helper_pppoe(pdata, pheader->caplen, sm);