public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: Keep interface binding when sending packets with  ipi_ifindex = 0
@ 2009-07-23 21:39 Chia-chi Yeh (葉家齊)
  2009-07-27 21:44 ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Chia-chi Yeh (葉家齊) @ 2009-07-23 21:39 UTC (permalink / raw)
  To: linux-kernel

In IPv4, sending a packet with ipi_ifindex = 0 via an interface-bound
socket will unbind the packet to that interface. This behavior is
different from IPv6 which treats ipi6_ifindex = 0 as unspecified.
Furthermore, IPv6 does not allow sending packets to other interface
than the bound one, but I am not sure if it is necessary in IPv4. The
following patch keeps the interface binding when ipi_ifindex = 0.

Thanks,
Chia-chi

--- a/net/ipv4/ip_sockglue.c	2009-07-24 04:50:45.000000000 +0800
+++ b/net/ipv4/ip_sockglue.c	2009-07-24 04:51:09.000000000 +0800
@@ -213,7 +213,8 @@
 			if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct in_pktinfo)))
 				return -EINVAL;
 			info = (struct in_pktinfo *)CMSG_DATA(cmsg);
-			ipc->oif = info->ipi_ifindex;
+			if (info->ipi_ifindex)
+				ipc->oif = info->ipi_ifindex;
 			ipc->addr = info->ipi_spec_dst.s_addr;
 			break;
 		}

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-08-05  2:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 21:39 [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0 Chia-chi Yeh (葉家齊)
2009-07-27 21:44 ` Andrew Morton
2009-07-30  0:10   ` John Dykstra
2009-08-04  4:23     ` David Miller
2009-08-04  7:36       ` Chia-chi Yeh (葉家齊)
2009-08-04  7:57         ` Badalian Vyacheslav
2009-08-04  8:28           ` Chia-chi Yeh (葉家齊)
2009-08-04 18:57         ` David Miller
2009-08-05  0:06           ` Chia-chi Yeh (葉家齊)
2009-08-05  2:33             ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox