Commit Graph

648 Commits

Author SHA1 Message Date
Donald Sharp
ff23fdfb4b zebra: The dplane_fpm_nl return path leaks memory
The route entry created when using a ctx to pass route
entry data backup to the master pthread in zebra is
being leaked.  Prevent this from happening.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 7f9c5c7fa2)
2023-12-12 06:45:31 +00:00
Donald Sharp
8318d7ef30 zebra: Fix fpm multipath encap addition
The fpm code path in building a ecmp route for evpn has
a bug that caused it to not add the encap attribute to
the netlink message.  See #f0f7b285b99dbd971400d33feea007232c0bd4a9
for the single path case being fixed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 6b23ece88b)
2023-11-21 07:09:35 +00:00
Donald Sharp
1cd4ec66ca zebra: Add encap type when building packet for FPM
Currently in the single nexthop case w/ evpn sending
down via the FPM the encap type is not being set
for the nexthop.

This looks like the result of some code reorg for the
nexthop happened but the fpm failed to be accounted for.
Let's just move the encap type encoding to where it
will happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4ac659fcbe)
2023-10-31 15:13:36 +00:00
Dmytro Shytyi
f20cf1457d bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthop
Append zebra and lib to use muliple SRv6 segs SIDs, and keep one
seg SID for bgpd and sharpd.

Note: bgpd and sharpd compilation relies on the lib and zebra files,
i.e if we separate this: lib or zebra or bgpd or sharpd in different
commits - this will not compile.

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-09-20 15:07:15 +02:00
Russ White
986dfa5e5d
Merge pull request #14348 from opensourcerouting/fpm-rr
zebra: support route replace semantic in FPM
2023-09-12 08:45:14 -04:00
Russ White
48d6039e14
Merge pull request #13724 from cscarpitta/feature/isisd-srv6-support
isisd: Add support for SRv6 uSID (RFC 9352)
2023-09-12 08:33:42 -04:00
Carmine Scarpitta
d890515194 zebra: Encode SRv6 flavors in Netlink messages
Encode SRv6 flavors information when building a seg6local nexthop.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:04 +02:00
Carmine Scarpitta
2417b4add8 zebra: Resolve default values for SRv6 flavor attr
When zebra receives a Netlink message containing a seg6local nexthop,
let's use the default values for optional attributes `lcblock_len` and
`lcnode_fn_len`, if they are not specified.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:04 +02:00
Carmine Scarpitta
c9f0452a14 zebra: Resolve default values for SRv6 flavor attr
When zebra receives a Netlink message containing a seg6local nexthop,
let's use the default values for optional attributes `lcblock_len` and
`lcnode_fn_len`, if they are not specified.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:03 +02:00
Carmine Scarpitta
f4d2d9ba0a zebra: Extend rt_netlink.c to parse SRv6 flavors
Extend the `parse_encap_seg6local` function to parse SRv6 flavors
information contained in the Netlink message.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:02 +02:00
Rafael Zalamena
6374aeab80 zebra: support route replace semantics in FPM
Set `NLM_F_REPLACE` instead of adding and removing the same route for an
update.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-09-04 15:38:03 -03:00
Martin Pels
4d96ce1b4d zebra: Make main routing table (RT_TABLE_MAIN) configurable
Signed-off-by: Martin Pels <mpels@ripe.net>
2023-08-22 15:29:07 +02: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
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
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
Donatas Abraitis
933282787c
Merge pull request #12811 from Avineus/frr_neighlog_5884
Fix for "Debugs For RFC 5549 Neighbor Creation #5884"
2023-03-01 09:59:01 +02:00
Kavitha
55da97df50 zebra: neigh update netlink log
Added debug log in netlink_neigh_update(), with
ifindex, ifname, ipaddress and mac address.

Signed-off-by: Kavitha <kavirhene@gmail.com>
2023-02-27 18:45:03 +05:30
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
sharathr
e41db24056 zebra: Fix for mcast-group update and delete per vni for svd
Ticket: 2698649
Testing Done: precommit and evpn-min

Problem:
When the mcast-group is updated, the changes were being read from the netlink
and populated by zebra, but when kernel sends the delete of fdb delete for the
group, we are deleting the mcast-group that we newly updated. This is because,
currently we blindly reset the mcast-group during fdb delete without checking
for mcast-group associated to the vni.

Fix is to separate add/update and delete mcast-group functions and to check
for mcast-group before resetting during delete.

Signed-off-by: sramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:05 -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
bc3421f088 zebra: ignore zero_mac without VNI deletes
Ignore zebra_mac updates if they do not contain a VNI for vxlan
interface. We don't have anything we can do with them.

'''
==443593== Process terminating with default action of signal 6 (SIGABRT): dumping core
==443593==    at 0x4E1156C: __pthread_kill_implementation (in /usr/lib64/libc.so.6)
==443593==    by 0x4DC4D15: raise (in /usr/lib64/libc.so.6)
==443593==    by 0x49823C7: core_handler (sigevent.c:261)
==443593==    by 0x4DC4DBF: ??? (in /usr/lib64/libc.so.6)
==443593==    by 0x4E1156B: __pthread_kill_implementation (in /usr/lib64/libc.so.6)
==443593==    by 0x4DC4D15: raise (in /usr/lib64/libc.so.6)
==443593==    by 0x4D987F2: abort (in /usr/lib64/libc.so.6)
==443593==    by 0x49C3064: _zlog_assert_failed (zlog.c:700)
==443593==    by 0x4F5E6D: zebra_vxlan_if_vni_find (zebra_vxlan_if.c:661)
==443593==    by 0x4EEAC3: zebra_vxlan_check_readd_vtep (zebra_vxlan.c:4244)
==443593==    by 0x450967: netlink_macfdb_change (rt_netlink.c:3722)
==443593==    by 0x450011: netlink_neigh_change (rt_netlink.c:4458)
'''

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Stephen Worley
e611f5da37 zebra: encode dvni with nexthop groups
Move dvni encoding to common code and add support
for encoding it using nexthop groups.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Stephen Worley
fb99ca86c4 zebra: handle ipv6-mapped-ipv4 with DVNI
Properly handle ipv6-mapped-ipv4 with DVNI by converting
the address to ipv4 and setting that as the DST field for
the encap.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Stephen Worley
582bb29ac7 zebra: dont install implicit NULL labels non-vni
Don't install implict NULL labels with non-vni label'd
routes.

This returns behavior to how it was before adding the DVNI code.

Ticket: #2677036
Testing Done: precommit, manual
Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Stephen Worley
5fa6bfffb1 zebra: encode vni label via lwt encap
Encode the vni label during route install on linux
systems via lwt encap 64bit LWTUNNEL_IP_ID. The kernel expects
this in network byte order, so we convert it.

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
b95ce8fadb zebra: single vxlan device dataplace vni update changes
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-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
Spoorthi K
4a563f2714 zebra_fpm: Add support for other protocols in fpm:netlink
fpm:netlink format doesn't indicate the protocol information
    in routes of BGP, OSPF and other protocols. Routes of those
    protocols just indicate protocol as zebra.

    The below route is actually BGP route but 'proto': 11
    indicates that it is zebra.

    {'attrs': [('RTA_DST', 'dummy'),
               ('RTA_PRIORITY', 0),
               ('RTA_GATEWAY', 'dummy'),
               ('RTA_OIF', 2)],
     'dst_len': 32,
     'family': 2,
     'flags': 0,
     'header': {'flags': 1025,
                'length': 60,
                'pid': 3160253895,
                'sequence_number': 0,
                'type': 24},
     'proto': 11,
     'scope': 0,
     'src_len': 0,
     'table': 254,
     'tos': 0,
     'type': 1}

    with this change it is now seen with 'proto': 186
    indicates that it is BGP.

    {'attrs': [('RTA_DST', 'dummy'),
               ('RTA_PRIORITY', 0),
               ('RTA_GATEWAY', 'dummy'),
               ('RTA_OIF', 2)],
     'dst_len': 32,
     'family': 2,
     'flags': 0,
     'header': {'flags': 1025,
                'length': 60,
                'pid': 3160253895,
                'sequence_number': 0,
                'type': 24},
     'proto': 186,
     'scope': 0,
     'src_len': 0,
     'table': 254,
     'tos': 0,
     'type': 1}

Signed-off-by: Spoorthi K <spk@redhat.com>
2023-01-24 09:48:21 +05:30
Russ White
bb1d52b3c0
Merge pull request #12604 from donaldsharp/distance_metric_offload_fixes
Distance/metric offload fixes
2023-01-18 15:57:48 -05:00
anlan_cs
64a29a00f7 zebra: cosmetic changes for debug
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>
2023-01-11 18:16:40 +08:00
Donald Sharp
68ff69fa27 zebra: Set metric appropriately on route offload to asic
When FRR receives a route from the kernel about the route
offload success/failure.  The metric being reported is not
going to be correct since we may not know it appropriately
at this point in time.  If we can set the metric to something
appropriate.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-05 14:31:36 -05:00
Yutaro Hayakawa
45c129948c fpm: Send NH message to FPM even if the local kernel doesn't support it
netlink_route_multipath_msg_encode checks whether the local kernel
supports NextHop Netlink message and doesn't send the message if the
local kernel doesn't have support. This is also applied to the FPM since
kernel dataplane and FPM shares the same code. However, for the FPM,
it's not necessary to have this limit.

This commit adds extra check if netlink_route_multipath_msg_encode is
called from the FPM and bypass kernel support check if it is from the
FPM.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
2022-12-25 14:52:57 +09:00
Donald Sharp
478c62e21d zebra: Fix nexthop group memory leak
Address Sanitizer found this:

=================================================================
==418623==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 4 object(s) allocated from:
    #0 0x4bd732 in calloc (/usr/lib/frr/zebra+0x4bd732)
    #1 0x7feaeab8f798 in qcalloc /home/sharpd/frr8/lib/memory.c:116:27
    #2 0x7feaeaba40f4 in nexthop_group_new /home/sharpd/frr8/lib/nexthop_group.c:270:9
    #3 0x56859b in netlink_route_change_read_unicast /home/sharpd/frr8/zebra/rt_netlink.c:950:9
    #4 0x5651c2 in netlink_route_change /home/sharpd/frr8/zebra/rt_netlink.c:1204:2
    #5 0x54af15 in netlink_information_fetch /home/sharpd/frr8/zebra/kernel_netlink.c:407:10
    #6 0x53e7a3 in netlink_parse_info /home/sharpd/frr8/zebra/kernel_netlink.c:1184:12
    #7 0x548d46 in kernel_read /home/sharpd/frr8/zebra/kernel_netlink.c:501:2
    #8 0x7feaeacc87f6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
    #9 0x7feaeab36503 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3
    #10 0x550d38 in main /home/sharpd/frr8/zebra/main.c:476:2
    #11 0x7feaea492d09 in __libc_start_main csu/../csu/libc-start.c:308:16

Indirect leak of 576 byte(s) in 4 object(s) allocated from:
    #0 0x4bd732 in calloc (/usr/lib/frr/zebra+0x4bd732)
    #1 0x7feaeab8f798 in qcalloc /home/sharpd/frr8/lib/memory.c:116:27
    #2 0x7feaeab9b3f8 in nexthop_new /home/sharpd/frr8/lib/nexthop.c:373:7
    #3 0x56875e in netlink_route_change_read_unicast /home/sharpd/frr8/zebra/rt_netlink.c:960:15
    #4 0x5651c2 in netlink_route_change /home/sharpd/frr8/zebra/rt_netlink.c:1204:2
    #5 0x54af15 in netlink_information_fetch /home/sharpd/frr8/zebra/kernel_netlink.c:407:10
    #6 0x53e7a3 in netlink_parse_info /home/sharpd/frr8/zebra/kernel_netlink.c:1184:12
    #7 0x548d46 in kernel_read /home/sharpd/frr8/zebra/kernel_netlink.c:501:2
    #8 0x7feaeacc87f6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
    #9 0x7feaeab36503 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3
    #10 0x550d38 in main /home/sharpd/frr8/zebra/main.c:476:2
    #11 0x7feaea492d09 in __libc_start_main csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: 704 byte(s) leaked in 8 allocation(s).

Fix this!

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-15 11:15:33 -05:00
Donald Sharp
45f0a10bef zebra: Add ctx to netlink message parsing
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-12 10:44:57 -05:00
Donatas Abraitis
47f3d0905b
Merge pull request #12238 from donaldsharp/append
lib, zebra: Allow for zebra to recognize that a route has gotten desy…
2022-11-07 10:37:05 +02:00
Donald Sharp
569e141113 lib, zebra: Add ability to encode/decode resilient nhg's
Add ability to read the nexthop group resilient linux
kernel data as well as write it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04 13:29:36 -04:00
Donald Sharp
a048d52399 lib, zebra: Allow for zebra to recognize that a route has gotten desynced
FRR does not use the NLM_F_APPEND semantics ( in fact I would argue that
the NLM_F_APPEND semantics just introduce pain for all parties involved )
I would also argue that most people who use the kernel netlink api
have recognized that NLM_F_APPEND for a route is a recipe for disaster
that is well documented and as such it is not used as anything other
than a curiousity by operators.

See:
https://bugzilla.redhat.com/show_bug.cgi?id=1337855
https://github.com/thom311/libnl/issues/226

Are 2 great examples of how confusing it is for anyone in user
space to know what the correct thing to do is.  Given that
new fields can be added with no semantics to allow us to know
what has resulted in a change or not.

In an attempt to recognize this, let's note that FRR
believes it has gotten out of sync with the kernel.
Future commits will react to the desynchronized route
and request from the kernel a reload of that specific
route if possible.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-04 12:02:00 -04:00
Carmine Scarpitta
8bea07e49f zebra, lib: add support for SRv6 End.DT46 behavior
This commit enables zebra to install End.DT46 nexthops into the Linux kernel.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18 15:37:25 +02:00
Donald Sharp
07fd1f7e94 zebra: use rib_add_multipath in rt_netlink.c
The new route code path was using a combination of
both rib_add() and rib_add_multipath() let's clean
it up some to use rib_add_multipath()

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-17 16:04:50 -04:00
Donald Sharp
b0385873fa zebra: Create a zebra_rib_route_entry_new function and use it
Abstract the creation of the route_entry and use it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-17 16:04:50 -04:00
Donatas Abraitis
ce39ca16dd zebra: Avoid buffer overflow using netlink_parse_rtattr_nested()
memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); in netlink_parse_rtattr()
seems a good candidate to buffer overflow.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-07-17 22:31:48 +03:00
David Lamparter
e1cd4bb178 zebra: fix remaining MR RTM_GETROUTE oddities
The IPv6 version needs rtm_src_len and rtm_dst_len filled in due to
strict validation.  IPv4 also has this requirement, but zebra is running
in non-strict mode there so the kernel accepts it...

Also the table ID hack is IPv4 only.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-07-07 11:36:40 +02:00
David Lamparter
c6a89c8ef5 zebra: IIF/OIF are not used in MR RTM_GETROUTE
The multicast routing RTM_GETROUTE command does not use IIF/OIF
attributes, and the IPv6 version will refuse them with an error due to
being new netlink API and thus using strict validation.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-07-06 11:29:56 +02:00