Hello list, in bird6 I can use the following configuration snippet with IPv6 link local addresses: protocol bgp xxx { neighbor fe80::2ff:c0bb:fe00:1234 % '784648196' as 1234; }; ('784648196' is the interface name) My question is now: How can I use IPv4 scope link addresses in bird4? When I use the line below I get an error: "Link-local address and interface scope must be used together" protocol bgp xxx { neighbor 169.254.0.1 % '784648196' as 1234; }; Thanks, Amadeus
I forgot to mention that my interface ‘784648196’ has an IPv4 scope link address configured like this: 784648196@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1462 qdisc pfifo_fast master bat0 state UNKNOWN group default qlen 1000 inet 169.254.40.2/21 scope link 784648196 How can I use scope link configurations with BGP in bird4? Thanks again, Amadeus
On 14 Feb 2015, at 12:13, Amadeus Alfa <amadeus@freehop.mooo.com> wrote:
Hello list,
in bird6 I can use the following configuration snippet with IPv6 link local addresses:
protocol bgp xxx { neighbor fe80::2ff:c0bb:fe00:1234 % '784648196' as 1234; };
('784648196' is the interface name)
My question is now: How can I use IPv4 scope link addresses in bird4?
When I use the line below I get an error: "Link-local address and interface scope must be used together"
protocol bgp xxx { neighbor 169.254.0.1 % '784648196' as 1234; };
Thanks, Amadeus
Hello list, I have checked the implementation again and it seems ‘ipv4_has_link_scope()’ is not implemented: ipv6.h (everything works fine): 65 #define ipa_has_link_scope(x) ipv6_has_link_scope(&(x)) 90 static inline int ipv6_has_link_scope(ip_addr *a) 91 { 92 return ((a->addr[0] & 0xffc00000) == 0xfe800000); 93 } ipv4.h (returns 0 in any case) 59 #define ipa_has_link_scope(x) ipv4_has_link_scope(_I(x)) 77 static inline int ipv4_has_link_scope(u32 a UNUSED) 78 { 79 return 0; 80 } However, does it make sense to do this check in the first place? Thanks, Amadeus
On 21 Feb 2015, at 18:39, Amadeus Alfa <amadeus@freehop.mooo.com> wrote:
I forgot to mention that my interface ‘784648196’ has an IPv4 scope link address configured like this:
784648196@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1462 qdisc pfifo_fast master bat0 state UNKNOWN group default qlen 1000 inet 169.254.40.2/21 scope link 784648196
How can I use scope link configurations with BGP in bird4?
Thanks again, Amadeus
On 14 Feb 2015, at 12:13, Amadeus Alfa <amadeus@freehop.mooo.com <mailto:amadeus@freehop.mooo.com>> wrote:
Hello list,
in bird6 I can use the following configuration snippet with IPv6 link local addresses:
protocol bgp xxx { neighbor fe80::2ff:c0bb:fe00:1234 % '784648196' as 1234; };
('784648196' is the interface name)
My question is now: How can I use IPv4 scope link addresses in bird4?
When I use the line below I get an error: "Link-local address and interface scope must be used together"
protocol bgp xxx { neighbor 169.254.0.1 % '784648196' as 1234; };
Thanks, Amadeus
On Mon, Feb 23, 2015 at 08:34:39PM +0100, Amadeus Alfa wrote:
Hello list,
I have checked the implementation again and it seems ‘ipv4_has_link_scope()’ is not implemented:
Hi IPv4 link-local addresses are not supported in BIRD because AFAIK there are no real link-local addresses in IPv4. There is reserved range (169.254.0.0/16), but in the sockets API, these addresses are handled as any other IPv4 addresses (compared to IPv6 link-local addresses, where you may and also must specify interface as scope). If you have one interface, just don't use the interface name. We currently do not handle well having the same IPv4 address range on multiple interfaces, but when this will be fixed, it would work in the same way for 169.254.0.0/16 and any other IPv4 prefix. Note that it is not a good idea to have completely numeric interface name, it will be parsed as number and would not work even with IPv6 address in BIRD. That can be fixed by using '' (as in your original post). -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hi Ondrej, thanks for clarification. Since we are using more than 1 interface the solution suggested will not work for us. I have created a small patch that works for our problem, but of course does not apply to others: --- lib/ipv4.h 2014-04-01 11:24:10.000000000 +0200 +++ lib/ipv4.h 2015-02-26 18:13:10.741542610 +0100 @@ -74,8 +74,12 @@ u32 ipv4_class_mask(u32); byte *ipv4_skip_header(byte *, int *); -static inline int ipv4_has_link_scope(u32 a UNUSED) +static inline int ipv4_has_link_scope(u32 a) { + if (((a >> 24) & 0xFF) == 169 && ((a >> 16) & 0xFF) == 254) { + return 1; + } + return 0; } Best wishes, Amadeus
On 23 Feb 2015, at 21:09, Ondrej Zajicek <santiago@crfreenet.org> wrote:
On Mon, Feb 23, 2015 at 08:34:39PM +0100, Amadeus Alfa wrote:
Hello list,
I have checked the implementation again and it seems ‘ipv4_has_link_scope()’ is not implemented:
Hi
IPv4 link-local addresses are not supported in BIRD because AFAIK there are no real link-local addresses in IPv4. There is reserved range (169.254.0.0/16), but in the sockets API, these addresses are handled as any other IPv4 addresses (compared to IPv6 link-local addresses, where you may and also must specify interface as scope).
If you have one interface, just don't use the interface name. We currently do not handle well having the same IPv4 address range on multiple interfaces, but when this will be fixed, it would work in the same way for 169.254.0.0/16 and any other IPv4 prefix.
Note that it is not a good idea to have completely numeric interface name, it will be parsed as number and would not work even with IPv6 address in BIRD. That can be fixed by using '' (as in your original post).
-- Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Amadeus Alfa -
Ondrej Zajicek