static int parse_llc(unsigned char ** buf, int len, struct packet_info* p) { DEBUG("* parse LLC\n"); if (len < 6) return -1; /* check type in LLC header */ *buf = *buf + 6; if (ntohs(*((uint16_t*)*buf)) == 0x4305) { DEBUG("BATMAN-ADV\n"); (*buf)++; (*buf)++; return parse_batman_adv_packet(buf, len - 8, p); } else { if (**buf != 0x08) return -1; (*buf)++; if (**buf == 0x06) { /* ARP */ p->pkt_types |= PKT_TYPE_ARP; return 0; } if (**buf != 0x00) /* not IP */ return -1; (*buf)++; DEBUG("* parse LLC left %d\n", len - 8); return len - 8; } }
static int parse_llc(unsigned char* buf, size_t len, struct uwifi_packet* p) { LOG_DBG("* parse LLC"); if (len < 6) return -1; /* check type in LLC header */ buf = buf + 6; if (ntohs(*((uint16_t*)buf)) == 0x4305) { LOG_DBG("BATMAN-ADV"); buf++; buf++; return parse_batman_adv_packet(buf, len - 8, p); } else { if (*buf != 0x08) return -1; buf++; if (*buf == 0x06) { /* ARP */ p->pkt_types |= PKT_TYPE_ARP; return 0; } if (*buf != 0x00) /* not IP */ return -1; buf++; LOG_DBG("* parse LLC left %zd", len - 8); return 8; } }