Commit graph

269 commits

Author SHA1 Message Date
Gabriel Goller 80e96712e4 zebra: add ZEBRA_IF_DUMMY flag for dummy interfaces
Introduce ZEBRA_IF_DUMMY interface flag to identify Linux dummy interfaces [0].
These interfaces behave similarly to loopback interfaces and can be
specially handled by daemons.

[0]: https://github.com/torvalds/linux/blob/master/drivers/net/dummy.c

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2025-02-25 10:13:34 +01:00
Mark Stapp 2c5c679e93 zebra: use new per-NS interface iteration
Replace use of the old if_table with the new per-NS ifp
iteration apis.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-10-28 14:54:06 -04:00
Mark Stapp 6c1bc51bbb
Merge pull request #16737 from raja-rajasekar/rajasekarr/vlan_to_dplane
zebra: vlan to dplane
2024-10-15 08:06:34 -04:00
Donna Sharp 7a63799a84 zebra: remove unused function from if_netlink.c
Signed-off-by: Donna Sharp <dksharp5@gmail.com>
2024-10-06 19:25:44 -04:00
Rajasekar Raja aa4786642c zebra: vlan to dplane Offload from main
Trigger: Zebra core seen when we convert l2vni to l3vni and back

BackTrace:
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(_zlog_assert_failed+0xe9) [0x7f4af96989d9]
/usr/lib/frr/zebra(zebra_vxlan_if_vni_up+0x250) [0x5561022ae030]
/usr/lib/frr/zebra(netlink_vlan_change+0x2f4) [0x5561021fd354]
/usr/lib/frr/zebra(netlink_parse_info+0xff) [0x55610220d37f]
/usr/lib/frr/zebra(+0xc264a) [0x55610220d64a]
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(thread_call+0x7d) [0x7f4af967e96d]
/usr/lib/x86_64-linux-gnu/frr/libfrr.so.0(frr_run+0xe8) [0x7f4af9637588]
/usr/lib/frr/zebra(main+0x402) [0x5561021f4d32]
/lib/x86_64-linux-gnu/libc.so.6(+0x2724a) [0x7f4af932624a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f4af9326305]
/usr/lib/frr/zebra(_start+0x21) [0x5561021f72f1]

Root Cause:
In working case,
 - We get a RTM_NEWLINK whose ctx is enqueued by zebra dplane and
   dequeued by zebra main and processed i.e.
   (102000 is deleted from vxlan99) before we handle RTM_NEWVLAN.
 - So in handling of NEWVLAN (vxlan99) we bail out since find with
   vlan id 703 does not exist.

root@leaf2:mgmt:/var/log/frr# cat ~/raja_logs/working/nocras.log  | grep "RTM_NEWLINK\|QUEUED\|vxlan99\|in thread"
2024/07/18 23:09:33.741105 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=616, seq=0, pid=0
2024/07/18 23:09:33.744061 ZEBRA: [K8FXY-V65ZJ] Intf dplane ctx 0x7f2244000cf0, op INTF_INSTALL, ifindex (65), result QUEUED
2024/07/18 23:09:33.767240 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=508, seq=0, pid=0
2024/07/18 23:09:33.767380 ZEBRA: [K8FXY-V65ZJ] Intf dplane ctx 0x7f2244000cf0, op INTF_INSTALL, ifindex (73), result QUEUED
2024/07/18 23:09:33.767389 ZEBRA: [NVFT0-HS1EX] INTF_INSTALL for vxlan99(73)
2024/07/18 23:09:33.767404 ZEBRA: [TQR2A-H2RFY] Vlan-Vni(1186:1186-6000002:6000002) update for VxLAN IF vxlan99(73)
2024/07/18 23:09:33.767422 ZEBRA: [TP4VP-XZ627] Del L2-VNI 102000 intf vxlan99(73)
2024/07/18 23:09:33.767858 ZEBRA: [QYXB9-6RNNK] RTM_NEWVLAN bridge IF vxlan99 NS 0
2024/07/18 23:09:33.767866 ZEBRA: [KKZGZ-8PCDW] Cannot find VNI for VID (703) IF vxlan99 for vlan state update >>>>BAIL OUT

In failure case,
 - The NEWVLAN is received first even before processing RTM_NEWLINK.
 - Since the vxlan id 102000 is not removed from the vxlan99,
   the find with vlan id 703 returns the 102000 one and we invoke
   zebra_vxlan_if_vni_up where the interfaces don't match and assert.

root@leaf2:mgmt:/var/log/frr# cat ~/raja_logs/noworking/crash.log | grep "RTM_NEWLINK\|QUEUED\|vxlan99\|in thread"
2024/07/18 22:26:43.829370 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=616, seq=0, pid=0
2024/07/18 22:26:43.829646 ZEBRA: [K8FXY-V65ZJ] Intf dplane ctx 0x7fe07c026d30, op INTF_INSTALL, ifindex (65), result QUEUED
2024/07/18 22:26:43.853930 ZEBRA: [QYXB9-6RNNK] RTM_NEWVLAN bridge IF vxlan99 NS 0
2024/07/18 22:26:43.853949 ZEBRA: [K61WJ-XQQ3X] Intf vxlan99(73) L2-VNI 102000 is UP >>> VLAN PROCESSED BEFORE INTF EVENT
2024/07/18 22:26:43.853951 ZEBRA: [SPV50-BX2RP] RAJA zevpn_vxlanif vxlan48 and ifp vxlan99
2024/07/18 22:26:43.854005 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=508, seq=0, pid=0
2024/07/18 22:26:43.854241 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=516, seq=0, pid=0
2024/07/18 22:26:43.854251 ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-dp-in (NS 0) type RTM_NEWLINK(16), len=544, seq=0, pid=0
ZEBRA: in thread kernel_read scheduled from zebra/kernel_netlink.c:505 kernel_read()

Fix:
Similar to #13396, where link change
handling was offloaded to dplane, same is being done for vlan events.

Note: Prior to this change, zebra main thread was interested in the
RTNLGRP_BRVLAN. So all the kernel events pertaining to vlan was
handled by zebra main.

With this change change as well the handling of vlan events is still
with Zebra main. However we offload it via Dplane thread.

Ticket :#3878175

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-09-26 20:17:35 -07:00
Rajasekar Raja 1632988acf zebra: vlan to dplane, Relocating some functions
Relocating functions used by vlan in if_netlink into zebra vxlan

Note: Static variable to the functions will be added back in the next
commit.

Ticket :#3878175

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-09-25 11:56:06 -07:00
Mark Stapp c40635c5c2 zebra: unlock if_table route_nodes
Must unlock if we break during iteration over any lib/table
tree.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-09-20 12:24:01 -04:00
anlan_cs 8a02942eda zebra: clean up one comment
With the commit `605df8d4`, all real things are moved into dplane.
So the operations mentioned in this comment have nothing to do with
this function `netlink_link_change()`.

Just remove that confusing and useless comment.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-05-02 16:36:01 +08:00
Philippe Guibert 51cb6aee4b zebra: fix speed set to UINT32_MAX
get_iflink_speed() returns UINT32_MAX when the speeds is unknown.
Routing daemons (at least ospfd) interprets it as the high value.

Return errors in get_iflink_speed() to avoid the confusion.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-29 14:52:32 +01:00
Donald Sharp 466ad88ce1 zebra: Add ability to note that a address is NOPREFIXROUTE
The linux kernel can send up a flag that tells us that the
connected address is not a PREFIXROUTE.  Add the ability
to note this and pass it up from the data plane.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-06 09:27:52 -05:00
Mark Stapp bb3faf1b95 zebra: reduce number of switch statements with dplane opcodes
Replace several switch blocks that contain every dplane opcode
with simpler sets of if()s. In these cases the code only
uses a couple of opcodes.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-11-17 08:40:58 -05:00
Donald Sharp 858cc75b43
Merge pull request #14712 from yenlu-keith/teamd-es-id
zebra: supports to listen teamd nlmsg as bond type
2023-11-14 11:20:27 -05:00
yenlu 60c35a86de zebra: Support to listen teamd nlmsg as bond type
this feature is to support teamd driver when configuring
ethernet segment's id and sys_mac via vtysh/zebra.

Signed-off-by: yenlu <yenlu@cisco.com>
2023-11-09 09:23:25 -08:00
Donald Sharp 315aa6cde4 *: Remove netlink headers from lib/zebra.h
The headers associated with netlink code
really only belong in those that need it.
Move these headers out of lib/zebra.h and
into more appropriate places.  bgp's usage
of the RT_TABLE_XXX defines are probably not
appropriate and will be cleaned up in future
commits.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-07 06:46:19 -05:00
Rajasekar Raja 11b987ed2f zebra: Prevent leaking ctx memory in err condition
When netlink_link_change() errors out for a new link for
interface without MTU set, the allocated ctx is not freed..
Adding code for correctness

Ticket# 3628313

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2023-10-09 17:09:57 +00:00
Mark Stapp 7b8a4249ea lib,zebra: add tx queuelen to interface struct
Add the txqlen attribute to the common interface struct. Capture
the value in zebra, and distribute it through the interface lib
module's zapi messaging.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-09-01 10:06:10 -04:00
Donald Sharp 6349e49645 zebra: Fix crashes in interface change
Upon some internal testing some crashes were found.  This fixes
the several crashes and normalizes the code to be closer in
it's execution pre and post changes to use the data plane.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-17 09:43:06 -04:00
Donald Sharp 605df8d44f zebra: Use zebra dplane for RTM link and addr
a) Move the reads of link and address information
into the dplane
b) Move the startup read of data into the dplane
as well.
c) Break up startup reading of the linux kernel data
into multiple phases.  As that we have implied ordering
of data that must be read first and if the dplane has
taken over some data reading then we must delay initial
read-in of other data.

Fixes: #13288
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 13:03:14 -04:00
Donald Sharp a014450441 zebra: Add code to get/set interface to pass up from dplane
1) Add a bunch of get/set functions and associated data
structure in zebra_dplane to allow the setting and retrieval
of interface netlink data up into the master pthread.

2) Add a bit of code to breakup startup into stages.  This is
because FRR currently has a mix of dplane and non dplane interactions
and the code needs to be paused before continuing on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 13:03:14 -04:00
Donald Sharp 487a96a35f zebra: Remove duplicate function for netlink interface changes
Turns out FRR has 2 functions one specifically for startup
and one for normal day to day operations.  There were only
a couple of minor differences from what I could tell, and
where they were different the after startup functionality should
have been updated too.  I cannot figure out why we have 2.

Non-startup handling of bonds appears to be incorrect
so let's fix that.  Additionally the speed was not
properly being set in non-startup situations.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 13:03:14 -04:00
Donald Sharp bc0bac5524 zebra: Remove unused add variable
Function was not using the add variable.  Remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 11:49:36 -04:00
Donald Sharp c3c9683f99 zebra: Move protodown_r_bit to a better spot
Since we are moving some code handling out of the dataplane
and into zebra proper, lets move the protodown r bit as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 11:49:36 -04:00
Donald Sharp 6a3ae11c9b zebra: Rename vrf_lookup_by_tableid to zebra_vrf_lookup..
Rename the vrf_lookup_by_id function to zebra_vrf_lookup_by_id
and move to zebra_vrf.c where it nominally belongs, as that
we need zebra specific data to find this vrf_id and as such
it does not belong in vrf.c

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-05 11:49:36 -04:00
Igor Ryzhov 9ce24c31bf zebra: remove ZEBRA_IF_BOND_SLAVE interface type
It is never actually used in the code.

Closes #13532.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-05-21 23:37:39 +03:00
anlan_cs 41414503e4 zebra: Fix missing VRF flag
1. No any configuration in FRR, and `ip link add vrf1 type vrf ...`.
Currently, everything is ok.

2.  `ip link del vrf1`.
`zebra` will wrongly/redundantly notify clients to add "vrf1" as a normal
interface after correct deletion of "vrf1".

```
ZEBRA: [KMXEB-K771Y] netlink_parse_info: netlink-listen (NS 0) type RTM_DELLINK(17), len=588, seq=0, pid=0
ZEBRA: [TDJW2-B9KJW] RTM_DELLINK for vrf1(93) <- Wrongly as normal interface, not vrf
ZEBRA: [WEEJX-M4HA0] interface vrf1 vrf vrf1(93) index 93 is now inactive.
ZEBRA: [NXAHW-290AC] MESSAGE: ZEBRA_INTERFACE_DELETE vrf1 vrf vrf1(93)
ZEBRA: [H97XA-ABB3A] MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL vrf1 VRF Id 93 -> 0
ZEBRA: [HP8PZ-7D6D2] MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD vrf1 VRF Id 93 -> 0 <-
ZEBRA: [Y6R2N-EF2N4] interface vrf1 is being deleted from the system
ZEBRA: [KNFMR-AFZ53] RTM_DELLINK for VRF vrf1(93)
ZEBRA: [P0CZ5-RF5FH] VRF vrf1 id 93 is now inactive
ZEBRA: [XC3P3-1DG4D] MESSAGE: ZEBRA_VRF_DELETE vrf1
ZEBRA: [ZMS2F-6K837] VRF vrf1 id 4294967295 deleted
OSPF: [JKWE3-97M3J] Zebra: interface add vrf1 vrf default[0] index 0 flags 480 metric 0 mtu 65575 speed 0 <- Wrongly add interface
```

`if_handle_vrf_change()` moved the interface from specific vrf to default
vrf. But it doesn't skip interface of vrf type. So, the wrong/redundant
add operation is done.

Note, the wrong add operation is regarded as an normal interface because
the `ifp->status` is cleared too early, so it is without VRF flag
( `ZEBRA_INTERFACE_VRF_LOOPBACK` ). Now, ospfd will initialize `ifp->type`
to `OSPF_IFTYPE_BROADCAST`.

3. `ip link add vrf1 type vrf ...`, add "vrf1" again. FRR will be with
wrong display:

```
interface vrf1
 ip ospf network broadcast
exit
```

Here, zebra will send `ZEBRA_INTERFACE_ADD` again for "vrf1" with
correct `ifp->status`, so it will be updated into vrf type. But
it can't update `ifp->type` from `OSPF_IFTYPE_BROADCAST` to
`OSPF_IFTYPE_LOOPBACK` because it had been already configured in above
step 2.

Two changes to fix it:

1. Skip the procedure of switching VRF for interfaces of vrf type.
It means, don't send `ZEBRA_INTERFACE_ADD` to clients when deleting vrf.

2. Put the deletion of this flag at the last.
It means, clients should get correct `ifp->status`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-05-01 20:21:37 +08:00
Donald Sharp 24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00
Donald Sharp 8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
vivek f88889ba7a zebra: Add debug for bridge capability
Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>

Ticket: #2609944
2023-02-16 07:44:51 -05:00
Stephen Worley 0bbad9d19a zebra: clang-format style fixes
clang-format style fixes

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Stephen Worley 909002294f zebra: state value never used SA fix
SA caught a value that wasn't being used after set. Remove it.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Stephen Worley a26daa77cc zebra: handle STP state change for SVD per vlan ID
Read in STP state changes for a Single Vxlan Device
via bridge vlan netlink messages. Map the vlanid to a
VNI in the SVD table and treat it similar to how
we handle proto down of the Vxlan device traditionally
in a non-SVD device scenario.

Forwarding == Interface UP
Blocking == Interface DOWN

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Sharath Ramamurthy e8a392d91c zebra: fix for issues found during static analysis
This patch addresses fix for issues found during static analysis.
rt_netlink - initialise vtep if there is NDA_DST attribute
if_netlink - initialise vni_start and vni_end

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy 9464e5b865 zebra: Bug fixes in fdb read for flooded traffic and remote fdb cleanup upon vni removal
This patch addresses following issues,
- When the VLAN-VNI mapping is configured via a map and not using
  individual VXLAN interfaces, upon removal of a VNI ensure that the
  remote FDB entries are uninstalled correctly.

- When VNI configuration is performed using VLAN-VNI mapping (i.e., without
  individual VXLAN interfaces) and flooded traffic is handled via multicast,
  the multicast group corresponding to the VNI needs to be explicitly read
  from the bridge FDB. This is relevant in the case of netlink interface to
  the kernel and for the scenario where a new VNI is provisioned or comes up.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy 131a9a2eed zebra: single vxlan device vni handling
This change brings in following functionality
- netlink_bridge_vxlan_vlan_vni_map_update for single vxlan devices
  This function is responsible for reading the vlan-vni map information
  received from netlink and populating a new hash_table with the vlan-vni
  data. Once all the vlan-vni data is collected, zebra_vxlan_if_vni_table_add_update
  is called to update vni_table in vxlan interface and process each of the
  vlan-vni data.
- refactoring changes for zevpn_build_hash_table
- existing zevpn_build_hash_table was walking over all the vxlan interfaces
  and then processing the vni for each of them. In case of single vxlan device,
  we will have more than one vni entries. This function is abstracted so that
  it iterates over all the vni entries for single vxlan device. For traditional
  vxlan device the zebra_vxlan_if_vni_iterate would only process single vni
  associated with that device.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy 784d88aa14 zebra: multiple vlan aware bridge datastructure changes and vxlan device iftype derivation from netlink
This change set introduces data structure changes required for multiple vlan aware bridge
functionality. A new structure zebra_l2_bridge_if encapsulates the vlan to access_bd
association of the bridge. A vlan_table hash_table is used to record each instance
of the vlan to access_bd of the bridge via zebra_l2_bridge_vlan structure.

vxlan iftype derivation: netlink attribute IFLA_VXLAN_COLLECT_METADATA is used
to derive the iftype of the vxlan device. If the attribute is present, then the
vxlan interface is treated as single vxlan device, otherwise it would default to
traditional vxlan device.

zebra_vxlan_check_readd_vtep, zebra_vxlan_dp_network_mac_add/del is modified to
be vni aware.

mac_fdb_read_for_bridge - is modified to be (vlan, bridge) aware

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy 8d30ff3b5e zebra: data structure changes for single vxlan device
This changeset introduces the data structure changes needed for
single vxlan device functionality. A new struct zebra_vxlan_vni_info
encodes the iftype and vni information for vxlan device.

The change addresses related access changes of the new data structure
fields from different files

zebra_vty is modified to take care of the vni dump information according
to the new vni data structure for vxlan devices.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Donald Sharp a98701f053 zebra: Add missing enums to switch statements
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-31 15:15:42 -05:00
Mark Stapp c0ce4875ff zebra: use real MTYPEs for various objects
Don't use MTYPE_TMP for many things in zebra: add specific
mem types.

Signed-off-by: Mark Stapp <mjs@labn.net>
2022-12-05 10:55:35 -05:00
Donald Sharp 451165eb57 zebra: Allow tunneldump data to work properly on non-supported kernels
When zebra requests tunnel data it is sending a RTM_GETTUNNEL per
interface that is a VXLAN tunnel.  If the kernel that is being
used does not support the particular request type then zebra
will get a error message per tunnel request back.  Unfortunately
netlink_parse_info *stops* reading on the first error message.
Therefor one kernels that are returning an error message
let's gather all of those errors.  This will allow things
like route reads to actually work properly

Fixes: #12056
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-04 15:05:44 -04:00
sri-mohan1 6751c0f328 zebra: changes for code maintainability
these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2022-09-15 14:18:48 +05:30
anlan_cs d2fb26ef9f zebra: correct one comment about ethtool ioctl
`get_iflink_speed()` uses ioctl to get speed, not ip address. Additionally
adjust format for another one comment line.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-08-09 01:55:31 -04:00
Chirag Shah acc8e68720 zebra: netlink rtm tunnel msg parsing
'bridge vni add vni <id> dev <vxlan device>'
generates new RTM_NEWTUNNEL and RTM_DELTUNNEL
to add or remove vni to l3vxlan device.

Register new RTNLGRP_TUNNEL group to receive
new netlink notification.
Callback for the new RTM_xxxTUNNEL.

kernel patches:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?h=v5.18-rc7&id=7b8135f4df98b155b23754b6065c157861e268f1

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?h=v5.18-rc7&id=f9c4bb0b245cee35ef66f75bf409c9573d934cf9

Ticket:#3073812
Testing Done:

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-06-24 07:33:34 -04:00
Donald Sharp 14ed061501 zebra: Add netlink_interface_addr tracepoint
Add a tracepoint for netlink_interface_addr.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-20 09:43:47 -04:00
Donald Sharp 097ef2afd1 zebra: Add netlink_request_intf_addr tracepoint
Add a tracepoint for the netlink_request_intf_addr function.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-20 09:43:47 -04:00
Donald Sharp d42e61420a zebra: Add initial zebra tracepoint support
Add initial zebra tracepoint support infrastructure
as well as add a frr_zebra:netlink_interface
callback.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-20 09:39:47 -04:00
Donald Sharp d0438da6b0 zebra: Fix use after deletion event in freebsd
In the FreeBSD code if you delete the interface
and it has no configuration, the ifp pointer will
be deleted from the system *but* zebra continues
to dereference the just freed pointer.

==58624== Invalid read of size 1
==58624==    at 0x48539F3: strlcpy (in /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==58624==    by 0x2B0565: ifreq_set_name (ioctl.c:48)
==58624==    by 0x2B0565: if_get_flags (ioctl.c:416)
==58624==    by 0x2B2D9E: ifan_read (kernel_socket.c:455)
==58624==    by 0x2B2D9E: kernel_read (kernel_socket.c:1403)
==58624==    by 0x499F46E: thread_call (thread.c:2002)
==58624==    by 0x495D2B7: frr_run (libfrr.c:1196)
==58624==    by 0x2B40B8: main (main.c:471)
==58624==  Address 0x6baa7f0 is 64 bytes inside a block of size 432 free'd
==58624==    at 0x484ECDC: free (in /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==58624==    by 0x4953A64: if_delete (if.c:283)
==58624==    by 0x2A93C1: if_delete_update (interface.c:874)
==58624==    by 0x2B2DF3: ifan_read (kernel_socket.c:453)
==58624==    by 0x2B2DF3: kernel_read (kernel_socket.c:1403)
==58624==    by 0x499F46E: thread_call (thread.c:2002)
==58624==    by 0x495D2B7: frr_run (libfrr.c:1196)
==58624==    by 0x2B40B8: main (main.c:471)
==58624==  Block was alloc'd at
==58624==    at 0x4851381: calloc (in /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==58624==    by 0x496A022: qcalloc (memory.c:116)
==58624==    by 0x49546BC: if_new (if.c:164)
==58624==    by 0x49546BC: if_create_name (if.c:218)
==58624==    by 0x49546BC: if_get_by_name (if.c:603)
==58624==    by 0x2B1295: ifm_read (kernel_socket.c:628)
==58624==    by 0x2A7FB6: interface_list (if_sysctl.c:129)
==58624==    by 0x2E99C8: zebra_ns_enable (zebra_ns.c:127)
==58624==    by 0x2E99C8: zebra_ns_init (zebra_ns.c:214)
==58624==    by 0x2B3FF2: main (main.c:401)
==58624==

Zebra needs to pass back whether or not the ifp pointer
was freed when if_delete_update is called and it should
then check in ifan_read as well as ifm_read that the
ifp pointer is still valid for use.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-24 20:48:24 -04:00
Russ White 5d97021ba3
Merge pull request #10427 from sworleys/Protodown-Reason-Upstream
Add Support for Setting Protodown Reason Code
2022-03-15 19:58:16 -04:00
Donald Sharp 2ea93eb023
Merge pull request #10580 from leonshaw/fix/link-ns
zebra: Lookup linked interface in link netns
2022-03-15 15:23:18 -04:00