All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: hannes@stressinduktion.org, netdev@vger.kernel.org,
	davem@davemloft.net, David.Laight@ACULAB.COM, jiri@resnulli.us,
	vyasevich@gmail.com, kuznet@ms2.inr.ac.ru, jmorris@namei.org,
	yoshfuji@linux-ipv6.org, kaber@trash.net, thaller@redhat.com,
	stephen@networkplumber.org
Subject: Re: [RFC PATCH net-next 2/2] udp: add sk opt to allow sending pkt with src 0.0.0.0
Date: Tue, 12 Nov 2013 09:59:16 +0100	[thread overview]
Message-ID: <5281EDE4.3080704@6wind.com> (raw)
In-Reply-To: <alpine.LFD.2.03.1311091610090.1411@ssi.bg>

Le 09/11/2013 15:46, Julian Anastasov a écrit :
>
> 	Hello,
>
> On Sat, 9 Nov 2013, Nicolas Dichtel wrote:
>
>> This feature allows to a send packets with address source set to 0.0.0.0 even if
>> an ip address is available on another interface.
>>
>> It's useful for DHCP client, to allow them to use UDP sockets and be compliant
>> with the RFC2131, Section 4.1:
>>
>> 4.1 Constructing and sending DHCP messages
>> ...
>>     DHCP messages broadcast by a client prior to that client obtaining
>>     its IP address must have the source address field in the IP header
>>     set to 0.
>>
>> Based on a previous work from
>> Guillaume Gaudonville <guillaume.gaudonville@6wind.com>.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
> ...
>
>> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
>> index 89909dd730dd..f58945187dbd 100644
>> --- a/net/ipv4/udp.c
>> +++ b/net/ipv4/udp.c
>
> ...
>
>> +	if (up->src_any && sk->sk_bound_dev_if) {
>> +		struct net_device *dev;
>> +		struct in_device *in_dev;
>> +
>> +		rcu_read_lock();
>> +		dev = dev_get_by_index_rcu(sock_net(sk), sk->sk_bound_dev_if);
>> +		in_dev = dev ? __in_dev_get_rcu(dev) : NULL;
>> +		if (!inet_confirm_addr(sock_net(sk), in_dev, 0, 0,
>> +				       RT_SCOPE_HOST))
>
> 	I don't have an opinion about UDP_SRC_ANY, just some
> comments...
>
> 	Can a simple !in_dev->ifa_list check replace the
> !inet_confirm_addr call? Looking at __inet_insert_ifa()
> it seems only 0.0.0.0 does not add an ifa. Long ago
> adding 0.0.0.0 was a way to create in_dev for dev but
> now in_dev is created on device registration, i.e. even
> before addresses are added.
>
> 	For the first patch, may be it is not needed.
> We have two choices:
>
> 1. Do not change args and just fix comments. Of course,
> it is tricky to use this function by using scope instead
> of in_dev as a key for device-specific matching because
> such interface is confusing.
I hesitated to take this choice, but I think that keeping the
original behavior is better.

>
> 2. Add 'net' arg and use in_dev as explained in my
> previous email. Not sure if changing args of exported
> function is acceptable.
FWIK, it's not a problem.


Regards,
Nicolas

  reply	other threads:[~2013-11-12  8:59 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 13:45 [patch net-next] ipv6: allow userspace to create address with IFLA_F_TEMPORARY flag Jiri Pirko
2013-10-24 13:48 ` [patch iproute2] allow to create temporary addresses Jiri Pirko
2013-10-24 14:02 ` [patch net-next] ipv6: allow userspace to create address with IFLA_F_TEMPORARY flag Hannes Frederic Sowa
2013-10-24 16:59   ` Jiri Pirko
2013-10-25 10:05     ` Vladislav Yasevich
2013-10-25 20:12       ` Hannes Frederic Sowa
2013-10-25 23:05 ` Vladislav Yasevich
2013-10-27 13:29   ` Jiri Pirko
2013-10-27 16:48     ` Hannes Frederic Sowa
2013-10-28 13:56       ` Vladislav Yasevich
2013-10-28 21:17       ` David Miller
2013-10-28 23:16         ` Dan Williams
2013-10-28 23:23           ` Dan Williams
2013-10-29  0:12             ` David Miller
2013-10-28 23:48           ` Hannes Frederic Sowa
2013-10-29 14:31             ` Dan Williams
2013-10-29 14:38               ` Hannes Frederic Sowa
2013-10-29 17:21                 ` Dan Williams
2013-10-29 16:58               ` Vlad Yasevich
2013-10-29 17:15                 ` Dan Williams
2013-10-29  0:08           ` David Miller
2013-10-29  0:13             ` Hannes Frederic Sowa
2013-10-29  0:46               ` David Miller
2013-10-28 23:31         ` Hannes Frederic Sowa
2013-10-29  0:43           ` David Miller
2013-10-29  9:37             ` David Laight
2013-10-29 12:40               ` Hannes Frederic Sowa
2013-10-29 13:09                 ` Eric Dumazet
2013-10-29 13:11                   ` Hannes Frederic Sowa
2013-10-29 19:58                 ` David Miller
2013-11-01 21:28                   ` Hannes Frederic Sowa
2013-11-05 17:02                 ` Nicolas Dichtel
2013-11-05 17:12                   ` David Laight
2013-11-05 21:11                     ` Hannes Frederic Sowa
2013-11-06  9:23                       ` David Laight
2013-11-06 12:03                         ` Hannes Frederic Sowa
2013-11-05 20:57                   ` Hannes Frederic Sowa
2013-11-06  8:11                     ` Nicolas Dichtel
2013-11-09  0:54                     ` [RFC PATCH net-next 1/2] ipv4: fix wildcard search with inet_confirm_addr() Nicolas Dichtel
2013-11-09  0:54                       ` [RFC PATCH net-next 2/2] udp: add sk opt to allow sending pkt with src 0.0.0.0 Nicolas Dichtel
2013-11-09 14:46                         ` Julian Anastasov
2013-11-12  8:59                           ` Nicolas Dichtel [this message]
2013-11-11  5:18                         ` David Miller
2013-11-14 13:05                           ` Nicolas Dichtel
2013-11-14 19:57                             ` David Miller
2013-11-18  9:15                               ` Nicolas Dichtel
2013-11-14 14:31                           ` Hannes Frederic Sowa
2013-11-14 20:00                             ` David Miller
2013-10-29 19:44               ` [patch net-next] ipv6: allow userspace to create address with IFLA_F_TEMPORARY flag 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=5281EDE4.3080704@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=ja@ssi.bg \
    --cc=jiri@resnulli.us \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=thaller@redhat.com \
    --cc=vyasevich@gmail.com \
    --cc=yoshfuji@linux-ipv6.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 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.