All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Carter <Casey@Carter.net>
To: netdev@oss.sgi.com
Subject: [PATCH] Make SO_BINDTODEVICE bind very tightly
Date: Tue, 07 Oct 2003 17:16:25 -0500	[thread overview]
Message-ID: <3F833B39.4020606@Carter.net> (raw)

[-- 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) {

             reply	other threads:[~2003-10-07 22:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-07 22:16 Casey Carter [this message]
2003-10-08 11:49 ` [PATCH] Make SO_BINDTODEVICE bind very tightly David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F833B39.4020606@Carter.net \
    --to=casey@carter.net \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.