validate incoming interface
authorJohn Crispin <blogic@openwrt.org>
Sat, 30 Aug 2014 11:17:02 +0000 (13:17 +0200)
committerJohn Crispin <blogic@openwrt.org>
Sat, 30 Aug 2014 11:17:15 +0000 (13:17 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
interface.c

index 0d34e72fde36b579b7200ade1c1a9c7e5eb0a7f5..b875fd4759c79f7fb542ed07fd4d258a1e0c0019 100644 (file)
@@ -174,10 +174,10 @@ read_socket(struct uloop_fd *u, unsigned int events)
                else if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_PKTINFO)
                        ifindex = ((struct in6_pktinfo *) c)->ipi6_ifindex;
        }
-       if (ifindex)
+       if (ifindex != iface->ifindex)
+               fprintf(stderr, "invalid iface index %d != %d\n", ifindex, iface->ifindex);
+       else
                dns_handle_packet(iface, buffer, len);
-
-       printf("%d\n", ifindex);
 }
 
 static int