summaryrefslogtreecommitdiffstats
path: root/zebra/interface.c
Commit message (Collapse)AuthorAgeFilesLines
* lib, zebra: unify link layer type and hardware address handlingTimo Teräs2016-02-261-17/+1
| | | | | | | | | | | | | | | | This removes the BSD specific usage of struct sockaddr_dl hardware address. This unifies to use explict hw_addr member for the address, and zebra specific enumeration for the link layer type. Additionally the zapi is updated to never send platform specific structures over the wire, but the ll_type along with hw_addr_len and hw_addr are now sent for all platforms. Based on initial work by Paul Jakma. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Cleanup RTADV defineDonald Sharp2015-12-081-10/+10
| | | | | | | | | | The RTADV define was not being set correctly or consistently. Make the code consistent with our HAVE_IPV6 define. If the user wants to explicitly turn it off then they should run --disable-rtadv from the configure cli Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Fixed if_add_update possible null dereferenceMorgan Stewart2015-09-241-0/+2
| | | | | | | | | Coverity Scan #1221454 In zebra/interface.c if_data could be null dereferenced without early check. Signed-off-by: Morgan Stewart <morgan@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: let FIB stand for its respective VRFFeng Lu2015-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | A new member "vrf_id" is added to "struct rib", reflecting the VRF which it belongs to. A new parameter "vrf_id" is added to the relative functions where need, except those: - which already have the parameter "vrf_id"; or - which have a parameter in type of "struct rib"; or - which have a parameter in type of "struct interface". All incoming routes are set to default VRF. In fact, all routes in FIB are kept in default VRF. And the logic is not changed. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> [DL: conflicts fixed + compile warning fix] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: show interfaces in a specified VRF or all VRFsFeng Lu2015-06-021-23/+186
| | | | | | | | | | | | | | | | | | | | | | | The following commands only show interfaces in the default VRF: show interface show interface IFNAME show interface description New options are introduced to show interfaces in a specified VRF: show interface vrf N show interface IFNAME vrf N show interface description vrf N or all VRFs: show interface vrf all show interface IFNAME vrf all show interface description vrf all Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib, zebra, vtysh: configure an interface in non-default VRFFeng Lu2015-06-021-4/+19
| | | | | | | | | | | | | | Introduce a new command "interface IFNAME vrf N" to configure an interface in the non-default VRF. Till now, only zebra uses this command. Other daemons will install the command when they support multiple VRFs. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: call if_init()/if_terminate() from vrf_init()/vrf_terminate()Feng Lu2015-06-021-1/+0
| | | | | | | | | | | | | | | | | | Later, an interface will belong to a specific VRF, and the interface initialization will be a part of the VRF initialization. So now call if_init() from vrf_init(), and if_terminate() from vrf_terminate(). Daemons have the according changes: - if if_init() was called or "iflist" was initialized, now call vrf_init() instead; - if if_terminate() was called or "iflist" was destroyed, now call vrf_terminate() instead. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib, zebra: add "vrf_id" into the "struct interface"Feng Lu2015-06-021-9/+13
| | | | | | | | | | | | | | | | | | Later, an interface will belong to a specific VRF. Now we add a property "vrf_id" to the "struct interface", and keep it as the default value 0. This property is shown when displaying interfaces information. It is also added in some logs. This is just the preparation to move the interace list into the "struct vrf". The main logic is not changed. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: use prefix2str for logging where possibleTimo Teräs2015-06-011-3/+2
| | | | | | | This makes code more robust, consice and readable. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: fix NetBSD interface stats printfDavid Lamparter2015-04-211-18/+23
| | | | | | | | | "format '%qu' expects type 'long long unsigned int', but argument 3 has type '__uint64_t'" Move to %llu, which is more standard. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: print "no link-detect"David Lamparter2015-03-021-0/+2
| | | | | | | The default for this is slated to change, so let's print the current default value for preexisting configurations. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: nuke ^L (page feed)David Lamparter2014-06-041-1/+1
| | | | | | | | | | | | | | Quagga sources have inherited a slew of Page Feed (^L, \xC) characters from ancient history. Among other things, these break patchwork's XML-RPC API because \xC is not a valid character in XML documents. Nuke them from high orbit. Patches can be adapted simply by: sed -e 's%^L%%' -i filename.patch (you can type page feeds in some environments with Ctrl-V Ctrl-L) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: improve interface shutdown behaviourChristian Franke2013-09-191-16/+48
| | | | | | | | | | | | | | Linux removes IPv6 addresses when the interface is set down. Those addresses need to be readded when the interface is set up again. Also, an interface should not be reactivated from shutdown by configuring an ip address. Finally, remove the three-state logic for the shutdown setting as its sole current use may be mild confusion. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: don't change connected state from zebra/interface.cChristian Franke2013-09-191-87/+39
| | | | | | | | | | Try to avoid changing connected state from zebra/interface.c as this means making assumptions about kernel behaviour which may be or may become wrong. This state should rather be updated by events from the kernel. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: add ZEBRA_IFC_QUEUED to keep track of kernel stateChristian Franke2013-09-191-5/+14
| | | | | | | | | | | | | | | | | As there are timeframes when we don't get a notification from the kernel about new addresses. (e.g. while Linux performs IPv6 DAD), we need to have some information whether an address has been sent to the kernel or not. One case where this is relevant would be a user adding an IPv6 address, but deleting it before DAD has been complete. With the next patch which removes some (ill assuming) synchronous parts in address setup, ipv6_address_uninstall would not know whether or not it has to actually delete the prefix from the kernel. Resolving these windows where we lack information is what the flag ZEBRA_IFC_QUEUED is intended for. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: clear ZEBRA_IFC_CONFIGURED on "no ipv6 addr"Christian Franke2013-09-191-0/+2
| | | | | | | | | To match the semantics of IPv4, the ZEBRA_IFC_CONFIGURED flag should be cleared when an IPv6 connected is uninstalled via vty. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: make if_subnet_delete a bit more strictChristian Franke2013-09-191-1/+16
| | | | | | | | | Enhance if_subnet_delete so it will complain about improper use. Also, fix one occurence of improper use where it was called for IPv6 as well. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: lingering IP address after deletion (BZ#486)David Lamparter2012-07-131-3/+18
| | | | | | | | | | | | | | | | | zebra address bookkeeping is a mess. this is just a workaround to have IPv4 address deletion somewhat working on Linux. the if_unset_prefix call is synchronous, when it returns success the address deletion completed successfully. this is either signaled by a netlink ACK or by an OK return value from ioctl(). This version is wrapped by #ifdef HAVE_NETLINK so we don't touch the BSDs for now. * zebra/interface.c: On Linux, update zebra internal state after deleting an address. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: justify some IPv6 ND RA timers wrt RFCDenis Ovsienko2012-01-261-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | There was a regression introduced with the previous commit: "ipv6 nd home-agent-lifetime 1800000" appeared by default in every interface section of running-config, although this command is invalid in this context. Troubleshooting and bugfixing of the issue tracked out several bugs in router advertisement procedures, some of which are fixed in this commit. * zebra/interface.c * if_zebra_new_hook(): update to treat -1 as "uninitialized" * nd_dump_vty(): idem * zebra/rtadv.c * rtadv_send_packet(): update processing of "router lifetime" field, "home agent" option and "home agent lifetime" field to conform to RFC6275 better * ipv6_nd_ra_interval_msec(): update MaxRtrAdvInterval range check, make sure it never exceeds (initialized) AdvDefaultLifetime * ipv6_nd_ra_interval(): idem * ipv6_nd_ra_lifetime(): update AdvDefaultLifetime range check, make sure it never falls below MaxRtrAdvInterval * ipv6_nd_homeagent_lifetime(): update HomeAgentLifetime range check * no_ipv6_nd_ra_lifetime(): update to treat -1 as "uninitialized" * no_ipv6_nd_homeagent_lifetime(): idem * rtadv_config_write(): idem
* general: remove inline qualifiers and move in-header functions to objectsPaul Jakma2012-01-061-1/+1
| | | | | | * (general) Move functions in headers into files, to be compiled into shared object files. Remove inline qualifier from functions. Let the compiler do the work.
* zebra: fix infinite loop when deleting an interfaceRoman Hoog Antink2010-05-051-0/+4
| | | | | | | | | | | | When deleting a VLAN interface after flushing its addresses, zebra uses 100% CPU time and freezes. * interface.c: The while loop in line 407 that should clean up connected routes never hits one of the 2 lines "last = node;" and thus loops forever. Signed-off-by: Roman Hoog Antink <rha@open.ch>
* zebra: remove unused function to fix warningStephen Hemminger2009-12-081-13/+0
| | | | | * zebra/interface.c * if_supported_family(): sayonara
* RFC 4191 Default Router Preference support for router advertisementsChris Caputo2009-06-231-0/+9
| | | | | | | | | | | | | | | Adds "ipv6 nd router-preference (high|medium|low)" and "no ipv6 nd router-preference" interface commands. Files modified: doc/ipv6.texi zebra/interface.c zebra/interface.h zebra/rtadv.c zebra/rtadv.h Signed-off-by: Chris Caputo <ccaputo@alt.net>
* [cleanup] Use correct buffer size for inet_ntop()Stephen Hemminger2009-06-181-2/+2
| | | | | Don't need big buffer 1024 to hold IPV4 (INET_ADDRSTRLEN) or IPv6 (INET6_ADDRSTRLEN) message.
* [cleanup] Convert XMALLOC/memset to XCALLOCStephen Hemminger2009-06-121-2/+1
| | | | Simple conversion of XMALLOC/memset to XCALLOC
* [autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warningsPaul Jakma2007-05-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 2007-05-09 Paul Jakma <paul.jakma@sun.com> * configure.ac: sys/conf.h depends on sys/param.h, at least on FBSD 6.2. (bug #363) Should check for in_pktinfo for IRDP 2006-05-27 Paul Jakma <paul.jakma@sun.com> * configure.ac: General cleanup of header and type checks, introducing an internal define, QUAGGA_INCLUDES, to build up a list of stuff to include so as to avoid 'present but cant be compiled' warnings. Misc additional checks of things missing according to autoscan. Add LIBM, for bgpd's use of libm, so as to avoid burdening LIBS, and all the binaries, with libm linkage. Remove the bad practice of using m4 changequote(), just quote the []'s in the case statements properly. This should fix bugs 162, 303 and 178. * */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN, * bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
* [zebra] Retain configured IPv4 address upon removal by kernelPaul Jakma2007-04-101-14/+21
| | | | | | | | 2007-04-08 Paul Jakma <paul.jakma@sun.com> * interface.c: (if_delete_update) Address removal triggered by kernel shouldn't remove configured IPv4 address from connected list.
* [PtP over ethernet] New peer flag allows much more addressing flexibilityAndrew J. Schorr2006-12-121-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * if.h: (struct connected) Add new ZEBRA_IFA_PEER flag indicating whether a peer address has been configured. Comment now shows the new interpretation of the destination addr: if ZEBRA_IFA_PEER is set, then it must contain the destination address, otherwise it may contain the broadcast address or be NULL. (CONNECTED_DEST_HOST,CONNECTED_POINTOPOINT_HOST) Remove obsolete macros that were specific to IPv4 and not fully general. (CONNECTED_PEER) New macro to check ZEBRA_IFA_PEER flag. (CONNECTED_PREFIX) New macro giving the prefix to insert into the RIB: if CONNECTED_PEER, then use the destination (peer) address, else use the address field. (CONNECTED_ID) New macro to come up with an identifying address for the struct connected. * if.c: (if_lookup_address, connected_lookup_address) Streamline logic with new CONNECTED_PREFIX macro. * prefix.h: (PREFIX_COPY_IPV4, PREFIX_COPY_IPV6) New macros for better performance than the general prefix_copy function. * zclient.c: (zebra_interface_address_read) For non-null destination addresses, set prefixlen to equal the address prefixlen. This is needed to get the new CONNECTED_PREFIX macro to work properly. * connected.c: (connected_up_ipv4, connected_down_ipv4, connected_up_ipv6, connected_down_ipv6) Simplify logic using the new CONNECTED_PREFIX macro. (connected_add_ipv4) Set prefixlen in destination addresses (required by the CONNECTED_PREFIX macro). Use CONNECTED_PEER macro instead of testing for IFF_POINTOPOINT. Delete invalid warning message. Warn about cases where the ZEBRA_IFA_PEER is set but no destination address has been supplied (and turn off the flag). (connected_add_ipv6) Add new flags argument so callers may set the ZEBRA_IFA_PEER flag. If peer/broadcast address satisfies IN6_IS_ADDR_UNSPECIFIED, then reject it with a warning. Set prefixlen in destination address so CONNECTED_PREFIX will work. * connected.h: (connected_add_ipv6) Add new flags argument so callers may set the ZEBRA_IFA_PEER flag. * interface.c: (connected_dump_vty) Use CONNECTED_PEER macro to decide whether the destination address is a peer or broadcast address (instead of checking IFF_BROADCAST and IFF_POINTOPOINT). * if_ioctl.c: (if_getaddrs) Instead of setting a peer address only when the IFF_POINTOPOINT is set, we now accept a peer address whenever it is available and not the same as the local address. Otherwise (no peer address assigned), we check for a broadcast address (regardless of the IFF_BROADCAST flag). And must now pass a flags value of ZEBRA_IFA_PEER to connected_add_ipv4 when a peer address is assigned. The same new logic is used with the IPv6 code as well (and we pass the new flags argument to connected_add_ipv6). (if_get_addr) Do not bother to check IFF_POINTOPOINT: just issue the SIOCGIFDSTADDR ioctl and see if we get back a peer address not matching the local address (and set the ZEBRA_IFA_PEER in that case). If there's no peer address, try to grab SIOCGIFBRDADDR regardless of whether IFF_BROADCAST is set. * if_ioctl_solaris.c: (if_get_addr) Just try the SIOCGLIFDSTADDR ioctl without bothering to check the IFF_POINTOPOINT flag. And if no peer address was found, just try the SIOCGLIFBRDADDR ioctl without checking the IFF_BROADCAST flag. Call connected_add_ipv4 and connected_add_ipv6 with appropriate flags. * if_proc.c: (ifaddr_proc_ipv6) Must pass new flags argument to connected_add_ipv6. * kernel_socket.c: (ifam_read) Must pass new flags argument to connected_add_ipv6. * rt_netlink.c: (netlink_interface_addr) Copy logic from iproute2 to determine local and possible peer address (so there's no longer a test for IFF_POINTOPOINT). Set ZEBRA_IFA_PEER flag appropriately. Pass new flags argument to connected_add_ipv6. (netlink_address) Test !CONNECTED_PEER instead of if_is_broadcast to determine whether the connected destination address is a broadcast address. * bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete) Simplify logic by using new CONNECTED_PREFIX macro. * ospf_interface.c: (ospf_if_is_configured, ospf_if_lookup_by_prefix, ospf_if_lookup_recv_if) Simplify logic using new CONNECTED_PREFIX macro. * ospf_lsa.c: (lsa_link_ptop_set) Using the new CONNECTED_PREFIX macro, both options collapse into the same code. * ospf_snmp.c: (ospf_snmp_if_update) Simplify logic using new CONNECTED_ID macro. (ospf_snmp_is_if_have_addr) Simplify logic using new CONNECTED_PREFIX macro. * ospf_vty.c: (show_ip_ospf_interface_sub) Use new CONNECTED_PEER macro instead of testing the IFF_POINTOPOINT flag. * ospfd.c: (ospf_network_match_iface) Use new CONNECTED_PEER macro instead of testing with if_is_pointopoint. And add commented-out code to implement alternative (in my opinion) more elegant behavior that has no special-case treatment for PtP addresses. (ospf_network_run) Use new CONNECTED_ID macro to simplify logic. * rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID macro to simplify logic. (rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does not give a useful result if prefixlen is 32 (we require a peer address in such cases). * ripd.c: (rip_update_interface) Fix same bug as above.
* [zebra] Fix forgetfulness wrt configured address on FreeBSDPaul Jakma2006-06-151-0/+2
| | | | | | | | | | | | | | | | 2006-06-15 Paul Jakma <paul.jakma@sun.com> * (general) The key fixes are actually Andrew Schorr's. * interface.c: (ip_address_uninstall) Unset the configured flag. * connected.c: (connected_same) new helper, check whether two connected are same. (connected_implicit_withdraw) new helper, consolidation of existing code in connected_add_ipv{4,6}. Try filter out unneeded Zserv address delete/adds when address is exact same. Where old address is implicitely removed, be sure to preserve the IFC_CONFIGURED flag if set, fixes bug where configured addresses were being lost on FreeBSD.
* [zebra] remove internal if_flag_dump, use libzebras version.Paul Jakma2006-06-151-45/+2
| | | | | | | | | 2006-06-15 Paul Jakma <paul.jakma@sun.com> * lib/if.c: (if_flag_dump) remove the whitespace indentation, callers should provide. * zebra/interface.c: (if_flag_dump_vty) redundant code, remove. (if_dump_vty) use libzebra if_flag_dump.
* [zebra] CID #31, guard against potential NULL return of route_node_lookupPaul Jakma2006-05-111-2/+2
| | | | | | | 2006-05-11 Paul Jakma <paul.jakma@sun.com> * interface.c: (if_delete_update) route_node_lookup may return NULL, should fix Coverity CID #31.
* [zebra] Display flags on their line in 'show interface'.paul2006-02-021-1/+3
| | | | | | 2006-02-02 Paul Jakma <paul.jakma@sun.com> * interface.c: (if_dump_vty) move flags to their line, neater.
* [zebra/solaris] Interface state fixups for Solaris.paul2006-01-251-15/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-01-25 Paul Jakma <paul.jakma@sun.com> * (general) More solaris PF_ROUTE hacks. The IFF_UP mangling for solaris was incomplete on the PF_ROUTE side. fix it. This changeset generally uglifies things. For some future work I'd like to see the state changes seperated out from the details of the code. Differences between systems might then be slightly easier to implement without convoluted hacks. Changes should be specific to Solaris mostly, however also tested on FreeBSD 6. * if_ioctl_solaris.c: (interface_list_ioctl) ignore ~IFF_UP interfaces, we'll hear about them when/if interface goes up through NEWADDR. Update flags explicitely at end of it to kick mangling. * ioctl_solaris.c: (if_mangle_up) removed to interface.c, in kind. (lifreq_set_name) more convenient to take the string, than the ifp. (if_get_flags_direct) new convenience function, returns the actual flags. Used during bootstrap in if_ioctl_solaris.c to peek at flags of logical interfaces to see whether or not to ignore them. (if_get_flags) ENXIO means it's gone, poke out IFF_UP and kick flags update. (if_{un,}set_flags) flags argument should be 64bit. * ioctl.{c,h}: flags argument should be 64bit. * interface.h: Add a 'primary_state' flag to struct zebra_if on SUNOS_5. Export if_flags_update. * interface.c: (if_flags_mangle) moved over in kind from ioctl_solaris.c. Nasty kludge to try get IFF_UP right, as much as is possible. Also keep track of the actual IFF_UP value for the primary interface, so we can know when the ifp must be deleted. (if_flags_update) Take a new interface flags value, apply it to the interface, and take whatever actions are required due to flag transitions. (if_refresh) flag state change logic is moved out to previous. Just call if_get_flags, which will end up using previous to effect the update of flags. (if_flag_dump_vty) IFF_IPV{4,6} aren't interesting, VIRTUAL and NOXMIT are though. * kernel_socket.c: (ifm_read) Down->Down transitions shouldn't create ifp, for non-IFANNOUNCE systems. Use if_flags_update to update flags. flag transition logic is now handled automatically through if_flags_update. (ifam_read) Better to call if_refresh *after* adding connected addresses, as connected count affects IFF_UP on IFF_UP-mangled systems. On Solaris, Up->Down due to DELADDR means we need to delete the ifp - the IFINFO might already have been and gone. * rt.h: include other dependent headers.
* 2005-11-03 Paul Jakma <paul.jakma@sun.com>paul2005-11-031-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * connected.{c,h}: Include memory.h (connected_add_ipv4) Use MTYPE for ifc label. (connected_add_ipv6) Also should accept label. Store it in ifp. (connected_del_ipv4) Taking label as argument is pointless. * rt_netlink.c: (netlink_interface_addr) update label usage for connected_{add,delete} functions. * if_ioctl.c: (if_getaddrs) NULL label for connected_add_ipv6. * if_ioctl_solaris.c: (interface_list_ioctl) Pass LIFC_NOXMIT so we also find out about NOXMIT interfaces like VNI. Bit of hackery to turn interface names into the primary interface name, later with routing socket messages we only will about primary interfaces anyway, so we must normalise the name. (if_get_addr) take label as argument, so it can be passed to connected_add. If label is provided, then it is interface name to issue the ioctl for address information on, not the ifp name. (interface_list) List AF_UNSPEC too, just in case. * if_proc.c: (ifaddr_proc_ipv6) label for connected_add_ipv6. * interface.c: (if_addr_wakeup) Some very bogus code - sets IFF_RUNNING - add comment. (if_refresh) (ip_address_install) Use MTYPE for ifc label. * ioctl_solaris.c: (if_mangle_up) New function. Hackery to make IFF_UP reflect whether any addresses are left on the interface, as we get signalled for IFF_UP flags change on the primary interface only. Logical interfaces dont generate IFINFO, but we do get an RTM_DELADDR. (if_get_flags) Call if_mangle_up before return. * kernel_socket.c: (ifam_read) Fixup calls to connected_{add,delete} to match above changes. Rename gate variable to brd, less confusing. Pass the interface name as a label, if it is not same name as ifp->name.
* 2005-09-12 Paul Jakma <paul.jakma@sun.com>paul2005-09-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * (general) RTM_CHANGE and implicit withdraw on RTM_NEWADDR support. * connected.c: (connected_withdraw) new function. withdraw a connected subnet address set from zebra, and pass information along to clients. (connected_announce) similar, but to announce a new connected subnet address set. (connected_check_ipv4) renamed to connected_check, as its AFI independent. (connected_add_ipv{4,6}) Remove the connected address announce stuff, use connected_announce instead. If connected_check indicates address is already present, treat it as an implicit withdraw of the existing address, ie remove the old address details and replace with the new details. (connected_delete_ipv{4,6}) Use connected_withdraw. (connected_check_ipv6) deleted in favour of connected_check. * connected.h: Rename connected_check_ipv4 to connected_check. delete connected_check_ipv6. * interface.c: Use connected_check rather than the AFI specific symbols. * kernel_socket.c: (rtm_read) RTM_CHANGE support. Create a rib delete event for the existing route, before adding route again. (kernel_read) we can handle RTM_CHANGE now.
* 2005-07-29 Paul Jakma <paul.jakma@sun.com>paul2005-07-291-9/+1
| | | | | | | | | | | | | | | | | | | | * interface.c: (if_delete_update) should always be available, not just on RTM_IFANNOUNCE/NETLINK systems. * kernel_socket.c: (ifan_read) only call if_delete_update when interface departs, dont if_delete, because we wish to retain interface configuration state even when interfaces are removed. (ifm_read) If we dont have RTM_IFANNOUNCE, then transitioning to down state is only chance we have to clean up interface in case it is deleted (eg Solaris down -> unplumb -> plumb up). * redistribute.c: (zebra_interface_delete_update) should always be available, we /will/ call it now on all systems, via if_delete_update. * zserv.c: (zsend_interface_delete) ditto (zsend_interface_address) Update the call-flow diagramme, to reflect that if_delete_update /is/ now called on all systems, potentially. * zserv.h: (zsend_interface_delete) unconditionally exported, as above.
* 2005-06-28 Paul Jakma <paul.jakma@sun.com>paul2005-06-281-15/+15
| | | | | | | * (global) Extern and static'ification, with related fixups of declarations, ensuring files include their own headers, etc. if_ioctl.c: (interface_info_ioctl) fix obvious arg mis-order in list loop
* 2005-04-07 Paul Jakma <paul.jakma@sun.com>quagga_post_listloop_cleanuppaul2005-04-071-27/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
* 2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-04-021-30/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix problems when netlink interfaces are renamed (same ifindex used for a new interface). Start cleaning up some problems with the way interface names are handled. * interface.c: (if_new_intern_ifindex) Remove obsolete function. (if_delete_update) After distributing the interface deletion message, set ifp->ifindex to IFINDEX_INTERNAL. (if_dump_vty) Detect pseudo interface by checking if ifp->ifindex is IFINDEX_INTERNAL. (zebra_interface) Check return code from interface_cmd.func. Do not set internal ifindex values to if_new_intern_ifindex(), since we now use IFINDEX_INTERNAL for all pseudo interfaces. * kernel_socket.c: (ifm_read) Fix code and comments to reflect that all internal interfaces now have ifp->ifindex set to IFINDEX_INTERNAL. * rt_netlink.c: (set_ifindex) New function used to update ifp->ifindex. Detects interface rename events by checking if that ifindex is already being used. If it is, delete the old interface before assigning the ifindex to the new interface. (netlink_interface, netlink_link_change) Call set_ifindex to update the ifindex. * if.h: Remove define for IFINDEX_INTERNBASE and add define IFINDEX_INTERNAL 0, since all internal (i.e. non-kernel) pseudo- interfaces should have ifindex set to 0. (if_new) Remove function. (if_delete_retain) New function to delete an interface without removing from iflist and freeing the structure. (ifname2ifindex) New function. * if.c: (if_new) Remove function (absorb into if_create). (if_create) Replace function if_new with call to calloc. Set ifp->ifindex to IFINDEX_INTERNAL. Fix off-by-one error in assert to check length of interface name. Add error message if interface with this name already exists. (if_delete_retain) New function to delete an interface without removing from iflist and freeing the structure. (if_delete) Implement with help of if_delete_retain. (ifindex2ifname) Reimplement using if_lookup_by_index. (ifname2ifindex) New function to complement ifindex2ifname. (interface) The interface command should check the name length and fail with a warning message if it is too long. (no_interface) Fix spelling in warning message. (if_nametoindex) Reimplement using if_lookup_by_name. (if_indextoname, ifaddr_ipv4_lookup) Reimplement using if_lookup_by_index. * bgp_zebra.c: (bgp_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL. * isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead of if_delete, since it is generally not safe to remove interface structures. After deleting, set ifp->ifindex to IFINDEX_INTERNAL. (zebra_interface_if_lookup) Tighten up code. * ospf6_zebra.c: (ospf6_zebra_if_del) Previously, this whole function was commented out. But this is not safe: we should at least update the ifindex when the interface is deleted. So the new version updates the interface status and sets ifp->ifindex to IFINDEX_INTERNAL. (ospf6_zebra_route_update) Use if_indextoname properly. * ospf_vty.c: (show_ip_ospf_interface_sub) Show ifindex and interface flags to help with debugging. * ospf_zebra.c: (ospf_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL. (zebra_interface_if_lookup) Make function static. Tighten up code. * rip_interface.c: (rip_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL. * ripng_interface.c: (ripng_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL.
* 2005-03-25 Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>vincent2005-03-251-2/+21
| | | | | * interface.c, interface.h, rtadv.c, rtadv.h: extensions to Neighbor discovery for Mobile IPv6.
* * zebra/interaface.c: "show interface description" commandhasso2005-03-131-0/+47
| | | | implemented.
* * interface.c: Fix CRC and frame errors statistics in Linux.hasso2005-03-061-1/+1
|
* * interface.c: Better statistics output in "show interface" command inhasso2005-01-181-13/+15
| | | | | case of /proc being used. I don't have others to test with at the moment.
* 2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-071-4/+4
| | | | * *.c: Change level of debug messages to LOG_DEBUG.
* 2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-201-6/+6
| | | | | * global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration.
* Remove dead "ip tunnel" command.hasso2004-10-281-23/+0
|
* OK. Here it is - PtP patch from Andrew J. Schorr. No problems with ospfd,hasso2004-10-191-4/+2
| | | | ripd might need some more testing though.
* Some compiler warnings fixes and fix for bugzilla #119.hasso2004-10-121-8/+20
|
* New way to handle secondary addresses from Gilad Arnold.hasso2004-10-031-79/+184
|
* Remove usage of evil list and listnode typedefs.hasso2004-09-231-8/+8
|