* [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* Re: [PATCH] Make SO_BINDTODEVICE bind very tightly
2003-10-07 22:16 [PATCH] Make SO_BINDTODEVICE bind very tightly Casey Carter
@ 2003-10-08 11:49 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-10-08 11:49 UTC (permalink / raw)
To: Casey Carter; +Cc: netdev
On Tue, 07 Oct 2003 17:16:25 -0500
Casey Carter <Casey@Carter.net> wrote:
> 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.
No, the fix made in the original posting of this thread is the
correct one. One may not have some sockets with SO_BINDTODEVICE
and some with not bound at the same time to the same identity.
Therefore the fix should be a bind() time.
^ 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).