lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 9 Nov 2013 16:46:29 +0200 (EET)
From:	Julian Anastasov <ja@....bg>
To:	Nicolas Dichtel <nicolas.dichtel@...nd.com>
cc:	hannes@...essinduktion.org, netdev@...r.kernel.org,
	davem@...emloft.net, David.Laight@...LAB.COM, jiri@...nulli.us,
	vyasevich@...il.com, kuznet@....inr.ac.ru, jmorris@...ei.org,
	yoshfuji@...ux-ipv6.org, kaber@...sh.net, thaller@...hat.com,
	stephen@...workplumber.org
Subject: Re: [RFC PATCH net-next 2/2] udp: add sk opt to allow sending pkt
 with src 0.0.0.0


	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@...nd.com>.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.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.

2. Add 'net' arg and use in_dev as explained in my
previous email. Not sure if changing args of exported
function is acceptable.

Regards

--
Julian Anastasov <ja@....bg>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists