3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

monitor: Check that protocol type is set to generic netlink

This commit is contained in:
Marcel Holtmann 2014-08-06 00:12:20 +02:00
parent d0068dcf4c
commit d484715a17

View File

@ -145,6 +145,7 @@ static int process_pcap(struct pcap *pcap)
while (pcap_read(pcap, NULL, buf, sizeof(buf), &len)) { while (pcap_read(pcap, NULL, buf, sizeof(buf), &len)) {
uint16_t arphrd_type; uint16_t arphrd_type;
uint16_t proto_type;
if (len < 16) { if (len < 16) {
fprintf(stderr, "Too short package\n"); fprintf(stderr, "Too short package\n");
@ -158,7 +159,13 @@ static int process_pcap(struct pcap *pcap)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
nlmon_print(nlmon, buf + 16, len - 16); proto_type = L_GET_UNALIGNED((const uint16_t *) (buf + 14));
switch (L_BE16_TO_CPU(proto_type)) {
case NETLINK_GENERIC:
nlmon_print(nlmon, buf + 16, len - 16);
break;
}
} }
nlmon_destroy(nlmon); nlmon_destroy(nlmon);