mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
ipv6: Nonlocal bind
Add support to allow non-local binds similar to how this was done for IPv4. Non-local binds are very useful in emulating the Internet in a box, etc. This add the ip_nonlocal_bind sysctl under ipv6. Testing: Set up nonlocal binding and receive routing on a host, e.g.: ip -6 rule add from ::/0 iif eth0 lookup 200 ip -6 route add local 2001:0:0:1::/64 dev lo proto kernel scope host table 200 sysctl -w net.ipv6.ip_nonlocal_bind=1 Set up routing to 2001:0:0:1::/64 on peer to go to first host ping6 -I 2001:0:0:1::1 peer-address -- to verify Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5a10ececc6
commit
35a256fee5
6 changed files with 20 additions and 3 deletions
|
@ -295,7 +295,8 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
|||
* unspecified and mapped address have a v4 equivalent.
|
||||
*/
|
||||
v4addr = LOOPBACK4_IPV6;
|
||||
if (!(addr_type & IPV6_ADDR_MULTICAST)) {
|
||||
if (!(addr_type & IPV6_ADDR_MULTICAST) &&
|
||||
!sock_net(sk)->ipv6.sysctl.ip_nonlocal_bind) {
|
||||
err = -EADDRNOTAVAIL;
|
||||
if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr,
|
||||
dev, 0)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue