summaryrefslogtreecommitdiff
path: root/zebra/interface.c
AgeCommit message (Collapse)Author
2020-02-13*: Remove break after returnDonatas Abraitis
Just a deadcode. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-12-03zebra: send RA lifetime of 0 before ceasing to advertise RAsDon Slice
Problem reported by testing agency that RFC4861 section 6.2.5 states that a router should send an RA with a lifetime of 0 before ceasing to send RAs on the interface, or when the interace is shutdown, or the router is shutdown. This fix adds that capability. Ticket: CM-27061 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-11-26Merge pull request #4977 from chiragshah6/evpn_dev1Philippe Guibert
* evpn primary address advertisement
2019-11-22zebra: knob to make ra retransmit interval rfc compliantDon Slice
Problem reported by testing facility that our sending of Router Advertisements more frequently than once very three seconds is not compliant with rfc4861. Added a knob to turn off fast retransmits in order to meet the requirement of the RFC. Ticket: CM-27063 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-11-22zebra: evpn pip mac vlan up-down eventChirag Shah
macvlan interface up/down event triggers bgp to send updates for evpn routes with changed RMAC and nexthop IP values. Ticket:CM-26190 Reviewed By: Testing Done: Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-02lib, ospfd, zebra: Convert interface_delete to take double pointerDonald Sharp
When free'ing the interface pointer, set it to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02*: Convert connected_free to a double pointerDonald Sharp
Set the connected pointer to set the pointer to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25zebra: Re-work zebra_nhg_*_valid APIsStephen Worley
Re-work the validity setting and checking APIs for nhg_hash_entry's to make them clearer. Further, they were originally only beings set on ifdown and install. Extended their use into releasing entries and to account for setting the validity of a recursive dependent. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Zebra nexthop group re-work checkpatch fixesStephen Worley
Checkpatch fixes for the zebra nexthop group re-work. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Switch nhg_connected to use new RB treeStephen Worley
Switch the nhg_connected tree structures to use the new RB tree API in `lib/typerb.h`. We were using the openbsd-tree implementation before. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Add cli show NHE by ID and interface groupsStephen Worley
Add cli to show nhg_hash_entry's by ID. Add cli to show nhg_hash_entry info for interfaces and remove just listing ID's in `show interface *` Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Use a nhe context dataplane and rib metaqStephen Worley
We will use a nhe context for dataplane interaction with nextho group hash entries. New nhe's from the kernel will be put into a group array if they are a group and queued on the rib metaq to be processed later. New nhe's sent to the kernel will be set on the dataplane context with approprate ID's in the group array if needed. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Add interface down marking to NHE'sStephen Worley
Add functionality to allow an interface down event to mark any dependent NHE's as invalid. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Re-organize/expose nhg_connectedStephen Worley
Re-organize and expose the nhg_connected functions so that it can be used outside zebra_nhg.c. And then abstract those into zebra_nhg_depends_* and zebra_nhg_depenents_* functons. Switch the ifp struct to use an RB tree for its dependents, making use of the nhg_connected functions. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Add ifp to zebra-side rib_addStephen Worley
Add an interface pointer for an nexthop group hash entry when we are getting a rib_add for a new route. Also, add the interface index to the `show nexthop-group` command. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Add nexthop hash entry list to zebra interface infoStephen Worley
Add a nexthop hash entry list to the local zebra interface info for each interface. This will allow us to modify nexthops on link events. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-09-30Merge pull request #5009 from donaldsharp/interface_deletionRuss White
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-25Merge pull request #5051 from idryzhov/fix-vrf-autocompleteDonald Sharp
*: fix missing VRF autocompletions
2019-09-25Merge pull request #5055 from ↵Mark Stapp
pguibert6WIND/fix_memory_leak_with_delete_interface zebra: fix memory leak
2019-09-25zebra: fix memory leakPhilippe Guibert
the if_lookup_by_name_per_ns keeps a lock on the node where the searched ifp is stored. Then this node can not be freed even if the ifp is removed from the node. Just add the missing unlock (as for the if_lookup_by_index_per_ns lookup function) Fixes: b8af3fbbafc8 ("zebra: fix detection of interface renames") Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-09-24*: fix missing VRF autocompletionsIgor Ryzhov
Current autocompletion works only for simple "vrf NAME" case. This commit expands it also for the following cases: - "nexthop-vrf NAME" in staticd - usage of $varname in many daemons All daemons are updated to use single varname "$vrf_name". Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-09-24Merge pull request #4959 from pguibert6WIND/zebra_inform_layerRuss White
zebra: inform upper layer error when reading correct speed interface
2019-09-19*: Add infrastructure to support zapi interface callbacksDonald Sharp
Start the conversion to allow zapi interface callbacks to be controlled like vrf creation/destruction/change callbacks. This will allow us to consolidate control into the interface.c instead of having each daemon read the stream and react accordingly. This will hopefully reduce a bunch of cut-n-paste stuff Create 4 new callback functions that will be controlled by lib/if.c create -> A upper level protocol receives an interface creation event The ifp is brand spanking newly created in the system. up -> A upper level protocol receives a interface up event This means the interface is up and ready to go. down -> A upper level protocol receives a interface down destroy -> A upper level protocol receives a destroy event This means to delete the pointers associated with it. At this point this is just boilerplate setup for future commits. There is no new functionality. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19lib, zebra: Allow for interface deletion when kernel event happensDonald Sharp
When zebra gets a callback from the kernel that an interface has actually been deleted *and* the end users has not configured the interface, then allow for deletion of the interface from zebra. This is especially important in a docker environment where containers and their veth interfaces are treated as ephermeal. FRR can quickly have an inordinate amount of interfaces sitting around that are not in the kernel and we have no way to clean them up either. My expectation is that this will cause a second order crashes in upper level protocols, but I am not sure how to catch these and fix them now ( suggestions welcome ). There are too many use patterns and order based events that I cannot know for certain that we are going to see any at all, until someone sees this problem as a crash :( I do not recommend that this be put in the current stabilization branch and allow this to soak in master for some time first. Testing: sharpd@donna ~/frr4> sudo ip link add vethdj type veth peer name vethjd sharpd@donna ~/frr4> sudo ip link add vethaa type veth peer name vethab sharpd@donna ~/frr4> sudo vtysh -c "show int brief" Interface Status VRF Addresses --------- ------ --- --------- dummy1 down default enp0s3 up default 10.0.2.15/24 enp0s8 up default 192.168.209.2/24 enp0s9 up default 192.168.210.2/24 enp0s10 up default 192.168.212.4/24 lo up default 10.22.89.38/32 vethaa down default vethab down default vethdj down default vethjd down default virbr0 up default 192.168.122.1/24 virbr0-nic down default sharpd@donna ~/frr4> sudo ip link set vethaa up sharpd@donna ~/frr4> sudo ip link set vethab up sharpd@donna ~/frr4> sudo ip link del vethdj sharpd@donna ~/frr4> sudo vtysh -c "show int brief" Interface Status VRF Addresses --------- ------ --- --------- dummy1 down default enp0s3 up default 10.0.2.15/24 enp0s8 up default 192.168.209.2/24 enp0s9 up default 192.168.210.2/24 enp0s10 up default 192.168.212.4/24 lo up default 10.22.89.38/32 vethaa up default vethab up default virbr0 up default 192.168.122.1/24 virbr0-nic down default sharpd@donna ~/frr4> sudo ip link del vethaa sharpd@donna ~/frr4> sudo vtysh -c "show int brief" Interface Status VRF Addresses --------- ------ --- --------- dummy1 down default enp0s3 up default 10.0.2.15/24 enp0s8 up default 192.168.209.2/24 enp0s9 up default 192.168.210.2/24 enp0s10 up default 192.168.212.4/24 lo up default 10.22.89.38/32 virbr0 up default 192.168.122.1/24 virbr0-nic down default sharpd@donna ~/frr4> sudo ip link add vethaa type veth peer name vethab sharpd@donna ~/frr4> sudo vtysh -c "show int brief" Interface Status VRF Addresses --------- ------ --- --------- dummy1 down default enp0s3 up default 10.0.2.15/24 enp0s8 up default 192.168.209.2/24 enp0s9 up default 192.168.210.2/24 enp0s10 up default 192.168.212.4/24 lo up default 10.22.89.38/32 vethaa down default vethab down default virbr0 up default 192.168.122.1/24 virbr0-nic down default sharpd@donna ~/frr4> sudo vtysh -c "show run" Building configuration... Current configuration: ! frr version 7.2-dev frr defaults datacenter hostname donna.cumulusnetworks.com log stdout no ipv6 forwarding ! ip route 192.168.3.0/24 192.168.209.1 ip route 192.168.4.0/24 blackhole ip route 192.168.5.0/24 192.168.209.1 ip route 192.168.6.0/24 192.168.209.1 ip route 192.168.7.0/24 99.99.99.99 nexthop-vrf EVA ip route 192.168.8.0/24 192.168.209.1 ip route 4.5.6.7/32 12.13.14.15 ! interface dummy1 ip address 12.13.14.15/32 ! interface vethaa description FROO ! line vty ! end sharpd@donna ~/frr4> sudo ip link del vethaa sharpd@donna ~/frr4> sudo vtysh -c "show int brief" Interface Status VRF Addresses --------- ------ --- --------- dummy1 down default enp0s3 up default 10.0.2.15/24 enp0s8 up default 192.168.209.2/24 enp0s9 up default 192.168.210.2/24 enp0s10 up default 192.168.212.4/24 lo up default 10.22.89.38/32 vethaa down default virbr0 up default 192.168.122.1/24 virbr0-nic down default sharpd@donna ~/frr4> sudo vtysh -c "show run" Building configuration... Current configuration: ! frr version 7.2-dev frr defaults datacenter hostname donna.cumulusnetworks.com log stdout no ipv6 forwarding ! ip route 192.168.3.0/24 192.168.209.1 ip route 192.168.4.0/24 blackhole ip route 192.168.5.0/24 192.168.209.1 ip route 192.168.6.0/24 192.168.209.1 ip route 192.168.7.0/24 99.99.99.99 nexthop-vrf EVA ip route 192.168.8.0/24 192.168.209.1 ip route 4.5.6.7/32 12.13.14.15 ! interface dummy1 ip address 12.13.14.15/32 ! interface vethaa description FROO ! line vty ! end Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19Zebra: Rectifying the log messages.vdhingra
This change addresses the following : 1. Ensures zlog_debug should be under DEBUG macro check 2. Ensures zlog_err and zlog_warn wherever applicable. 3. Removed few posivite logs from fpm handling, whose frequency is high. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-17zebra: inform upper layer error when reading correct speed interfaceJulien Floret
speed interface is done 15 seconds after interface creation. during that time, the vrf or the interface may have disappeared. to protect this, return an error in case it is not possible to create a vrf socket or it is not possible to get speed of an interface because of a missing device. Signed-off-by: Julien Floret <julien.floret@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-26Merge pull request #4812 from pogojotz/fix-destination-multi-useDonald Sharp
zebra: Do not use connection dest for bcast
2019-08-18zebra: Do not use connection dest for bcastJuergen Werner
The `destination` field of the connection structure was used to store the broadcast address, if the connection was not p2p. This multipurpose is not very evident and the benefits over calculating the bcast address on the fly minimal. Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
2019-08-13 zebra: Display master interface names, not ifindicesDinesh G Dutt
When displaying the master interface's information in "show interface", the display is currently the ifindex of the master interface. Make it display the name as well as that is more useful than the name. Signed-off-by: Dinesh G Dutt<5016467+ddutt@users.noreply.github.com>
2019-07-29zebra: Remove repeated enqueueing of system routes for rethinkingDonald Sharp
The code as written before this code change point would enqueue every system route type to be refigured when we have an interface event. I believe this was to originally handle bugs in the way nexthop tracking was handled, mainly that if you keep asking the question you'll eventually get the right answer. Modify the code to not do this, we have fixed nexthop tracking to not be so brain dead and to know when it needs to refigure a route that it is tracking. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-13zebra: Modify way we query for inteface speedDonald Sharp
Initial commit of understanding interface speed changes on startup was this commit: dc7b3caefbd8baccb7fc3787a774e78d1a96636f Effectively we had encountered situations on system startup where the interface speed for a device was not properly setup when zebra learns about the interface ( Imagine a bond being brought up and the controlling software creating the bond is not fast given system load, the bond's speed changes upwards for each interface added ). The initial workup on this was to allow a 15 second window and then just reread the interface speed. We've since noticed that under heavy system load on startup this is not always sufficient. So modify the code to wait the 15 seconds and then check the interfaces speed. If the interfaces speed is still MAX_UINT32T or it has changed let's wait a bit longer and try again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-23Revert "Ospf missing interface handling 2"Donald Sharp
2019-06-22Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2Donald Sharp
Ospf missing interface handling 2
2019-06-17zebra: add ability to "show interface vrf all brief"Don Slice
Found that the "show interface brief" command was missing the ability to specify all vrfs. Added that capability via this fix. Ticket: CM-25139 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-06-12zebra: fix stats printing formatsDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-06-12*: change interface structure, from vrf_id to vrfPhilippe Guibert
Field vrf_id is replaced by the pointer of the struct vrf *. For that all other code referencing to (interface)->vrf_id is replaced. This work should not change the behaviour. It is just a continuation work toward having an interface API handling vrf pointer only. some new generic functions are created in vrf: vrf_to_id, vrf_to_name, a zebra function is also created: zvrf_info_lookup an ospf function is also created: ospf_lookup_by_vrf it is to be noted that now that interface has a vrf pointer, some more optimisations could be thought through all the rest of the code. as example, many structure store the vrf_id. those structures could get the exact vrf structure if inherited from an interface vrf context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12lib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change ↵Philippe Guibert
if_update_to_new_vrf() api vrf_id parameter is replaced with struct vrf * parameter. It is needed to create vrf structure before entering in the fuction. an error is generated in case the vrf parameter is missing. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12zebra, lib: upon entering interface, create vrf contextPhilippe Guibert
the interface search is based on vrfs. As at startup, some interfaces may be configured, there is need to have vrfs contexts present. A macro is being appended with an extra parameter that permits create a vrf and return the context. This macro is also used by some show routines, but will not create vrfs, because that extra parameter will be set to false, on that case. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12lib: create interface upon accessing interface NB API.Philippe Guibert
Upon accessing interface NB API, the interface is created, if the vrf is available. the commit does not change the behaviour, since at this commit, this is not yet possible to have vrf contexts, while zebra did not connect to daemons. However, that commit adds some work, so that it will be possible to work on a vrf context, without having the vrf_id completely resolved. for instance, if we suppose a vrf is created by command 'vrf TOTO' in the starting configuration of a daemon, then 'interface TITI vrf TOTO' will permit to create interface TITI within vrf TOTO. the macro VRF_GET_INSTANCE will return the vrf context, if available or not. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12*: change if_lookup_by_name() api with vrfPhilippe Guibert
the vrf_id parameter is replaced by struct vrf * parameter. this impacts most of the daemons that look for an interface based on the name and the vrf identifier. Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was ignored until now. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-17zebra: gracefully fail to protodown on bsdQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17vrrpd: protodown macvlan in backup stateQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-04-25zebra: Modify how we display/store os descriptionDonald Sharp
The alias/description of an interface in linux was being used to override the internal description. As such let's fix the display to keep track of both if we have it. Config in FRR: ! interface docker0 description another combination ! interface enp3s0 description BAMBOOZLE ME WILL YOU ! Config in linux: sharpd@robot ~/f/zebra> ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 alias This is the loopback you cabbage 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 74:d0:2b:9c:16:eb brd ff:ff:ff:ff:ff:ff alias HI HI HI Now the 'show int descr' command: robot# show int description Interface Status Protocol Description docker0 up down another combination enp3s0 up up BAMBOOZLE ME WILL YOU HI HI HI lo up up This is the loopback you cabbage Fixes: #4191 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-22Merge pull request #3786 from mjstapp/dplane_intfDonald Sharp
zebra: async interface address programming
2019-04-22zebra: Dplane interface address install for non-netlinkMark Stapp
ioctl-based platform code for interface address installation Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-22zebra: Use dplane for interface addresses (netlink)Mark Stapp
Start using the dataplane for interface-address programming, on netlink platforms. Other platforms just stubbed at this point. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-21zebra: use "mcast group" instead of just mcast in show and logsAnuradha Karuppiah
Fixup done in response to Jafar's review comments. root@act-7726-03:~# vtysh -c "show interface vxlan1000111" Interface vxlan1000111 is up, line protocol is up Link ups: 0 last: (never) Link downs: 0 last: (never) PTM status: disabled vrf: default index 95 metric 0 mtu 1500 speed 0 flags: <UP,BROADCAST,RUNNING,MULTICAST> Type: Ethernet HWaddr: 7e:1d:c1:d5:d1:cc Interface Type Vxlan VxLAN Id 1000111 VTEP IP: 6.0.0.28 Access VLAN Id 111 Mcast Group 239.1.1.111 >>>>>>>>>> Master (bridge) ifindex 99 root@act-7726-03:~# Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20zebra: process mcast-grp rxed in the vxlan-deviceAnuradha Karuppiah
BUP mcast IP address is maintained per-vxlan-device. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-02-12Merge pull request #3723 from slrz/zebra-rtadv-add-rfc8106-supportDavid Lamparter
zebra: add support for IPv6 RA options for DNS configuration (RFC8106)
2019-02-02zebra: support DNS configuration options in rtadvLars Seipel
Add support for the RDNSS and DNSSL router advertisement options described in RFC 8106. Signed-off-by: Lars Seipel <ls@slrz.net>