summaryrefslogtreecommitdiff
path: root/zebra/interface.c
AgeCommit message (Collapse)Author
2025-01-13lib: if: track oper-state inlineChristian Hopps
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-12-17zebra: check kernel routes when interface becomes upanlan_cs
Just like `link down`, check all kernel routes when interface become up. And, they maybe will be selected as the best one by zebra. Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-11-25zebra: Remove some unused functions on linux buildDonald Sharp
The functions: if_get_flags if_flags_update if_flags_mangle are never invoked from a linux netlink build. Put a #ifdef around those functions so that they are not included on the linux build as that they are not needed there. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25zebra: Add ability to know if some config is setDonald Sharp
For interface config: shutdown mpls multicast These states were never being shown in output, let's show it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-29lib,zebra: remove table node from ifp structMark Stapp
Finish removing the table route_node from the ifp struct. Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-10-28zebra: removing use of per-NS if_tableMark Stapp
Remove use of the per-NS if_table from zebra/interface module. Use new add, lookup, and iteration apis. Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-10-28zebra: make a zif MTYPE internal/staticMark Stapp
Make an MTYPE used in zifs internal/static Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-10-13zebra: add back one field for debuganlan_cs
The `flags` field is removed recently, so add back it for debug. Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-08-27zebra: Handle kernel routes appropriatelyDonald Sharp
Current code intentionally ignores kernel routes. Modify zebra to allow these routes to be read in on linux. Also modify zebra to look to see if a route should be treated as a connected and mark it as such. Additionally this should properly handle some of the issues being seen with NOPREFIXROUTE. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-07-24zebra: Remove duplicate `#include "zebra/interface.h"`Carmine Scarpitta
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-07-12zebra: Fix to avoid two Vrfs with same table idsRajasekar Raja
During internal testing, when the following sequence is followed, two non default vrfs end up pointing to the same table-id - Initially vrf201 has table id 1002 - ip link add dev vrf202 type vrf table 1002 - ip link set dev vrf202 up - ip link set dev <intrerface> master vrf202 This will ideally lead to zebra exit since this is a misconfiguration as expected. However if we perform a restart frr.service at this point, we end up having two vrfs pointing to same table-id and bad things can happen. This is because in the interface_vrf_change, we incorrectly check for vrf_lookup_by_id() to evaluate if there is a misconfig. This works well for a non restart case but not for the startup case. root@mlx-3700-20:mgmt:/var/log/frr# sudo vtysh -c "sh vrf" vrf mgmt id 37 table 1001 vrf vrf201 id 46 table 1002 vrf vrf202 id 59 table 1002 >>>> Fix: in all cases of misconfiguration, exit zebra as expected. Ticket :#3970414 Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-06-20zebra: fix evpn mh bond member proto reinstallChirag Shah
In case of EVPN MH bond, a member port going in protodown state due to external reason (one case being linkflap), frr updates the state correctly but upon manually clearing external reason trigger FRR to reinstate protodown without any reason code. Fix is to ensure if the protodown reason was external and new state is to have protodown 'off' then do no reinstate protodown. Ticket: #3947432 Testing: switch:#ip link show swp1 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff protodown on protodown_reason <linkflap> switch:#ip link set swp1 protodown off protodown_reason linkflap off switch:#ip link show swp1 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-04-01zebra: don't deref vxlan-vni arrayMark Stapp
Null-check the vxlan-vni array info coming into zebra from the dataplane. Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-03-22zebra: fix rejected route due to wrong nexthop-groupLouis Scalbert
A specific sequence of actions involving the addition and removal of IP routes and network interfaces can lead to a route installation failure. The issue occurs under the following conditions: - Initially, there is no route present via the ens3 interface. - Adds a route: ip route 10.0.0.0/24 192.168.0.100 ens3 - Removes the same route: no ip route 10.0.0.0/24 192.168.0.100 ens3 - Removes the ens3 interface. - Re-adds the ens3 interface. - Again adds the same route: ip route 10.0.0.0/24 192.168.0.100 ens3 - And again removes it: no ip route 10.0.0.0/24 192.168.0.100 ens3 - Shuts down the ens3 interface - Reactivates the interface - Adds the route once more: ip route 10.0.0.0/24 192.168.0.100 ens3 The route appears to be rejected. > # show ip route nexthop > S>r 10.0.0.0/24 [1/0] (6) via 192.168.0.100, ens3, weight 1, 00:00:01 The commit 35729f38fa ("zebra: Add a timer to nexthop group deletion") introduced a feature to keep a nexthop-group in Zebra for a certain period even when it is no longer in use. But if a nexthop-group interface is removed during this period, the association between the nexthop-group and the interface is lost in zebra memory. If the interface is later added back and a route is re-established, the nexthop-group interface dependency is not correctly reestablished. As a consequence, the nexthop-group flags remain unset when the interface is down. Upon the interface's reactivation, zebra does not reinstall the nexthop-group in the kernel because it is marked as valid and installed, but in reality, it does not exist in the kernel (it was removed when the interface was down). Thus, attempts to install a route via this nexthop-group ID fail. Stop maintaining a nexthop-group when its associated interface is no longer present. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-08zebra: Move nhg reinstallation into if_up properDonald Sharp
The function call in to zebra_interface_nhg_reinstall is an action that takes place on interface up events *not* when the connected addresses are added to a system. this will prevent this function being called when new connected interfaces come alive that is an independent operation of the interface coming up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08zebra: Remove function abstraction in interface.cDonald Sharp
zebra_if_nhg_dependents_XXX were just simple wrapper functions that inited/deleted data structures. These were already function calls themselves. Let's remove the abstraction and make the code simpler. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08zebra: Remove ifp_nhg_XXX functions completelyDonald Sharp
These functions provided a level of abstraction that forced us to call multiple functions when a simple data structure change was all that is needed. Let's consolidate down and make things a bit simpler. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-08zebra: Remove helper function if_nhg_dependents_is_emptyDonald Sharp
Let's just let the function figure this out. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-29zebra: fix speed set to UINT32_MAXPhilippe Guibert
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-28lib, mgmtd, zebra: cleanup of zebra conversion to mgmtdIgor Ryzhov
- use `apply_finish` callback when possible to avoid multiple applies per commit - move table range working to the CLI handler - remove unnecessary conditional compilation - remove unnecessary boolean conversion Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert to mgmtdIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface configuration output to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface evpn mh es-df-pref command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-params packet-loss command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-params delay commands to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-params neighbor command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-params bandwidth commands to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-params metric command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-params command to NBIgor Ryzhov
Make link-params a presence container and activate it when entering the node. The "enable" command is not necessary anymore but kept hidden for backwards compatibility. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: mark interface mpls command as yangIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface ip/ipv6 address commands to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface bandwidth command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface shutdown command to NBIgor Ryzhov
Replace "shutdown" leaf with "enabled" leaf in frr-zebra YANG module to make it in line with standard YANG models. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert interface link-detect command to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28zebra: convert inteface multicast command to NBIgor Ryzhov
Introduce new "[no] multicast <enable|disable>" command to be able to remove the configuration. Current "[no] multicast" command cannot be removed. Current command is hidden but still works for backwards compatibility. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-24Merge pull request #15173 from louis-6wind/nhrp-noarpDonald Sharp
nhrpd: unset noarp flag using a zapi message
2024-01-24lib,zebra: add zapi message to control noarp flagLouis Scalbert
Add a ZAPI message to control the setting of the IFF_NOARP flag. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-23lib: remove leaf-list xpath hack from northboundIgor Ryzhov
Currently, when editing a leaf-list, `nb_candidate_edit` expects to receive it's xpath without a predicate and the value in a separate argument, and then creates the full xpath. This hack is complicated, because it depends on the operation and on the caller being a backend or not. Instead, let's require to always include the predicate in a leaf-list xpath. Update all the usages in the code accordingly. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-20zebra: Remove function that just calls another functionDonald Sharp
Why not just call the one function? Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-19zebra: fix default value for affinity-modeIgor Ryzhov
- initialize the necessary bit when creating if_link_params - fix CLI description to mark extended as the default mode - correctly set mode to extended when using the "no" form of the command - handle the "show_defaults" parameter correctly in cli_show callback Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19zebra: remove unnecessary checks from CLIIgor Ryzhov
First, any data tree validation in CLI handler is not correct, because this code won't be called when the change is done through any other frontend. Second, these checks are not necessary at all, because NB layer handles the change between admin-grp/affinity automatically. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19zebra: fix link-params admin-grp config outputIgor Ryzhov
- it was not printed at all because of the incorrect `yang_dnode_exist` check - the intended output was "admin-group" instead of "admin-grp" used in the actual CLI command Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-02Merge pull request #15055 from opensourcerouting/fix/zebra_ipv6_ll_configuredRuss White
zebra: Push all configured IP addresses when the interface comes up
2023-12-21zebra: Show IPv6 link-local interfaces under `show interface brief` outputDonatas Abraitis
Despite if it's managed by FRR or the kernel, show it. If the system has only link-local addresses, we should show it unless it's a secondary one. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-21zebra: Show IPv6 link-local interfaces under `show interface` outputDonatas Abraitis
Despite if it's managed by FRR or the kernel, show it. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-21zebra: Push all configured IP addresses when the interface comes upDonatas Abraitis
Let's say we this: ``` $ ip link set down dev r1-eth0 $ ip link set up dev r1-eth0 ``` But at the same time we have this interface configured by the FRR too: ``` interface r1-eth0 ipv6 address fe80:1::1/64 exit ``` We never re-add fe80:1::1/64, when the interface comes up, and we have a strange situation where NHT stops working and other stuff depending on NHT stops too (BGP peering, etc.). Closes: https://github.com/FRRouting/frr/issues/15050 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-21zebra: Drop ipv6_address_configured() functionDonatas Abraitis
Not used. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-06zebra: Add connected with noprefixrouteDonald Sharp
Add ability for the connected routes to know if they are a prefix route or not. sharpd@eva:/work/home/sharpd/frr1$ ip addr show dev dummy1 13: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether aa:93:ce:ce:3f:62 brd ff:ff:ff:ff:ff:ff inet 192.168.55.1/24 scope global noprefixroute dummy1 valid_lft forever preferred_lft forever inet 192.168.56.1/24 scope global dummy1 valid_lft forever preferred_lft forever inet6 fe80::a893:ceff:fece:3f62/64 scope link valid_lft forever preferred_lft forever sharpd@eva:/work/home/sharpd/frr1$ sudo vtysh -c "show int dummy1" Interface dummy1 is up, line protocol is up Link ups: 0 last: (never) Link downs: 0 last: (never) vrf: default index 13 metric 0 mtu 1500 speed 0 txqlen 1000 flags: <UP,BROADCAST,RUNNING,NOARP> Type: Ethernet HWaddr: aa:93:ce:ce:3f:62 inet 192.168.55.1/24 noprefixroute inet 192.168.56.1/24 inet6 fe80::a893:ceff:fece:3f62/64 Interface Type Other Interface Slave Type None protodown: off sharpd@eva:/work/home/sharpd/frr1$ sudo vtysh -c "show ip route" Codes: K - kernel route, C - connected, L - local, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, t - Table-Direct, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp13s0, 00:00:08 K>* 169.254.0.0/16 [0/1000] is directly connected, virbr2 linkdown, 00:00:08 L>* 192.168.44.1/32 is directly connected, dummy2, 00:00:08 L>* 192.168.55.1/32 is directly connected, dummy1, 00:00:08 C>* 192.168.56.0/24 is directly connected, dummy1, 00:00:08 L>* 192.168.56.1/32 is directly connected, dummy1, 00:00:08 L>* 192.168.119.205/32 is directly connected, enp13s0, 00:00:08 sharpd@eva:/work/home/sharpd/frr1$ ip route show default via 192.168.119.1 dev enp13s0 proto dhcp metric 100 169.254.0.0/16 dev virbr2 scope link metric 1000 linkdown 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 192.168.45.0/24 dev virbr2 proto kernel scope link src 192.168.45.1 linkdown 192.168.56.0/24 dev dummy1 proto kernel scope link src 192.168.56.1 192.168.119.0/24 dev enp13s0 proto kernel scope link src 192.168.119.205 metric 100 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown sharpd@eva:/work/home/sharpd/frr1$ ip route show table 255 local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1 local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1 broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1 local 172.17.0.1 dev docker0 proto kernel scope host src 172.17.0.1 broadcast 172.17.255.255 dev docker0 proto kernel scope link src 172.17.0.1 linkdown local 192.168.44.1 dev dummy2 proto kernel scope host src 192.168.44.1 broadcast 192.168.44.255 dev dummy2 proto kernel scope link src 192.168.44.1 local 192.168.45.1 dev virbr2 proto kernel scope host src 192.168.45.1 broadcast 192.168.45.255 dev virbr2 proto kernel scope link src 192.168.45.1 linkdown local 192.168.55.1 dev dummy1 proto kernel scope host src 192.168.55.1 broadcast 192.168.55.255 dev dummy1 proto kernel scope link src 192.168.55.1 local 192.168.56.1 dev dummy1 proto kernel scope host src 192.168.56.1 broadcast 192.168.56.255 dev dummy1 proto kernel scope link src 192.168.56.1 local 192.168.119.205 dev enp13s0 proto kernel scope host src 192.168.119.205 broadcast 192.168.119.255 dev enp13s0 proto kernel scope link src 192.168.119.205 local 192.168.122.1 dev virbr0 proto kernel scope host src 192.168.122.1 broadcast 192.168.122.255 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown Fixes: #14952 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-29lib: all: remove './' from xpath 22% speedupChristian Hopps
fixes #8299 Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-22*: convert `struct interface->connected` to DLISTDavid Lamparter
Replace `struct list *` with `DLIST(if_connected, ...)`. NB: while converting this, I found multiple places using connected prefixes assuming they were IPv4 without checking: - vrrpd/vrrp.c: vrrp_socket() - zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(), irdp_advert_off() (these fixes are really hard to split off into separate commits as that would require going back and reapplying the change but with the old list handling) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>