netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make SO_BINDTODEVICE bind very tightly
@ 2003-10-07 22:16 Casey Carter
  2003-10-08 11:49 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Casey Carter @ 2003-10-07 22:16 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

In the presence of both sockets that are and sockets that are not bound 
to a specific interface, those bound to the interface should always be 
favored for packet delivery over those not so bound.  Attached patch 
(against 2.6.0-test6) enforces these semantics by a slight adjustment to 
udp_v4_lookup_longway in net/ipv4/udp.c  The consequence of this change 
is to make SO_BINDTODEVICE bind more tightly than simple bind().

-- 
Casey Carter
Casey@Carter.net
ccarter@cs.uiuc.edu
AIM: cartec69


[-- Attachment #2: udp.c.diff --]
[-- Type: text/plain, Size: 398 bytes --]

--- linux-2.6.0-test6/net/ipv4/udp.c	2003-09-27 19:50:10.000000000 -0500
+++ linux-2.6.0-test6-patch/net/ipv4/udp.c	2003-10-07 17:08:10.000000000 -0500
@@ -246,9 +246,9 @@
 			if (sk->sk_bound_dev_if) {
 				if (sk->sk_bound_dev_if != dif)
 					continue;
-				score+=2;
+				score+=8;
 			}
-			if(score == 9) {
+			if(score == 15) {
 				result = sk;
 				break;
 			} else if(score > badness) {

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

end of thread, other threads:[~2003-10-08 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-07 22:16 [PATCH] Make SO_BINDTODEVICE bind very tightly Casey Carter
2003-10-08 11:49 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).