adding IPv6 to namespace sometimes fails with, RTNETLINK answers: File exists

27 views
Skip to first unread message

Haklat haklat

unread,
May 7, 2024, 3:56:47 AMMay 7
to TRex Traffic Generator
Hi,
when I am adding node and setting IPv6 to the node this sometimes fails with:

RTNETLINK answers: File exists for the adding of default route.

I suspect this is due to how the default IPv6 route is added and the fact that I have some routers in the environment sending periodic RA messages.

What I think happens is that if RA comes in before set_IPv6 happens there is already a default route from RA in the namespace, causing adding new default failure (results in script breaking out with the file exist message).

Below is what it looks like in my environment after some time when successfully created. You can see two default RA routes with the one, I guess,  created by NSCmds set_ipv6:

[root@trex-dp8-dpm-3 v3.04]# ip -6 r show
fd00:1:2001::194 dev trex-a-0-2-L proto kernel metric 256 pref medium
fd00:1:2001::/64 dev trex-a-0-2-L proto kernel metric 256 expires 2591984sec pref medium
fe80::/64 dev trex-a-0-2-L proto kernel metric 256 pref medium
default via fe80::8a7e:25ff:fed4:1b0b dev trex-a-0-2-L proto ra metric 1024 expires 1728sec hoplimit 64 pref medium
default via fe80::8a7e:25ff:fed4:a0b dev trex-a-0-2-L proto ra metric 1024 expires 1784sec hoplimit 64 pref medium
default dev trex-a-0-2-L metric 1024 pref medium

Not sure were you do this namespace config in the code, but I guess you use something like:

ip -6 route add ...

If you use ip -6 route append instead I think it would work even if RA default is there already.



BR//Håkan 


Haklat haklat

unread,
May 7, 2024, 7:01:00 AMMay 7
to TRex Traffic Generator
Here is printout when it happens:

[u'Could not set interface as default route\nCmd: ip netns exec trex-a-0-9a ip -6 route add default dev trex-a-0-9a-L\nOutput: RTNETLINK answers: File exists\n\n']

BR//Håkan

hanoh haim

unread,
May 7, 2024, 9:01:40 AMMay 7
to Haklat haklat, TRex Traffic Generator

--
You received this message because you are subscribed to the Google Groups "TRex Traffic Generator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trex-tgn+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trex-tgn/89fa2e87-a307-422a-9684-3db34858ed77n%40googlegroups.com.


--
Hanoh
Sent from my iPhone

Haklat haklat

unread,
May 7, 2024, 9:48:36 AMMay 7
to TRex Traffic Generator
HI,
yes thank you, found it.

I think  replacing:

src/stx/common/trex_stack_linux_based.cpp:        run_in_ns("ip -6 route add default dev " + m_if_name + "-L", "Could not set interface as default route");

with:

src/stx/common/trex_stack_linux_based.cpp:        run_in_ns("ip -6 route replace default dev " + m_if_name + "-L", "Could not set interface as default route");

is better option. It will add route if none exist and it will overwrite first existing one (in by case the one learnt from RA message).

Thanks//Håkan
Reply all
Reply to author
Forward
0 new messages