On Wed, Jan 08, 2020 at 08:45:50AM +0100, Claudio Jeker wrote:
> rt_ifa_add() and rt_ifa_del() have a major confusion when it comes to
> rtlabelid (as in labels on a route) vs rtableid (as in routing table id).
> Because of this 'ifconfig <if> rtlabel XYZ' fails to add route labels to
> the routing table.
> The following diff fixes this issue.
It looks more complicated:  Changes to the route label get through, but
won't show up in route(8) unless the interface is changed, for example
it's address.

> To test:
> ifconfig tap1001 rtlabel TEST
> ifconfig tap1001 192.0.2.6/24
> route -n get 192.0.2.1

        # ifconfig tap1001 rtlabel TEST
        # ifconfig tap1001 192.0.2.6/24
        # route -n get 192.0.2.1
           route to: 192.0.2.1
        destination: 192.0.2.0
               mask: 255.255.255.0
          interface: tap1001
         if address: 192.0.2.6
           priority: 4 (connected)
              flags: <DONE,CLONING,CONNECTED>
              label: TEST
             use       mtu    expire
               0         0         0 
        sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA,LABEL>

The label got added for me.  Change the label and it won't be seen:

        # ifconfig tap1001 rtlabel FOO
        # route -n get 192.0.2.1 | grep label
              label: FOO

Change the address and the new label appears:

        # ifconfig tap1001 192.1.2.6/24
        # route -n get 192.1.2.1 | grep label
              label: FOO

Same with removal:

        # ifconfig tap1001 -rtlabel          
        # route -n get 192.1.2.1 | grep label
              label: FOO
        #  ifconfig tap1001 192.2.2.6/24      
        #  route -n get 192.2.2.1 | grep label ; echo $?
        0

Reply via email to