From 46e580b2eff6c60837bbbfd55e4a0178d0c9b10b Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 30 Aug 2014 13:17:02 +0200 Subject: [PATCH] validate incoming interface Signed-off-by: John Crispin --- interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface.c b/interface.c index 0d34e72..b875fd4 100644 --- a/interface.c +++ b/interface.c @@ -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 -- 2.25.1