summaryrefslogtreecommitdiff
path: root/zebra/zebra_dplane.c
AgeCommit message (Collapse)Author
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_cancelXXX to event_cancelXXXDonald Sharp
Modify the code base so that thread_cancel becomes event_cancel Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-13zebra: add VNI info to flood entryStephen Worley
When we are installing the flood entry for a vtep in SVD, ensure VNI is set on the ctx object so that it gets sent to the kernel and set appropriately with src_vni. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13zebra: single vxlan device dataplace vni update changesSharath Ramamurthy
dplane_mac_info and dplane_neigh_info is modified to be vni aware. dplane_rem_mac_add/del dplane_mac_init is modified to be vni aware. During dplane context update (mac and neigh), we use the vni information and if set, corresponding netlink attribute NDA_SRC_VNI is set and passed to the dplane. Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-25zebra: fix SA warning, don't lock plugin listMark Stapp
Locking around the list of providers/plugins is not helpful - these only change at init time. Clear some SA warnings by removing the locking. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-01-23zebra: use typesafe lib lists in zebra dplaneMark Stapp
Replace some of the old queue/DLIST macros with typesafe dlists. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-01-11zebra: cosmetic changes for debuganlan_cs
Just remove redundant white spaces in debug information. Before: ``` 2023/01/11 05:04:48 ZEBRA: [W8V7C-6W4DS] init neigh ctx NEIGH_INSTALL: ifp vlan100, mac 9a:68:e9:73:74:88, ip 88.88.88.88 2023/01/11 05:04:48 ZEBRA: [NH6N7-54CD1] Tx RTM_NEWNEIGH family ipv4 IF vlan100(8) Neigh 88.88.88.88 MAC 9a:68:e9:73:74:88 flags 0x10 state 0x40 ext_flags 0x0 ``` After: ``` 2023/01/11 05:17:26 ZEBRA: [W8V7C-6W4DS] init neigh ctx NEIGH_INSTALL: ifp vlan100, mac 9a:68:e9:73:74:88, ip 88.88.88.88 2023/01/11 05:17:26 ZEBRA: [NH6N7-54CD1] Tx RTM_NEWNEIGH family ipv4 IF vlan100(8) Neigh 88.88.88.88 MAC 9a:68:e9:73:74:88 flags 0x10 state 0x40 ext_flags 0x0 ``` Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-12-13zebra: Read from the dplane_fpm_nl a route updateDonald Sharp
Read from the fpm dplane a route update that will include status about whether or not the asic was successfull in offloading the route. Have this data passed up to zebra for processing and disseminate this data as appropriate. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12zebra: Add ctx to netlink message parsingDonald Sharp
Add the initial step of passing in a dplane context to reading route netlink messages. This code will be run in two contexts: a) The normal pthread for reading netlink messages from the kernel b) The dplane_fpm_nl pthread. The goal of this commit is too just allow a) to work b) will be filled in in the future. Effectively everything should still be working as it should pre this change. We will just possibly allow the passing of the context around( but not used ) Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12zebra: Rearrange dplane_ctx_route_initDonald Sharp
In order for a future commit to abstract the dplane_ctx_route_init so that the kernel can use it, let's move some stuff around and add a dplane_ctx_route_init_basic that can be used by multiple different paths Signed-off-by: Donald Sharp <sharpd@nvidia.com> create a dplane_ctx_route_init_basic so it can be used Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12zebra: Add dplane_ctx_get|set_flagsDonald Sharp
Zebra needs the ability to pass this data around. Add it to the dplanes ability to pass. Signed-off-by: Donald Sharp <sharpd@nvidia.com> zebra: Add a dplane_ctx_set_flags The dplane_ctx_set_flags call is missing, we will need it. Add it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-12zebra: Remove goto's that do not do anything specialDonald Sharp
If we have this semantics: int ret = FAILURE; if (foo) goto done; .... done: return ret; This pattern does us no favors and makes it harder to figure out what is going on. Let's remove. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09zebra: Actually free all memory associated ctx->u.iptable.interface_name_listDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-22zebra: traffic control state managementSiger Yang
This allows Zebra to manage QDISC, TCLASS, TFILTER in kernel and do cleaning jobs when it starts up. Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-19Merge pull request #11832 from sigeryang/masterQuentin Young
zebra: trim unused tc dplane result values
2022-08-18zebra: trim unused tc dplane result valuesSiger Yang
Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-17Merge pull request #11824 from sigeryang/masterDonald Sharp
zebra: fix deadcodes in tc dplane & netlink
2022-08-17zebra: use default NS directly in tc dplaneSiger Yang
Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-16Merge pull request #11694 from sigeryang/masterStephen Worley
zebra: add basic traffic control API
2022-08-15zebra: Remove unused assignment in zebra_dplane.cDonald Sharp
Coverity spotted 3 places where `int ret = XXX` was being used and FRR was immediately assigning a different value. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-11zebra: add tc netlink and dplane opsSiger Yang
This commit implements necessary netlink encoders for traffic control including QDISC, TCLASS and TFILTER, and adds basic dplane operations. Co-authored-by: Stephen Worley <sworley@nvidia.com> Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-08-08zebra: Add a `mpls enable` interface node commandDonald Sharp
Allow individual interfaces to turn on/off the mpls subsystem for it in linux. sharpd@eva:~/frr9$ sudo sysctl -a | grep enp39s0 | grep mpls net.mpls.conf.enp39s0.input = 0 sharpd@eva:~/frr9$ vtysh -c "conf" -c "int enp39s0" -c "mpls enable" sharpd@eva:~/frr9$ sudo sysctl -a | grep enp39s0 | grep mpls net.mpls.conf.enp39s0.input = 1 sharpd@eva:~/frr9$ vtysh -c "conf" -c "int enp39s0" -c "no mpls enable" sharpd@eva:~/frr9$ sudo sysctl -a | grep enp39s0 | grep mpls net.mpls.conf.enp39s0.input = 0 sharpd@eva:~/frr9$ Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21zebra: Convert thread_cancel to THREAD_OFFDonald Sharp
Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-27zebra: pass PBR expanded actions to the dataplaneAnuradha Karuppiah
These attributes are needed for dpdk dataplane programming Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2022-06-23zebra: Add interface sysctl ignore on linkdown statusDonald Sharp
Add the ability to decode the ignore on linkdown nexthop status for an interface. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-23zebra: Fix bug in netconf handling where dplane would drop the changeDonald Sharp
When reading a on the fly change of an interested netconf netlink message. The ifindex and ns_id for the context was being set for the sub structure but not for the main context data structure and zebra_if_dplane_result was dropping the result on the floor because it was expecting the ns_id and the interface id to be in a different spot. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-10lib, zebra, bgpd: Move route EVPN flag to nexthopXiao Liang
Multipath route may have mixed nexthops of EVPN and IP unicast. Move EVPN flag to nexthop to support such cases. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
2022-05-25zebra: avoid pbr iptable added twice when used with flowspecPhilippe Guibert
The usage of zebra dplane makes the job asyncronous which implies that a given job will try to add an iptable, while the second job will not know that its iptable is the same as the former one. The below exabgp rules stand for two bgp flowspec rules sent to the bgp device: flow { route {match { source 185.228.172.73/32; destination 0.0.0.0/0; source-port >=49156&<=49159; }then {redirect 213.242.114.113;}} route {match { source 185.228.172.73/32; destination 0.0.0.0/0; source-port >=49160&<=49163; }then {redirect 213.242.114.113;}} } This rule creates a single iptable, but in fact, the same iptable name is appended twice. This results in duplicated entries in the iptables context. This also results in contexts not flushed, when BGP session or 'flush' operation is performed. iptables-save: [..] -A PREROUTING -m set --match-set match0x55baf4c25cb0 src,src -g match0x55baf4c25cb0 -A PREROUTING -m set --match-set match0x55baf4c25cb0 src,src -g match0x55baf4c25cb0 -A match0x55baf4c25cb0 -j MARK --set-xmark 0x100/0xffffffff -A match0x55baf4c25cb0 -j ACCEPT -A match0x55baf4c25cb0 -j MARK --set-xmark 0x100/0xffffffff -A match0x55baf4c25cb0 -j ACCEPT [..] This commit addresses this issue, by checking that an iptable context is not already being processed. A flag is added in the original iptable context, and a check is done if the iptable context is not already being processed for install or uinstall. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-04-19*: Fix spelling of intefaceDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-09zebra: avoid initialization in ctx_intf_initStephen Worley
Avoid initialization in dplane_ctx_intf_init() so the compiler can warn us about using unintialized data. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-03-09zebra: only clear pd_reason on shutdown/sweepStephen Worley
Only clear protodown reason on shutdown/sweep, retain protodown state. This is to retain traditional and expected behavior with daemons like vrrpd setting protodown. They expet it to be set on shutdown and retained on bring up to prevent traffic from being dropped. We must cleanup our reason code though to prevent us from blocking others. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-03-09zebra: use a macro for check protodownStephen Worley
Add a helper macro for checking if interface is protodown, typing this out is annoying. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-03-09zebra: add enum set/unset states for queingStephen Worley
Add enums for set/unset of prodown state to handle the mainthread knowing an update is already queued without actually marking it as complete. This is to make the logic confirm a bit more with other parts of the code where we queue dplane updates and not update our internal structs until success callback is received. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-03-09zebra: add support for protodown reason codeStephen Worley
Add support for setting the protodown reason code. https://github.com/torvalds/linux/commit/829eb208e80d6db95c0201cb8fa00c2f9ad87faf These patches handle all our netlink code for setting the reason. For protodown reason we only set `frr` as the reason externally but internally we have more descriptive reasoning available via `show interface IFNAME`. The kernel only provides a bitwidth of 32 that all userspace programs have to share so this makes the most sense. Since this is new functionality, it needs to be added to the dplane pthread instead. So these patches, also move the protodown setting we were doing before into the dplane pthread. For this, we abstract it a bit more to make it a general interface LINK update dplane API. This API can be expanded to support gernal link creation/updating when/if someone ever adds that code. We also move a more common entrypoint for evpn-mh and from zapi clients like vrrpd. They both call common code now to set our internal flags for protodown and protodown reason. Also add debugging code for dumping netlink packets with protodown/protodown_reason. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-02-25zebra: use dataplane to read interface NETCONF infoMark Stapp
Use the dataplane to query and read interface NETCONF data; add netconf-oriented data to the dplane context object, and add accessors for it. Add handler for incoming update processing. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-02-25zebra: add dplane type for NETCONF dataMark Stapp
Add a new dplane op for interface NETCONF data; add the new enum value to several switch statements. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-10Merge pull request #10537 from mjstapp/fix_dplane_strdupRafael Zalamena
zebra: use frr mem apis in dplane
2022-02-08zebra: Make netlink buffer reads resizeable when neededDonald Sharp
Currently when the kernel sends netlink messages to FRR the buffers to receive this data is of fixed length. The kernel, with certain configurations, will send netlink messages that are larger than this fixed length. This leads to situations where, on startup, zebra gets really confused about the state of the kernel. Effectively the current algorithm is this: read up to buffer in size while (data to parse) get netlink message header, look at size parse if you can The problem is that there is a 32k buffer we read. We get the first message that is say 1k in size, subtract that 1k to 31k left to parse. We then get the next header and notice that the length of the message is 33k. Which is obviously larger than what we read in. FRR has no recover mechanism nor is there a way to know, a priori, what the maximum size the kernel will send us. Modify FRR to look at the kernel message and see if the buffer is large enough, if not, make it large enough to read in the message. This code has to be per netlink socket because of the usage of pthreads. So add to `struct nlsock` the buffer and current buffer length. Growing it as necessary. Fixes: #10404 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-08zebra: Remove `struct nlsock` from dataplane information and use `int fd`Donald Sharp
Store the fd that corresponds to the appropriate `struct nlsock` and pass that around in the dplane context instead of the pointer to the nlsock. Modify the kernel_netlink.c code to store in a hash the `struct nlsock` with the socket fd as the key. Why do this? The dataplane context is used to pass around the `struct nlsock` but the zebra code has a bug where the received buffer for kernel netlink messages from the kernel is not big enough. So we need to dynamically grow the receive buffer per socket, instead of having a non-dynamic buffer that we read into. By passing around the fd we can look up the `struct nlsock` that will soon have the associated buffer and not have to worry about `const` issues that will arise. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-08zebra: use frr mem apisMark Stapp
Replace a couple of strdup/free with XSTRDUP/XFREE. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-02-04zebra: Fix v6 route replace failure turned into successDonald Sharp
Currently when we have a route replace operation for v6 routes with a new nexthop group the order of kernel installation is this: a) New nexthop group insertion seq 1 b) Route delete operation seq 3 c) Route insertion operation seq 2 Currently the code in nl_batch_read_resp is attempting to handle this situation by skipping the delete operation. *BUT* it is enqueuing the context into the zebra dplane queue before we read the response. Since we create the ctx with an implied success, success is being reported to the upper level dplane and the zebra rib thinks the route has been properly handled. This is showing up in the zebra_seg6_route test code because the test code is installing a seg6 route w/ sharpd and it is failing to install because the route's nexthop is rejected: First installation: 2021/10/29 09:28:10.218 ZEBRA: [JGWSB-SMNVE] dplane: incoming new work counter: 2 2021/10/29 09:28:10.218 ZEBRA: [Q52A7-211QJ] dplane enqueues 2 new work to provider 'Kernel' 2021/10/29 09:28:10.218 ZEBRA: [JVY1P-93VFY] dplane provider 'Kernel': processing 2021/10/29 09:28:10.218 ZEBRA: [TX9N0-9JKDF] ID (9) Dplane nexthop update ctx 0x56125390a820 op NH_INSTALL 2021/10/29 09:28:10.218 ZEBRA: [PM9ZJ-07RCP] 0:1::1/128 Dplane route update ctx 0x56125390add0 op ROUTE_INSTALL 2021/10/29 09:28:10.218 ZEBRA: [TJ327-ET8HE] netlink_send_msg: >> netlink message dump [sent] 2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=104 type=(104) NEWNEXTHOP flags=(0x0501) {REQUEST,DUMP,(ROOT|REPLACE|CAPPED),(ATOMIC|CREATE)} seq=9 pid=3539131282] 2021/10/29 09:28:10.218 ZEBRA: [WCX94-SW894] nhm [family=(10) AF_INET6 scope=(0) UNIVERSE protocol=(11) ZEBRA flags=0x00000000 {}] 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(1) ID] 2021/10/29 09:28:10.218 ZEBRA: [Z4E9C-GD9EP] 9 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=20 (payload=16) type=(6) GATEWAY] 2021/10/29 09:28:10.218 ZEBRA: [STTSM-27M81] 2001::1 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(5) OIF] 2021/10/29 09:28:10.218 ZEBRA: [JR4EA-BKPTA] 6 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=6 (payload=2) type=(7) ENCAP_TYPE] 2021/10/29 09:28:10.218 ZEBRA: [JR4EA-BKPTA] 5 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=36 (payload=32) type=(32776) UNKNOWN] 2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=64 type=(24) NEWROUTE flags=(0x0401) {REQUEST,(ATOMIC|CREATE)} seq=10 pid=3539131282] 2021/10/29 09:28:10.218 ZEBRA: [GCEGC-W8YBF] rtmsg [family=(10) AF_INET6 dstlen=128 srclen=0 tos=0 table=254 protocol=(194) UNKNOWN scope=(0) UNIVERSE type=(1) UNICAST flags=0x0000 {}] 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=20 (payload=16) type=(1) DST] 2021/10/29 09:28:10.218 ZEBRA: [STTSM-27M81] 1::1 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(6) PRIORITY] 2021/10/29 09:28:10.218 ZEBRA: [Z4E9C-GD9EP] 20 2021/10/29 09:28:10.218 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(30) NH_ID] 2021/10/29 09:28:10.218 ZEBRA: [Z4E9C-GD9EP] 9 2021/10/29 09:28:10.218 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv] 2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=76 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=9 pid=3539131282] 2021/10/29 09:28:10.218 ZEBRA: [KWP1C-6CSXF] nlmsgerr [error=(-22) Invalid argument] 2021/10/29 09:28:10.218 ZEBRA: [HSYZM-HV7HF] Extended Error: Gateway can not be a local address 2021/10/29 09:28:10.218 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWNEXTHOP(104), seq=9, pid=3539131282 2021/10/29 09:28:10.218 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv] 2021/10/29 09:28:10.218 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=68 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=10 pid=3539131282] 2021/10/29 09:28:10.218 ZEBRA: [KWP1C-6CSXF] nlmsgerr [error=(-22) Invalid argument] 2021/10/29 09:28:10.218 ZEBRA: [HSYZM-HV7HF] Extended Error: Nexthop id does not exist 2021/10/29 09:28:10.218 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWROUTE(24), seq=10, pid=3539131282 2021/10/29 09:28:10.218 ZEBRA: [VCDW6-A7ZF1] dplane dequeues 2 completed work from provider Kernel 2021/10/29 09:28:10.218 ZEBRA: [JTWAB-1MH4Y] dplane has 2 completed, 0 errors, for zebra main 2021/10/29 09:28:10.218 ZEBRA: [J7K9Z-9M7DT] Nexthop dplane ctx 0x56125390a820, op NH_INSTALL, nexthop ID (9), result FAILURE 2021/10/29 09:28:10.218 ZEBRA: [P2XBZ-RAFQ5][EC 4043309074] Failed to install Nexthop ID (9) into the kernel 2021/10/29 09:28:10.218 ZEBRA: [RMK34-61HV5] default(0:254):1::1/128 Processing dplane result ctx 0x56125390add0, op ROUTE_INSTALL result FAILURE Note the last line `op ROUTE_INSTALL result FAILURE` because we are attempting to use a a gw nexthop that is local. This is the result. Then the test code was installing the route again: 2021/10/29 09:30:00.493 ZEBRA: [JGWSB-SMNVE] dplane: incoming new work counter: 2 2021/10/29 09:30:00.493 ZEBRA: [Q52A7-211QJ] dplane enqueues 2 new work to provider 'Kernel' 2021/10/29 09:30:00.493 ZEBRA: [JVY1P-93VFY] dplane provider 'Kernel': processing 2021/10/29 09:30:00.493 ZEBRA: [TX9N0-9JKDF] ID (9) Dplane nexthop update ctx 0x561253916a00 op NH_INSTALL 2021/10/29 09:30:00.493 ZEBRA: [PM9ZJ-07RCP] 0:1::1/128 Dplane route update ctx 0x561253915f40 op ROUTE_UPDATE 2021/10/29 09:30:00.493 ZEBRA: [TJ327-ET8HE] netlink_send_msg: >> netlink message dump [sent] 2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=104 type=(104) NEWNEXTHOP flags=(0x0501) {REQUEST,DUMP,(ROOT|REPLACE|CAPPED),(ATOMIC|CREATE)} seq=11 pid=3539131282] 2021/10/29 09:30:00.493 ZEBRA: [WCX94-SW894] nhm [family=(10) AF_INET6 scope=(0) UNIVERSE protocol=(11) ZEBRA flags=0x00000000 {}] 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(1) ID] 2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP] 9 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=20 (payload=16) type=(6) GATEWAY] 2021/10/29 09:30:00.493 ZEBRA: [STTSM-27M81] 2001::1 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(5) OIF] 2021/10/29 09:30:00.493 ZEBRA: [JR4EA-BKPTA] 6 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=6 (payload=2) type=(7) ENCAP_TYPE] 2021/10/29 09:30:00.493 ZEBRA: [JR4EA-BKPTA] 5 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=36 (payload=32) type=(32776) UNKNOWN] 2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=56 type=(25) DELROUTE flags=(0x0401) {REQUEST,(ATOMIC|CREATE)} seq=13 pid=3539131282] 2021/10/29 09:30:00.493 ZEBRA: [GCEGC-W8YBF] rtmsg [family=(10) AF_INET6 dstlen=128 srclen=0 tos=0 table=254 protocol=(194) UNKNOWN scope=(0) UNIVERSE type=(0) UNSPEC flags=0x0000 {}] 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=20 (payload=16) type=(1) DST] 2021/10/29 09:30:00.493 ZEBRA: [STTSM-27M81] 1::1 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(6) PRIORITY] 2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP] 20 2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=64 type=(24) NEWROUTE flags=(0x0401) {REQUEST,(ATOMIC|CREATE)} seq=12 pid=3539131282] 2021/10/29 09:30:00.493 ZEBRA: [GCEGC-W8YBF] rtmsg [family=(10) AF_INET6 dstlen=128 srclen=0 tos=0 table=254 protocol=(194) UNKNOWN scope=(0) UNIVERSE type=(1) UNICAST flags=0x0000 {}] 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=20 (payload=16) type=(1) DST] 2021/10/29 09:30:00.493 ZEBRA: [STTSM-27M81] 1::1 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(6) PRIORITY] 2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP] 20 2021/10/29 09:30:00.493 ZEBRA: [KFBSR-XYJV1] rta [len=8 (payload=4) type=(30) NH_ID] 2021/10/29 09:30:00.493 ZEBRA: [Z4E9C-GD9EP] 9 2021/10/29 09:30:00.493 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv] 2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=76 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=11 pid=3539131282] 2021/10/29 09:30:00.493 ZEBRA: [KWP1C-6CSXF] nlmsgerr [error=(-22) Invalid argument] 2021/10/29 09:30:00.493 ZEBRA: [HSYZM-HV7HF] Extended Error: Gateway can not be a local address 2021/10/29 09:30:00.493 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: Invalid argument, type=RTM_NEWNEXTHOP(104), seq=11, pid=3539131282 2021/10/29 09:30:00.493 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv] 2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=36 type=(2) ERROR flags=(0x0100) {DUMP,(ROOT|REPLACE|CAPPED)} seq=13 pid=3539131282] 2021/10/29 09:30:00.493 ZEBRA: [KWP1C-6CSXF] nlmsgerr [error=(-3) No such process] 2021/10/29 09:30:00.493 ZEBRA: [V8KNF-8EXH8] netlink_recv_msg: << netlink message dump [recv] 2021/10/29 09:30:00.493 ZEBRA: [JAS4D-NCWGP] nlmsghdr [len=68 type=(2) ERROR flags=(0x0300) {DUMP,(ROOT|REPLACE|CAPPED),(MATCH|EXCLUDE|ACK_TLVS)} seq=12 pid=3539131282] 2021/10/29 09:30:00.493 ZEBRA: [KWP1C-6CSXF] nlmsgerr [error=(-22) Invalid argument] 2021/10/29 09:30:00.493 ZEBRA: [VCDW6-A7ZF1] dplane dequeues 2 completed work from provider Kernel 2021/10/29 09:30:00.493 ZEBRA: [JTWAB-1MH4Y] dplane has 2 completed, 0 errors, for zebra main 2021/10/29 09:30:00.493 ZEBRA: [J7K9Z-9M7DT] Nexthop dplane ctx 0x561253916a00, op NH_INSTALL, nexthop ID (9), result FAILURE 2021/10/29 09:30:00.493 ZEBRA: [P2XBZ-RAFQ5][EC 4043309074] Failed to install Nexthop ID (9) into the kernel 2021/10/29 09:30:00.493 ZEBRA: [RMK34-61HV5] default(0:254):1::1/128 Processing dplane result ctx 0x561253915f40, op ROUTE_UPDATE result SUCCESS Note that this time we do these three operations a) nexthop installation seq 11 b) route delete seq 13 c) route add seq 12 Note the last line, we report the install as a success but it clearly failed from the seq=12 decode. When we look at the v6 rib it thinks it is installed: unet> r1 show ipv6 route Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure D>* 1::1/128 [150/0] via 2001::1, dum0, seg6local unspec unknown(seg6local_context2str), seg6 a::, weight 1, 00:00:17 So let's modify nl_batch_read_resp to not dequeue/enqueue the context until we are sure we have the right one. This fixes the test code to do the right thing on the second installation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-04zebra: set zd_is_update in 1 spotDonald Sharp
The ctx->zd_is_update is being set in various spots based upon the same value that we are passing into dplane_ctx_ns_init. Let's just consolidate all this into the dplane_ctx_ns_init so that the zd_is_udpate value is set at the same time that we increment the sequence numbers to use. As a note for future me's reading this. The sequence number choosen for the seq number passed to the kernel is that each context gets a copy of the appropriate nlsock to use. Since it's a copy at a point in time, we know we have a unique sequence number value. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-23zebra: add installed nexthop-group id valueMark Stapp
In some cases, zebra may install a nexthop-group id that is different from the id of the nhe struct attached to a route-entry. This happens for a singleton recursive nexthop, for example, where a route is installed with the resolving nexthop's id. The installed value is the most useful value - that corresponds to information in the kernel on linux/netlink platforms that support nhgs. Display both values if they differ in ascii output, and include both values in the json form. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-11-22*: cleanup ifp->vrf_idIgor Ryzhov
Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-17zebra: return void for dplane_ctx_get_pbr_ipset_entryDonald Sharp
The dplane_ctx_get_pbr_ipset_entry function only failed when the caller did not pass in a valid usable pointer. Change the code to assert on a pointer not being passed in and remove the bool return Signed-off-by: Donald Sharp <sharpd@nvidia.com>