Re: can't add a /24 blackhole route with a /32 loopback

From: Alexander Chernikov <melifaro_at_FreeBSD.org>
Date: Wed, 14 Jun 2023 10:36:16 UTC

> On 14 Jun 2023, at 11:26, Benoit Chesneau <benoitc@enki-multimedia.eu> wrote:
> 
> I found an interresting log in dmesg (see below). Not sure how it can happens.
> 
> Could it be related to the usage of bird?
> 
> The log:
> 
> ```
> [rtsock] fill_blackholeinfo: PID 72835: Unable to find ifa for blackhole/reject nhop
> [rtsock] fill_blackholeinfo: PID 72837: Unable to find ifa for blackhole/reject nhop
> [rtsock] fill_blackholeinfo: PID 72838: Unable to find ifa for blackhole/reject nhop
> [rtsock] fill_blackholeinfo: PID 72847: Unable to find ifa for blackhole/reject nhop
> [rtsock] fill_blackholeinfo: PID 72854: Unable to find ifa for blackhole/reject nhop
> [rtsock] fill_blackholeinfo: PID 72860: Unable to find ifa for blackhole/reject nhop
> ```
Not sure if that’s bird (it shouldn’t be the case), but that’s the reason.
Every route requires _some_ preferred source interface address by convention, as the stack wants to see some non-NULL value.
For the blackhole routes, this source address is the first address from lo0 interface.
In your case, `lo0` doesn’t contain any IPv4 addresses (typically there should be 127.0.0.1 there).
Is there any reason for not having 127.0.0.1 ?

> 
> 
> ------- Original Message -------
> On Wednesday, June 14th, 2023 at 12:18, Benoit Chesneau <benoitc@enki-multimedia.eu> wrote:
> 
> 
>> 
>> ------- Original Message -------
>> On Wednesday, June 14th, 2023 at 11:56, Alexander Chernikov melifaro@FreeBSD.org wrote:
>> 
>>> Could you try:
>>> 1) removing the 1.1.1.0/24 route
>>> 2) removing the 1.1.1.1/32 from the lo1
>>> 3) provide the output for `route -n get 1.1.1.0/24`
>>> 4) provide the output for `route -n get 1.1.1.1/32`
>>> 5) assign 1.1.1.1/32 to lo1
>>> 6) provide the output for `route -n get 1.1.1.0/24`
>>> 7) provide the output for `route -n get 1.1.1.1/32`
>>> 8) provide the output for `route add -net 1.1.1.0/24 -blackhole`
>> 
>> 
>> Find the result below. Such thing worked on another machine, I am not sure why. No obvious logs.
>> 
>> ```
>> # route -n get 1.1.1.0/24
>> route to: 1.1.1.0
>> destination: 1.1.1.0
>> mask: 255.255.255.0
>> fib: 0
>> interface: lo1
>> flags: <UP,DONE,STATIC>
>> 
>> recvpipe sendpipe ssthresh rtt,msec mtu weight expire
>> 0 0 0 0 16384 1 0
>> # route -n get 1.1.1.1/32
>> route to: 1.1.1.1
>> destination: 1.1.1.1
>> gateway: 10.3.1.2
>> fib: 0
>> interface: vlan212
>> flags: <UP,GATEWAY,HOST,DONE,PROTO1>
>> 
>> recvpipe sendpipe ssthresh rtt,msec mtu weight expire
>> 0 0 0 0 9000 1 0
>> # route delete 1.1.1.0/24
>> delete net 1.1.1.0
>> # route -n get 1.1.1.1/32
>> route: route has not been found
>> # ifconfig lo1 inet 1.1.1.1/32
>> # route -n get 1.1.1.1/32
>> route to: 1.1.1.1
>> destination: 1.1.1.1
>> fib: 0
>> interface: lo1
>> flags: <UP,HOST,DONE,PINNED>
>> 
>> recvpipe sendpipe ssthresh rtt,msec mtu weight expire
>> 0 0 0 0 16384 1 0
>> # route add -net 1.1.1.0/24 -blackhole
>> route: writing to routing socket: Operation not supported
>> add net 1.1.1.0 fib 0: Operation not supported
>> # route -n get 1.1.1.0/24
>> route: route has not been found
>> ```