Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135527
b: refs/heads/master
c: 63d9950
h: refs/heads/master
i:
  135525: 077f20a
  135523: f2e5e55
  135519: 52c33fd
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed Mar 25, 2009
1 parent b0b9c27 commit 40e7876
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0f8d3c7ac3693d7b6c731bf2159273a59bf70e12
refs/heads/master: 63d9950b08184e6531adceb65f64b429909cc101
14 changes: 11 additions & 3 deletions trunk/net/ipv6/af_inet6.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,26 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)

/* Check if the address belongs to the host. */
if (addr_type == IPV6_ADDR_MAPPED) {
int chk_addr_ret;

/* Binding to v4-mapped address on a v6-only socket
* makes no sense
*/
if (np->ipv6only) {
err = -EINVAL;
goto out;
}

/* Reproduce AF_INET checks to make the bindings consitant */
v4addr = addr->sin6_addr.s6_addr32[3];
if (inet_addr_type(net, v4addr) != RTN_LOCAL) {
err = -EADDRNOTAVAIL;
chk_addr_ret = inet_addr_type(net, v4addr);
if (!sysctl_ip_nonlocal_bind &&
!(inet->freebind || inet->transparent) &&
v4addr != htonl(INADDR_ANY) &&
chk_addr_ret != RTN_LOCAL &&
chk_addr_ret != RTN_MULTICAST &&
chk_addr_ret != RTN_BROADCAST)
goto out;
}
} else {
if (addr_type != IPV6_ADDR_ANY) {
struct net_device *dev = NULL;
Expand Down

0 comments on commit 40e7876

Please sign in to comment.