summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmritha Nambiar <amritha.nambiar@intel.com>2015-10-13 22:08:46 -0700
committerPaul Jakma <paul@quagga.net>2015-10-27 10:53:22 +0000
commitee162617ead116ebcda93b145a043231647b3380 (patch)
treef84b2591937d82fb05d12b920ccc857b1765cfa6
parenta6a11765d4206a00b0875988ce352be7cdfa3617 (diff)
downloadquagga-ee162617ead116ebcda93b145a043231647b3380.tar.bz2
quagga-ee162617ead116ebcda93b145a043231647b3380.tar.xz
isisd: Drop packet received on multiple interfaces due to the time gap in binding socket to an interface
Due to the time window between opening socket and binding it to an interface, the same hello packet is delivered on multiple interfaces, unique socket per circuit is not yet established. When such hellos get processed, they form incorrect adjacencies. So, drop the packet that is received on multiple interfaces because the socket for the circuit is yet to bind to an interface. V2: Fix warning on sign comparison Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
-rw-r--r--isisd/isis_pfpacket.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/isisd/isis_pfpacket.c b/isisd/isis_pfpacket.c
index d2022645..a9ecd40f 100644
--- a/isisd/isis_pfpacket.c
+++ b/isisd/isis_pfpacket.c
@@ -230,12 +230,24 @@ isis_recv_pdu_bcast (struct isis_circuit *circuit, u_char * ssnpa)
LLC_LEN, MSG_PEEK,
(struct sockaddr *) &s_addr, (socklen_t *) &addr_len);
- if (bytesread < 0)
+ if ((bytesread < 0) || (s_addr.sll_ifindex != (int)circuit->interface->ifindex))
{
- zlog_warn ("isis_recv_packet_bcast(): ifname %s, fd %d, bytesread %d, "
- "recvfrom(): %s",
- circuit->interface->name, circuit->fd, bytesread,
- safe_strerror (errno));
+ if (bytesread < 0)
+ {
+ zlog_warn ("isis_recv_packet_bcast(): ifname %s, fd %d, "
+ "bytesread %d, recvfrom(): %s",
+ circuit->interface->name, circuit->fd, bytesread,
+ safe_strerror (errno));
+ }
+ if (s_addr.sll_ifindex != (int)circuit->interface->ifindex)
+ {
+ zlog_warn("packet is received on multiple interfaces: "
+ "socket interface %d, circuit interface %d, "
+ "packet type %u",
+ s_addr.sll_ifindex, circuit->interface->ifindex,
+ s_addr.sll_pkttype);
+ }
+
/* get rid of the packet */
bytesread = recvfrom (circuit->fd, discard_buff, sizeof (discard_buff),
MSG_DONTWAIT, (struct sockaddr *) &s_addr,