From: Herbert Xu <herbert@gondor.apana.org.au>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: unintended ipv4 broadcast policy change
Date: Thu, 23 Jun 2011 08:41:34 +0800 [thread overview]
Message-ID: <20110623004134.GA22314@gondor.apana.org.au> (raw)
In-Reply-To: <20110622.163935.2248705300315908767.davem@davemloft.net>
On Wed, Jun 22, 2011 at 04:39:35PM -0700, David Miller wrote:
>
> The context is that I'm looking into cleaning up up the mess we have
> wrt. DHCP listening on packet sockets and (in some cases) seeing every
> packet that hits the system.
>
> Anyways, back in 2007 this commit was made:
>
> commit 8030f54499925d073a88c09f30d5d844fb1b3190
> Author: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Thu Feb 22 01:53:47 2007 +0900
>
> [IPV4] devinet: Register inetdev earlier.
It appears that the intention was to allow sysctl control prior
to device open.
> So now every net device registered has inetdev_init() called on it.
>
> This has a subtle policy side effect that has some interesting
> implications. The route input slow path has this check:
>
> /* IP on this device is disabled. */
>
> if (!in_dev)
> goto out;
>
> But now this will never, ever, be true.
If we ever wanted to disable IPv4 we could always add a sysctl
for that, just like IPv6.
> Which means that previously we would not accept even broadcast
> or multicast packets on an interface that hasn't had at least
> one IP address configured.
>
> Now we will.
This indeed is an unintended side-effect.
> I think we have a hard decision to make. One option is to
> fix the input routing check, by changing it to test if the
> ipv4 address list is empty.
>
> The second option is to remove the check entirely and keep the
> new behavior.
We could also add a disable_ipv4 sysctl and then replace this
check in the routing code with a disable_ipv4 check at the very
top of the IPv4 receive path, just like IPv6.
> This subtle new behavior is interesting because it means that
> a DHCP client could be implemented entirely with plain UDP
> sockets.
Yes this is indeed possible. However, for compatibility purposes
I'm not sure whether we can safely rely on this new behaviour.
Maybe if we add the disable_ipv4 sysctl we can use it to signal
the presence of this new behaviour.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2011-06-23 0:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 23:39 unintended ipv4 broadcast policy change David Miller
2011-06-23 0:41 ` Herbert Xu [this message]
2011-06-23 2:41 ` David Miller
2011-06-23 5:41 ` David Miller
2011-06-23 0:42 ` David Miller
2011-06-23 15:16 ` Stephen Hemminger
2011-06-23 20:45 ` David Miller
2011-06-23 21:01 ` Stephen Hemminger
2011-06-23 21:08 ` David Miller
2011-06-24 17:01 ` Stephen Hemminger
2011-06-24 19:54 ` David Miller
2011-06-25 0:27 ` Herbert Xu
2011-06-25 0:28 ` David 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=20110623004134.GA22314@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox