summaryrefslogtreecommitdiff
path: root/zebra/interface.c
AgeCommit message (Collapse)Author
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>
2019-01-31zebra: Move the master thread handler to the zrouter structureDonald Sharp
The master thread handler is really part of the zrouter structure. So let's move it over to that. Eventually zserv.h will only be used for zapi messages. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-29Merge pull request #3288 from nitinsoniism/show_intf_briefDavid Lamparter
zebra: Support "brief" output for "show interface"
2019-01-08zebra: Support "brief" output for "show interface"Nitin Soni
"brief" output for "show interface" helps when we have to quickly check important information like ip address, vrf etc. This prints information in the easy to read tabular format. Currently it prints oper status, ifname, vrf, ipv4 and ipv6 addresses. Ticket: CM-9109 Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
2018-11-15Merge pull request #3326 from qlyoung/fix-lla-reinstallationDavid Lamparter
zebra: force neighbor entry reinstallation
2018-10-28zebra: force neighbor entry reinstallationQuentin Young
Even if the neighbor entry we want already exists, force its reinstallation to ensure that it's valid. This will now take place when we request an update of the neighbor entry. Ticket: CM-22604 Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-11-12zebra: Let zebra know about bond and blond slave intf typesDinesh Dutt
The interface type can be a bond or a bond slave, add some code to note this and to display it as part of a show interface command. Signed-off-by: Dinesh Dutt <didutt@gmail.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-28zebra: cleanup some leftovers from removed cmdsQuentin Young
* Remove vestigial 'secondary' option for v6 address installation functions * Update comments mentioning it Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-02*: list_delete_and_null() -> list_delete()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-24Merge pull request #3020 from donaldsharp/global_5549Russ White
Allow v6 global addresses to be nexthops for v4 addresses in bgp
2018-09-19zebra: Use actual memory type for zebra info pointerDonald Sharp
Use MTYPE_ZINFO for the `struct zebra_if` data structure instead of using MTYPE_TMP. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-19zebra: Abstract mac neigh installation into it's own functionDonald Sharp
Abstract the mac neigh installation for 169.254.0.1 into it's own function that we can pass the mac address into. This will allow a future commit to use this functionality when we have the appropriate mac address from reading optional attributes of a RA packet. Signed-off-by: Donald Sharp <sharpd@cumuusnetworks.com>
2018-09-18zebra: Cleanup comments to appropriately match styleDonald Sharp
The block comments from a couple commits were not following proper style. Fix. Fix SA warning that had snuck in. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-18zebra: resolve link dependencies post nldumpAnuradha Karuppiah
Netdevices are not sorted in any fashion by the kernel during the initial interface nldump. So you can get an upper device (such as an SVI) before its corresponding lower device (bridge). To fix this problem we skip resolving link dependencies during handling of nldump notifications. Resolving instead at the end (when all the devices are present) Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com> Ticket: CM-22388, CM-21796 Reviewed By: CCR-7845 Testing Done: 1. verified on a setup with missing linkages 2. automation - evpn-min
2018-09-14Merge pull request #3023 from qlyoung/ultimate-warning-reference-cards-renameDavid Lamparter
warning reference cards rename
2018-09-13*: LIB_[ERR|WARN] -> EC_LIBQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRAQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13bgpd lib ospf6d pbrd tests zebra: shadowing fixesF. Aragon
This fixes all remaining local variable shadowing cases Signed-off-by: F. Aragon <paco@voltanet.io>