summaryrefslogtreecommitdiff
path: root/zebra/interface.c
AgeCommit message (Collapse)Author
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>
2018-09-12Merge remote-tracking branch 'frr/master' into warningsDavid Lamparter
Conflicts: zebra/if_ioctl_solaris.c zebra/rtread_getmsg.c Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-11Merge pull request #2944 from thbtcllt/masterRuss White
fix zebra crash when a vrf interface changes with netns implementation for vrf
2018-09-06zebra: flog_warn conversionQuentin Young
Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06zebra/lib: code cleaningThibaut Collet
Remove useless parenthesis and explicit cast. Remove redundant code. Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
2018-08-30zebra: fix crash when interface vrf changesThibaut Collet
This crash occurs only with netns implementation. vrf meaning is different regarging its implementation (netns or vrf-lite) - With vrf-lite implementation vrf is a property of the interface that can be changed as the speed or the state (iproute2 command: "ip link set dev IF_NAME master VRF_NAME"). All interfaces of the system are in the same netns and so interface name is unique. - With netns implementation vrf is a characteristic of the interface that CANNOT be changed: it is the id of the netns where the interface is located. To change the vrf of an interface (iproute2 command to move an interface "ip netns exec VRF_NAME1 ip link set dev IF_NAME netns VRF_NAME2") the interface is deleted from the old vrf and created in the new vrf. Interface name is not unique, the same name can be present in the different netns (typically the lo interface) and search of interface must be done by the tuple (interface name, netns id). Current tests on the vrf implementation (vrf-lite or netns) are not sufficient. In some cases (for example when an interface is moved from a vrf X to the default vrf and then move back to VRF X) we can have a corruption message and then a crash of zebra. To avoid this corruption test on the vrf implementation, needed when an interface changes, has been rewritten: - For all interface changes except deletion the if_get_by_name function, that checks if an interface exists and creates or updates it if needed, is changed: * The vrf-lite implementation is unchanged: search of the interface is based only on the name and update the vrf-id if needed. * The netns implementation search of the interface is based on the (name, vrf-id) tuple and interface is created if not found, the vrf-id is never updated. - deletion of an interface (reception of a RTM_DELLINK netlink message): * The vrf-lite implementation is unchanged: the interface information are cleared and the interface is moved to the default vrf if it does not belong to (to allow vrf deletion) * The netns implementation is changed: only the interface information are cleared and the interface stays in its vrf to avoid conflict with interface with the same name in the default vrf. This implementation reverts (partially or totally): commit 393ec5424e35 ("zebra: fix missing node attribute set in ifp") commit e9e9b1150f0c ("lib: create interface even if name is the same") commit 9373219c67e1 ("zebra: improve logs when replacing interface to an other netns") Fixes: b53686c52a59 ("zebra: delete interface that disappeared") Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-29zebra: do not update link if interface is veth interfacePhilippe Guibert
when interface is a virtual ethernet interface, then there is no need to update link pointer of interface. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-27zebra: when veth link is used across vrf, the link may not be goodPhilippe Guibert
This function is changed so that the interface index is searched across the correct namespace. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14lib, zebra: Add LIB_ERR_INTERFACEDonald Sharp
Add a error type that allows us to track bad interface states. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29zebra: Remove zebra_static.c and .hDonald Sharp
These are no longer needed so remove. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29staticd: Start the addition of a staticdDonald Sharp
This is the start of separating out the static handling code from zebra -> staticd. This will help simplify the zebra code and isolate static route handling to it's own code base. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-27lib,zebra: fix json output when vrf1 when not activeNathan Van Gheem
When I did a show ip route with `json` on a vrf when it didn't exist, frr would output invalid json. Signed-off-by: Nathan Van Gheem <nathan@cumulusnetworks.com>
2018-06-18zebra: re-install static routes needed vrf when the vrf intf comes upDon Slice
Problem reported that if the vrf device is taken down and then brought back up, any static route referencing that vrf device was not re-installed. This fix runs back thru the static routes that reference the vrf device coming up and re-install them. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-05-12Merge pull request #2171 from pguibert6WIND/misc_crashes_moving_ifp_from_netnsRuss White
Misc crashes moving ifp from netns
2018-05-08zebra: Fixup crash with vlan interfaces attempted to be usedDonald Sharp
When zebra starts up it receives from the kernel a full dump of interface information. Unfortunately it is in no particular order. As such we sometimes receive data from the kernel about interfaces we do not know about yet. In this bug, we are attempting to use the interface pointer(->link) for a vlan interface that we have not properly resolved. This fix ensures that we will not attempt to call zvni_map_svi if we have a NULL pointer. There are other places in the code we are already checking for the fact that the ->link pointer is valid before calling this function, so I believe that this is correct. We do need to come back and resolve all ->link pointers after we have received the full table. This can be done in another commit. Ticket: CM-17041 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-04zebra: avoid inactivating twice an interfacePhilippe Guibert
This code is a sanity check to avoid double unlink of interface. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-04zebra: fix missing node attribute set in ifpPhilippe Guibert
There are cases when switching from one netns to an other one, where the if_table registration by index has not been flushed. This fix mitigates the potential crashes, in case the ifp->node pointer is null, the value is overwritten by the route_node obtained. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-04-09zebra: Notice when our neighbor entry is removed and fight backDonald Sharp
Notice when someone deletes a neighbor entry we've put in for rfc-5549 gets deleted by some evil evil person. When this happens notice and push it back in, immediately. Ticket: CM-18612 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-03Merge pull request #1927 from pguibert6WIND/issue_1926Renato Westphal
zebra: delete interface that disappeared
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-26zebra: delete interface that disappearedPhilippe Guibert
When moving interfaces to an other place, like other netns, the remaining interface is still present, with inactive status. Now, that interface is deleted from the list, if the interface appears on an other netns. If not, the interface is kept. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-23zebra: fix misc changes related to link updates with correct znsPhilippe Guibert
Because vrf with netns backend may be used, the correct zns must be found prior any modifications. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-02-27zebra: retrieve zns context from zvrf when netlink discoveryPhilippe Guibert
So as to get the correct NETNS where some discovery must be done and populated, the zns pointer is directly retrieved from zvrf, instead of checking that the VRF is a backend NETNS or not. In the case where the interfaces are discovered before the VRF is enabled ( VRF-lite populate), then the default NS is retrieved. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27zebra: fix initialised vrf_id value never readPhilippe Guibert
this is a static analysis performed by c-lang scan-build tool that demonstrated this issue. This commit is handling the fix. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27zebra: ipv6 operations stick to namespacePhilippe Guibert
All ipv6 operations stick to namespace. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-02-27zebra: socket operations stick to namespace if necessaryPhilippe Guibert
Upon following calls: interface poll, address poll, route poll, and ICMPv6 handling, each new Namespace is being parsed. For that, the socket operations need to switch from one NS to one other, to get the necessary information. As of now, there is a crash when dumping interfaces, through show running-config. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-21zebra: Install connected routes during VRF change only if interface is upvivek
During VRF change handling, the connected route for the interface should be installed only if the interface is up. Otherwise, we end up with duplicate connected routes which can lead to other problems. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Ticket: CM-19364 Reviewed By: CCR-7099 Testing Done: Manual verification
2018-01-11zebra: Add one-shot thread to recheck speedDonald Sharp
There are certain interfaces that when brought up and we receive the netlink notification about it, the speed of the interface is not set correctly. This creates a one-shot thread that will wait 15 seconds and then requery the speed and if it is different it will renotify the running daemons. The kernel should notify us on speed changes, unfortunately this is not done currently via a netlink message as you would think. As I understand it there is some in-fighting about the proper way to approach this issue and due to the way the kernel release cycle works we are a ways off from getting this fixed. This is a `hack` to make us work correctly while we wait for the true answer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-14zebra: Remove possible NULL dereference in if_delete_connectedDonald Sharp
It is technically possible to attempt to use a NULL pointer. Remove this from happening. Additionally cleanup code indentation a small bit. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-24*: add missing \n in some help stringsRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10*: use the FOR_ALL_INTERFACES abstraction from babeldRenato Westphal
This improves code readability and also future-proofs our codebase against new changes in the data structure used to store interfaces. The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but for now only babeld is using it. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10*: introduce new rb-tree to optimize interface lookup by ifindexRenato Westphal
Performance tests showed that, when running on a system with a large number of interfaces, some daemons would spend a considerable amount of time in the if_lookup_by_index() function. Introduce a new rb-tree to solve this problem. With this change, we need to use the if_set_index() function whenever we want to change the ifindex of an interface. This is necessary to ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The return value of all insert/remove operations in the interface rb-trees is checked to ensure that an error is logged if a corruption is detected. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>