summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
AgeCommit message (Collapse)Author
2006-01-17[zebra] Record NEWADDR metric on PF_ROUTE, print CACHEINFO debug on netlinkpaul
2006-01-17 Paul Jakma <paul.jakma@sun.com> * kernel_socket.c: (ifam_read) Read metric from RTM_NEWADDR. If interface is an alias, pass the alias as a label for connected_add_ipv{4,6}. * rt_netlink.c: (netlink_interface_addr) print out IFA_CACHEINFO info, if present, when debugging kernel messages.
2005-11-23[zebra] fix some small compile errors, mark several functions staticpaul
2005-11-23 Paul Jakma <paul.jakma@sun.com> * (general) fix some small compile errors, and mark several functions as static. * kernel_socket.c: (ifan_read) should be static. fix missing brackets. (ifm_read,ifam_read,rtm_read_mesg,kernel_read) Make static (ifam_read_mesg) make static. fix incorrect variable name. (rtm_read) make static. Fix call to rib_delete_ipv4 which should be rib_delete_ipv6. (routing_socket,kernel_init) should be static. Void argument should be specified as such, not left incomplete. * rt_netlink.c: rt.h should be included, contains prototypes of exported functions. (kernel_delete_ipv6_old) fix sign of index argument. * rt_socket.c: Exact same as previous. Also, make various functions static. * rtread_getmsg.c: Include zserv.h, which prototypes route_read. Make static. * rtread_sysctl.c: zserv.h and rt.h should be included. fix definition of route_read.
2005-11-032005-11-03 Paul Jakma <paul.jakma@sun.com>paul
* 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-10-012005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* rt_netlink.c: (netlink_request) Use memset to clear structure before calling sendto (eliminates a valgrind error message about uninitialized data).
2005-08-27 * zebra_rib.c, rib.h: Add distance and metric arguments to thehasso
rib_add_ipv6() function so that IPv6 routes in RIB can have correct metric. No IPv6 routing daemon uses distance yet though. * zserv.c, connected.c, kernel_socket.c, rt_netlink.c, rtread_proc.c,zserv.c: Pass metric and distance info to the rib_add_ipv6(). Forwardport from stable branch.
2005-06-12 * rt_netlink.c: Remove unused netlink-addr socket declaration.hasso
* rt_netlink.c (netlink_parse_info): Fix debug messages - nlmsg_pid is unsigned and one zlog call had swapped arguments. * rt_netlink.c (netlink_route_multipath): Fix compile with disabled IPv6 support. [backport candidate] - with stuff commited to rt_netlink.c before to fix logging in netlink_route_multipath().
2005-04-09 * rt_netlink.c: One tiny missing comma caused pointless debug messageshasso
about IPv6 nexthops.
2005-04-09 * rt_netlink.c (netlink_parse_info): Fix warning. It's safe to casthasso
status to unsigned here, because we already checked that it isn't negative or 0. * rt_netlink.c (netlink_interface_addr): Prefix length belongs to the address, not to the interface. * rt_netlink.c (netlink_route_multipath): Fix debug. No useless info is printed out now and IPv6 info is handeled.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
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-31 * rt_netlink.c (netlink_talk_filter): Show always warning message,hasso
it's not for debug. * rt_netlink.c (netlink_talk): Don't assume we use netlink_cmd although we do now actually. * rt_netlink.c (netlink_route, netlink_route_multipath): Always use netlink_cmd to send messages to the kernel. [backport candidate]
2005-03-292005-03-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* rt_netlink.c: (netlink_link_change) If the status of an operative interface changes (e.g. MTU changes), the client daemons should be notified by calling zebra_interface_up_update. Previously, the information was being updated in zebra's interface structure, but the clients were not notified of changes to an operative interface. * ospf_zebra.c: (ospf_interface_state_up) If the MTU of an operative interface changes, print a debug message and call ospf_if_reset() to simulate down/up on the interface. * ospf_interface.h: Declare new function ospf_if_reset(). * ospf_interface.c: (ospf_if_reset) New function to call ospf_if_down and ospf_if_up for all ospf interfaces attached to an interface.
2005-03-122005-03-12 Paul Jakma <paul@dishone.st>paul
* rt_netlink.c: (netlink_route_multipath) dont set equalise flag. No stock Linux kernel has ever supported it, and even if it had
2005-02-20 * rt_netlink.c: Don't show messages "ignoring message type 0x001[89]"hasso
if we are not debugging.
2005-02-142005-02-14 Paul Jakma <paul@dishone.st>paul
* Not all Linux netlink systems have IFLA_WIRELESS
2005-01-292005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* rt_netlink.c: (netlink_socket,netlink_request,netlink_parse_info, netlink_talk) Save errno before calling zserv_privs.change. [backport candidate]
2005-01-242005-01-24 Martin Pot <mpot at martybugs.net>paul
* zebra/rt_netlink.c: ignore wireless newlink netlink messages.
2004-12-072004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* *.c: Change level of debug messages to LOG_DEBUG.
2004-11-202004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration.
2004-10-19OK. Here it is - PtP patch from Andrew J. Schorr. No problems with ospfd,hasso
ripd might need some more testing though.
2004-10-07Fix warnings. Didn't even look at files not compiled in Linux though.hasso
2004-09-26Compiler warnings fixes.hasso
2004-08-31Commit my hack (yes, I still call it hack) - command line switch for zebrahasso
daemon to change netlink receive buffer size.
2004-08-06Remove pointless privilege lower call. Thanks to Cougar for noticing.hasso
2004-05-092004-05-09 Paul Jakma <paul@dishone.st>paul
* ioctl.c: (if_get_mtu) set mtu6 to mtu * mtu_kvm.c: (if_kvm_get_mtu) set mtu6 to mtu * rt_netlink.c: (netlink_interface) set mtu6 to mtu (netlink_link_change) ditto 2004-05-09 Sowmini Varadhan <sowmini.varadhan@sun.com> * interface.c: (if_delete_update) only used with HAVE_NETLINK and RTM_IFANNOUNCE. (if_flag_dump_vty) Solaris IFF_IPV4 and IFF_IPV6 if flags (if_dump_vty) print mtu6 if not same as mtu
2004-04-06[quagga-dev 1002]. Also fix date of previous commit in Chanelog.hasso
2004-03-04Fix warning. Approved by Amir.hasso
2003-11-172003-11-17 Jay Fenlason <fenlason@redhat.com>paul
* zebra/rt_netlink.c: netlink_parse_info() ignore messages which are not from kernel. Reported to RH by Herbert Xu. See http://rhn.redhat.com/errata/RHSA-2003-307.html and CAN-2003-0858.
2003-09-292003-09-29 Paul Jakma <paul@dishone.st>paul
* zebra/connected.c: revert the 'generic PtP' patch as it causes far too many problems. People who use FreeSWAN should investigate native linux ipsec. * zebra/rt_netlink.c: ditto * lib/if.c: ditto * ripd/ripd.h: ditto * ripd/ripd.c: ditto * ripd/rip_interface.c: ditto * ospfd/ospfd.c: ditto * ospfd/ospf_snmp.c: ditto * bgpd/bgp_nexthop.c: ditto
2003-07-152003-07-15 Paul Jakma <paul@dishone.st>paul
* lib/version.h: add ZEBRA_URL (unused for now) * lib/vty.c: CMD_ERR_NOTHING_TODO when reading conf file should not be fatal. slight reformating. * ospfd/ospf_zebra.c: ignore reject/blackhole routes if zebra sends these type of routes. probably should be a new type of route to allow daemons to more easily choose whether to redistribute them - rathen than just a flag (eg for reject/blackhole). reorder the is_prefix_default test for ZEBRA_IPV4_ROUTE_DELETE to avoid the inverted test - slightly more readable. * redhat/zebra.spec.in: Add ospfapi port to services file, if with_ospfapi. * zebra/rib.h: Change nexthop types to an enum. * zebra/rt_netlink.c: run it through indent -nut. Add nexthop_types_desc[] descriptive array for nexthop types. (netlink_route_multipath) debug statements indicate which branch they are in and print out nexthop type. * zebra/zebra_rib.c: slight reformatting. * zebra/zebra_vty.c: Pass ZEBRA_FLAG_BLACKHOLE flag to static_add_ipv4() if Null0 route is configured. print out Null0 if STATIC_IPV4_BLACKHOLE route, and ignore flags (shouldnt be possible to set flags from vty) for config and show route.
2003-06-192003-06-19 Vladimir Ivaschenko <hazard@francoudi.com>paul
* zebra/rt_netlink.c: Debug statements added to netlink_route_multipath() * zebra/zebra_rib.c: If route has a gateway, delete only existing route with that specified gateway.
2003-06-152003-06-15 Paul Jakma <paul@dishone.st>paul
* lib/vty.{c,h}: Remove vty layer depending on a 'master' global, pass the thread master in explicitly to vty_init. Sort out some header dependency problems with lib/command.h * zebra/: Move globals to struct zebrad. Update vty_init(). * (.*)/\1_main.c: update call to vty_init().
2003-06-042003-06-04 Paul Jakma <paul@dishone.st>paul
* Merge of zebra privileges
2003-05-25Add back support for null0 interface blackhole routes.paul
2003-05-25Route (reject|blackhole) support from 6Wind patch.hasso
2003-04-19From: Israel Keys <ikeys@agile.tv>paul
Subject: [zebra 18677] zebra initialisation bug and patch Hi All, I have found a bug in zebra that prevents its routing table and interface database from being initialised properly. The problem occurs when a request is made via the netlink socket but the kernel produces a EWOULDBLOCK/EAGAIN when the result is trying to be retrieved via a recvmsg(). Zebra does not do anything about this and continues to function (with an empty routing table and interface list) as if nothing has happened. With no such information the routing protocol dosn't work! Two functions are called during the initialisation of Zebra: interface_lookup_netlink() and netlink_route_read() - obtaining the interfaces and routing table from the kernel respectively. These are the only time these functions are called. These functions, interface_lookup_netlink() and netlink_route_read(), use netlink_parse_info() to recieve the data from the netlink socket. The problem is, netlink_parse_info() returns (without error) when its call to recvmsg() results in an errno EWOULDBLOCK/EAGAIN. This behaviour is expected by other funtions calling netlink_parse_info() - netlink_parse_info is simply recalled at a later stage. However, on initialisation it is never recalled. Since zebra is expected to nothing else during initialisation it was easiest to temporarily change the netlink socket to BLOCK and wait indefinently until the kernel responds with the required information. Attached is a patch with these changes. Comments and questions are welcome. Please inform me if this patch is added to the Zebra source. --israel
2003-02-07Sync to latest Zebra CVSpaul
2003-01-22Matthew Grant <grantma@anathoth.gen.nz>paul
Subject: [zebra 17290] [PATCHES] - Fixes for problems in 0.93b Added ifupstaticfix
2003-01-19Add work around for RFC3021 patch and its problem with certain IPv6 interfacespaul
addresses. It seems so far that netlink only ever returns IFA_ADDRESS for IPv6 interfaces and never IFA_LOCAL, regardless of whether it is PtP or not. Need to investigate precisely how IPv6 and netlink are supposed to behave wrt broadcast vs PtP links.
2003-01-17From havanna_moon@gmx.net Fri Jan 17 23:37:49 2003paul
Date: Sat, 11 Jan 2003 23:26:28 +0100 (CET) From: Yon Uriarte <havanna_moon@gmx.net> To: "the list(tm) Zebra" <zebra@zebra.org> Subject: [zebra 17217] [PATCH] show thread CPU Hi, a little patch from the 'stupid preprocessor tricks' collection to record thread statistics. Usage: "show thread cpu [r][w][t][e][x]" Output Fields: self explaining I hope. Type is one of RWTEX for: Read, Write (fd threads), Timer, Event, Execute. Overhead vs. vanilla zebra: almost nothing. Vanilla CVS zebra already collects thread run times. Caveats: Under linux getrusage has a granularity of 10ms, which is almost useless in this case. Run ./configure, edit config.h and comment out "#define HAVE_RUSAGE", this way it will use getimeofday which has a much better granularity. IMHO this is better, as cooperative threads are effectively running during all that wall time (dont care if CPU utilization was 3% or 99% during the time the thread was running (an effective rusage combined with getimeofday could give that info)). Maybe someone can give tips for other platforms on API granularity. TODO: change some of the calls to thread_add_$KIND to funcname_thread_add_$KIND with a meaningfull funcname, so users will get a better idea of what's going on. F.ex. (AFAIK): ospf_spf_calculate_timer -> "Routes Step 1, areas SPF" ospf_ase_calculate_timer -> "Routes Step 2, externals" Could this be added to the unofficial patch collection? Could someone with BGP keepalive problems run their bgpd with this patch and post the results? TIA, HTH, HAND, regards yon Example output: -------------------------------- ospfd# show thread cpu Runtime(ms) Invoked Avg uSecs Max uSecs Type Thread 14.829 31 478 585 T ospf_ase_calculate_timer 82.132 9838 8 291 EX ospf_nsm_event 0.029 1 29 29 E ospf_default_originate_timer 0.254 9 28 34 T ospf_db_desc_timer 0.026 7 3 11 T ospf_wait_timer 669.015 523 1279 490696 R vty_read 4.415 45 98 173 TE ospf_network_lsa_refresh_timer 15.026 31 484 588 T ospf_spf_calculate_timer 29.478 1593 18 122 E ospf_ls_upd_send_queue_event 0.173 1 173 173 T vty_timeout 4.173 242 17 58 E ospf_ls_ack_send_event 637.767 121223 5 55 T ospf_ls_ack_timer 39.373 244 161 2691 R zclient_read 12.169 98 124 726 EX ospf_ism_event 0.226 2 113 125 R vty_accept 537.776 14256 37 3813 W ospf_write 4.967 41 121 250 T ospf_router_lsa_timer 0.672 1 672 672 E zclient_connect 7.901 1658 4 26 T ospf_ls_req_timer 0.459 2 229 266 E ospf_external_lsa_originate_timer 3.203 60 53 305 T ospf_maxage_lsa_remover 108.341 9772 11 65 T ospf_ls_upd_timer 33.302 525 63 8628 W vty_flush 0.101 1 101 101 T ospf_router_lsa_update_timer 0.016 1 16 16 T ospf_router_id_update_timer 26.970 407 66 176 T ospf_lsa_maxage_walker 381.949 12244 31 69 T ospf_hello_timer 0.114 22 5 14 T ospf_inactivity_timer 34.290 1223 28 310 T ospf_lsa_refresh_walker 470.645 6592 71 665 R ospf_read 3119.791 180693 17 490696 RWTEX TOTAL ospfd# bgpd# sh t c TeX Runtime(ms) Invoked Avg uSecs Max uSecs Type Thread 21.504 476 45 71 T bgp_keepalive_timer 17.784 1157 15 131 T bgp_reuse_timer 29.080 193 150 249 T bgp_scan 23.606 995 23 420 E bgp_event 317.734 28572 11 69 T bgp_routeadv_timer 0.084 1 84 84 E zlookup_connect 0.526 1 526 526 E zclient_connect 1.348 13 103 147 T bgp_start_timer 19.443 142 136 420 T bgp_connect_timer 16.032 772 20 27 T bgp_import 447.141 32322 13 526 TEX TOTAL bgpd# bgpd# show thread cpu rw Runtime(ms) Invoked Avg uSecs Max uSecs Type Thread 155.043 7 22149 150659 R bgp_accept 129.638 180 720 53844 R vty_read 1.734 56 30 129 R zclient_read 0.255 2 127 148 R vty_accept 58.483 983 59 340 R bgp_read 171.495 29190 5 245 W bgp_write 13.884 181 76 2542 W vty_flush 530.532 30599 17 150659 RW TOTAL bgpd# --------------------------------
2002-12-13[zebra 14631] Generic PtP and RFC3021 interface addressing supportpaul
2002-12-13zebra link state detection supportpaul
2002-12-13Initial revisionpaul