From: Tóth László Attila Date: Wed, 1 Oct 2008 14:31:24 +0000 (-0700) Subject: ipv4: Allow binding to non-local addresses if IP_TRANSPARENT is set X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9fb15067ce93497bef852c05e406d7a96212a9a;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git ipv4: Allow binding to non-local addresses if IP_TRANSPARENT is set Setting IP_TRANSPARENT is not really useful without allowing non-local binds for the socket. To make user-space code simpler we allow these binds even if IP_TRANSPARENT is set but IP_FREEBIND is not. Signed-off-by: Tóth László Attila Signed-off-by: David S. Miller --- diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 8a3ac1fa71a9..1fbff5fa4241 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -469,7 +469,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) */ err = -EADDRNOTAVAIL; if (!sysctl_ip_nonlocal_bind && - !inet->freebind && + !(inet->freebind || inet->transparent) && addr->sin_addr.s_addr != htonl(INADDR_ANY) && chk_addr_ret != RTN_LOCAL && chk_addr_ret != RTN_MULTICAST &&