Trouble with IPv6 and VRFs: Cannot assign requested address

Ralf Jung post at ralfj.de
Sun Dec 30 15:52:53 CET 2018


Hi again,

I have now also played around with bird 2.0 a bit, but got the same result: IPv4
works, but IPv6 says "Cannot assign requested address".  I have attached my
stripped-down configuration, which (as far as I can tell) is entirely symmetric
for IPv4 and IPv6.

I am starting bird as

> sudo ./bird -c bird.conf -d

The log looks like:

> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v4: Channel ipv4 connected to table ffrl_v4
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v4: Initializing
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v6: Channel ipv6 connected to table ffrl_v6
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v6: Initializing
> 2018-12-30 14:45:22.302 <WARN> Missing broadcast address for interface saarBR
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v4: Starting
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v4: State changed to start
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v6: Starting
> 2018-12-30 14:45:22.302 <TRACE> ffrl_a_ak_v6: State changed to start
> 2018-12-30 14:45:22.302 <INFO> Started
> 2018-12-30 14:45:22.307 <TRACE> ffrl_a_ak_v6: Started
> 2018-12-30 14:45:22.307 <TRACE> ffrl_a_ak_v6: Connect delayed by 5 seconds
> 2018-12-30 14:45:22.307 <TRACE> ffrl_a_ak_v4: Started
> 2018-12-30 14:45:22.307 <TRACE> ffrl_a_ak_v4: Connect delayed by 5 seconds
> 2018-12-30 14:45:26.312 <TRACE> ffrl_a_ak_v6: Connecting to 2a03:2260:0:194::1 from local address 2a03:2260:0:194::2
> 2018-12-30 14:45:26.312 <ERR> ffrl_a_ak_v6: Socket error: bind: Cannot assign requested address
> 2018-12-30 14:45:26.312 <TRACE> ffrl_a_ak_v6: Connection closed
> 2018-12-30 14:45:26.526 <TRACE> ffrl_a_ak_v6: Connect delayed by 5 seconds
> 2018-12-30 14:45:26.526 <TRACE> ffrl_a_ak_v4: Connecting to 100.64.3.20 from local address 100.64.3.21
> 2018-12-30 14:45:26.544 <TRACE> ffrl_a_ak_v4: Connected
> 2018-12-30 14:45:26.544 <TRACE> ffrl_a_ak_v4: Sending OPEN(ver=4,as=64899,hold=240,id=52a5a2ef)
> 2018-12-30 14:45:26.562 <TRACE> ffrl_a_ak_v4: Got OPEN(as=23456,hold=240,id=185.66.192.3)
> 2018-12-30 14:45:26.562 <TRACE> ffrl_a_ak_v4: Sending KEEPALIVE
> 2018-12-30 14:45:26.580 <TRACE> ffrl_a_ak_v4: Got KEEPALIVE
> 2018-12-30 14:45:26.580 <TRACE> ffrl_a_ak_v4: BGP session established

Some snapshots from strace:

> socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP) = 7
> fcntl(7, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
> setsockopt(7, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
> setsockopt(7, SOL_IPV6, IPV6_UNICAST_HOPS, [255], 4) = 0
> setsockopt(7, SOL_IPV6, IPV6_TCLASS, [192], 4) = 0
> setsockopt(7, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(7, {sa_family=AF_INET6, sin6_port=htons(179), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 32) = 0
> listen(7, 8)                            = 0

> socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 8
> fcntl(8, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
> setsockopt(8, SOL_IP, IP_TTL, [255], 4) = 0
> setsockopt(8, SOL_IP, IP_TOS, [192], 4) = 0
> setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(8, {sa_family=AF_INET, sin_port=htons(179), sin_addr=inet_addr("0.0.0.0")}, 32) = 0
> listen(8, 8)                            = 0

> socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 9
> fcntl(9, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
> setsockopt(9, SOL_SOCKET, SO_BINDTODEVICE, "tun-up-a_ak\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 40) = 0
> setsockopt(9, SOL_SOCKET, SO_DONTROUTE, [1], 4) = 0
> setsockopt(9, SOL_IP, IP_TTL, [1], 4)   = 0
> setsockopt(9, SOL_IP, IP_TOS, [192], 4) = 0
> bind(9, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("100.64.3.21")}, 32) = 0

> socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP) = 10
> fcntl(10, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
> setsockopt(10, SOL_SOCKET, SO_BINDTODEVICE, "tun-up-a_ak\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 40) = 0
> setsockopt(10, SOL_SOCKET, SO_DONTROUTE, [1], 4) = 0
> setsockopt(10, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
> setsockopt(10, SOL_IPV6, IPV6_UNICAST_HOPS, [1], 4) = 0
> setsockopt(10, SOL_IPV6, IPV6_TCLASS, [192], 4) = 0
> bind(10, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2a03:2260:0:194::2", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 32) = -1 EADDRNOTAVAIL (Cannot assign requested address)

This, too, looks entirely symmetric between IPv4 and IPv6.  Is it possible that
this is a kernel bug?

Kind regards,
Ralf
-------------- next part --------------
log stderr all;
router id 82.165.162.239;

# interne BIRD Routing-Tabelle
ipv6 table ffrl_v6;
ipv4 table ffrl_v4;

# freifunk ip ranges in general
function is_ffrl_export_v6() {
    return net ~ [
        2a03:2260:3009:100::/56,
        2a03:2260:3009::/56,
        2a03:2260:3009:f00::/56
    ];
}

function is_default_v6() {
    return net ~ [
        ::/0
    ];
}

# BGP Import Filter für Rheinland
filter ffrl_import_filter_v6 {
    if is_default_v6() then accept;
    reject;
}

# BGP Export Filter für Rheinland
filter ffrl_export_filter_v6 {
    if is_ffrl_export_v6() then accept;
    reject;
}

function is_ffrl_nat_v4() {
    return net ~ [
        185.66.193.26/32
    ];
}

function is_ffrl_tunnel_nets_v4() {
    return net ~ [
        # anything within this subnets
        100.64.0.0/16+
    ];
}

function is_default_v4() {
    return net ~ [
        # Exactly matching this subnet
        0.0.0.0/0
    ];
}

# BGP Import Filter für Rheinland
filter ffrl_import_filter_v4 {
    if is_default_v4() then accept;
    reject;
}

# BGP Export Filter für Rheinland
filter ffrl_export_filter_v4 {
    if is_ffrl_nat_v4() then accept;
    reject;
}


# Dies lädt die Devices in die Tabelle. Die meisten anderen Protokolle brauchen das.
protocol device {
    scan time 30;
}

# Statische Routen für unsere Netze
protocol static {
    ipv6 { table ffrl_v6; };
    vrf "vrf_freifunk";
    
    # FFRL-assigned space: Gateway subspaces
    # we are all in the same layer 2 segment, so we can take all this
    route 2a03:2260:3009:100::/56 via "saarBR";
    route 2a03:2260:3009:200::/56 via "saarBR";
    route 2a03:2260:3009:300::/56 via "saarBR";    
    route 2a03:2260:3009:400::/56 via "saarBR";

    # FFRL-assigned space: subet for admin & user services
    route 2a03:2260:3009::/56 via "saarBR";
    route 2a03:2260:3009:f00::/56 via "saarBR";
    # FFRL-assigned space: blackhole the rest
    route 2a03:2260:3009::/48 unreachable;
    # Intranet space
    route fd4e:f2d7:88d2:ffff::/64 via "saarBR";
}

protocol static local_routes {
    ipv4 { table ffrl_v4; };
    vrf "vrf_freifunk";

    # FFRL-assigned address
    route 185.66.193.26/32 via "ffrl_lo";

    # Intranet space
    route 10.24.192.0/18 via "saarBR";
}


# Wir exportieren über Rheinland gelernte Routen in die Kernel Table 1042 (freifunk)
protocol kernel kernel_ffrl_v6 {
    scan time 30;
    ipv6 {
      import none;
      export filter {
        # Advise the kernel about which address to use as the source
        krt_prefsrc = 2a03:2260:3009::2;
        accept;
      };
      table ffrl_v6;
    };
    vrf "vrf_freifunk";
    kernel table 1042;
};
protocol kernel kernel_ffrl_v4 {
    scan time 30;
    ipv4 {
        import none;
        export filter {
          krt_prefsrc = 185.66.193.26;
          accept;
      };
      table ffrl_v4;
    };
    vrf "vrf_freifunk";
    kernel table 1042;
};



# P E E R I N G S

protocol bgp ffrl_a_ak_v4 {
    local as 64899;
    ipv4 {
      table ffrl_v4;
      import keep filtered;
      import filter ffrl_import_filter_v4;
      export filter ffrl_export_filter_v4;
      next hop self;
    };
    direct;
    debug all;
    vrf "vrf_freifunk";
    source address 100.64.3.21;
    neighbor 100.64.3.20 as 201701;    
};

protocol bgp ffrl_a_ak_v6 {
    local as 64899;
    ipv6 {
      table ffrl_v6;
      import keep filtered;
      import filter ffrl_import_filter_v6;
      export filter ffrl_export_filter_v6;
      next hop self;
    };
    direct;
    debug all;
    vrf "vrf_freifunk";
    source address 2a03:2260:0:194::2;
    neighbor 2a03:2260:0:194::1 as 201701;
};


More information about the Bird-users mailing list