summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
AgeCommit message (Collapse)Author
2012-01-23zebra: IPv6 MP-BGP Routes addition and deletionG.Balaji
This patch contains the following: 1. Addition of IPv6 SAFI_MULTICAST BGP routes into the RTM's RIB. 2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the RTM's RIB.
2012-01-23zebra: IPv4 MP-BGP Routes addition and deletionG.Balaji
This patch contains the following: 1. Addition of IPv4 SAFI_MULTICAST BGP routes into the RTM's RIB. 2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the RTM's RIB.
2012-01-02zebra: ZEBRA_HELLO and mopping up routes (BZ#448)Vyacheslav Trushkin
ZEBRA_HELLO message is used by routing daemons to inform zebra what type of routes daemon will be announcing to zebra. Also zebra uses route_type_oaths array to track which daemon announces which protocol. Zebra mops up routes if daemon didn't for some reason.
2011-12-13quagga: option "-z" ("--socket <path>") addedVyacheslav Trushkin
All daemons modified to support custom path to zserv socket. lib: generalize a zclient connection zclient_socket_connect added. zclient_socket and zclient_socket_un were hidden under static expression. "zclient_serv_path_set" modified.
2010-08-19Zebra zserv: bogus conditionalStephen Hemminger
This looks like a bug in original code from misunderstanding of C rules of evaluation.
2009-07-24[zebra] do not touch socket before pidfile lockingDenis Ovsienko
Move zserv socket creation code into zebra_zserv_socket_init() and call it only after pidfile lock has been acquired exclusively. This keeps subsequent zebra daemons from deleting the working socket of an already running process (bug #403).
2009-06-23[zebra] linux policy routing support with ipv6Mathieu Goessens
Quagga support linux policy routing (ip route ... table $X) with zebra.conf table $X option. It works fine on ipv4. On ipv6 the parameter is ignored (table 0 is used). * zebra/...: Pass appropriate table arg to rib_{add,delete}_ipv6
2009-06-12[cleanup] Make command nodes staticStephen Hemminger
The cmd_nodes used to configure vty, can mostly be static so (basic data hiding 101).
2007-05-10[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warningsPaul Jakma
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().
2007-05-02[zebra] Routemap support on received routes, with 'set src' command (linux)Paul Jakma
2007-05-01 David L Stevens <dlstevens@us.ibm.com> * (general) These changes collectively add route-map and prefix-list support to zebra and fix a bug in "show route-map" (with no argument). * doc/main.texi: added route-map, prefix-list, ip protocol and set src documentation * lib/command.h: added PROTOCOL_NODE type * lib/log.c: (proto_name2num) new function, protocol name to number translation. * lib/routemap.c: (vty_show_route_map) fixed "show route-map" without route-map name * lib/routemap.h: added RMAP_ZEBRA type * lib/zebra.h: added proto_name2num() prototype * vtysh/extract.pl.in: added VTYSH_ZEBRA flag for route-map and plist * vtysh/Makefile.am: added zebra_routemap.c * vtysh/vtysh.h: added VTYSH_ZEBRA flag to VTYSH_RMAP * zebra/connected.c: (connected_up_ipv4) added src preference argument to rib_add_ipv4() * zebra/kernel_socket.c: (rtm_read) ditto * zebra/main.c: added prefix list initialization * zebra/Makefile.am: added zebra_routemap.c source file * zebra/rib.h: added generic address union "g_addr" and use in existing places that had an explicit union. Added "src" to struct nexthop. Added preferred src arg to nexthop_ipv4_add and rib_add_ipv4. * zebra/rt_netlink.c: (netlink_routing_table) set preferred source on netlink messages. (netlink_route_change) ditto (netlink_route_multipath) ditto. * zebra/rtread_getmsg.c: (handle_route_entry) added (NULL) src to rib_add_ipv4() call. * zebra/rtread_proc.c: (proc_route_read) ditto * zebra/zebra_rib.c: (nexthop_ipv4_add) add src argument. (nexthop_ipv4_ifindex_add) ditto (rib_add_ipv4) ditto (nexthop_active_check) Add route-map processing. * zebra/zebra_routemap.c: new file for zebra route-map commands. * zebra/zebra_vty.c: (ip_protocol_cmd) Apply route-map to protocol (vty_show_ip_route_detail) added "src" printing (vty_show_ip_route) ditto (show_ip_protocol_cmd) new command, list routemaps. (config_write_protocol) write out routemap protocl config. (zebra_vty_init) Install the new routemap protocol commands. * zebra/zserv.c: (zread_ipv4_add) added (NULL) src arg (zebra_init) init zebra route-maps. * zebra/zserv.h: add zebra_route_map_init
2006-07-27[zebra] Connected routes must always be added to main tablePaul Jakma
2006-07-27 Rumen Svobodnikov <rumen@telecoms.bg> * connected.c: (connected_up_ipv4) interface connected routes always go to table main (or otherwise they cannot be used by linux as nexthops) * zserv.c: (zread_ipv4_add) send route to the correct routing table * zebra_rib.c (static_install_ipv4) set routing table
2006-05-15[zebra] Remove private command string tablePaul Jakma
2006-05-15 Paul Jakma <paul.jakma@sun.com> * zserv.c: (general) Remove the private zebra_command_str in favour of newly added libzebra zserv_command_string.
2006-01-19[compiler] miscellaneous trivial compiler warning fixespaul
2006-01-19 Paul Jakma <paul.jakma@sun.com> * (general) various miscellaneous compiler warning fixes. Remove redundant break statements from switch clauses which return. return from main, not exit, cause it annoys SOS. Remove stray semi-colons which cause empty-statement warnings. * zebra/main.c: (sighup) remove private declaration of external function.
2006-01-16[zserv] Extend Zserv header with version information and marker fieldpaul
2006-01-16 Paul Jakma <paul.jakma@sun.com> * lib/zclient.h: Update the Zserv protocol header with a version field. Define the old command field to be a 'marker', to allow old Zserv and updated Zserv to be differentiated. Future updates will bump the version field obviously. New command field is made wider. Try to stop using the 'zebra_size_t' typedef in the callbacks. * lib/zclient.c: Update to read/write new format header. * zebra/zserv.c: Ditto
2006-01-11[zserv] Update interface flags to 8 bytes wide.paul
2006-01-11 Paul Jakma <paul.jakma@sun.com> * if.h: (struct interface) expand flags to 8 bytes. * zclient.c: (zebra_interface_{add,state}_read) stream read of interface flags now need to use stream_getq. (zebra_interface_if_set_value) ditto 2006-01-11 Paul Jakma <paul.jakma@sun.com> * zserv.c: (zsend_interface_{add,delete,update}) if flags are 8 bytes now, update to write out with stream_putq.
2005-09-292005-09-29 Alain Ritoux <alain.ritoux@6wind.com>vincent
* lib/filer.c: show protocol name in filter_show() * lib/plist.c: show protocol name in vty_show_prefix_entry() * routemap.c: show protocol name in vty_show_route_map_entry() * lib/vty.c: in vty_command(), show protocol name if command unknown * zebra/zserv.c: Always provide distance fo route add * ripd/rip_snmp.c: rip2IfConfReceive() sends values in conformance with RFC. Also PeerDomain is now set to a STRING type. * ripd/ripd.h: rip_redistribute_add() API includes metric and distance * ripd/ripd.c: rip_redistribute_add() API i.e. stores metric and distance Now allows a RIP-route to overcome a redistributed route coming from a protocol with worse (higher) administrative distance Metrics from redistribution are shown in show ip rip * ripd/rip_zebra.c: adapt to the rip_redistribute_add() API, i.e. provide distance and metric * ripd/rip_interface.c: adapt to the rip_redistribute_add() API * ripd/rip_routemap.c: no RMAP_COMPILE_ERROR on (metric > 16) usage rather a CMD_WARNING, because set metric ius shared with other protocols using larger values (such as OSPF) The match metric action takes first external metric if present (from redistribution) then RIP metric.
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-07-292005-07-29 Paul Jakma <paul.jakma@sun.com>paul
* 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-282005-06-28 Paul Jakma <paul.jakma@sun.com>paul
* (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-05-312005-05-31 Paul Jakma <paul.jakma@sun.com>paul
* zserv.c: (zsend_route_multipath) Fix bug if route is sent with no NEXTHOP_FLAG_FIB nexthops. As ZAPI_MESSAGE_IFINDEX and ZAPI_MESSAGE_NEXTHOP are always set, clients would try read non-existent nexthop information and hit stream assert. Zserv is still broken for multi-nexthop messages, but it always was.
2005-04-282005-04-28 Paul Jakma <paul.jakma@sun.com>paul
* rib.h: (struct rib) Add lock field for refcounting. * zserv.h: (struct zebra_t) Add a ribq workqueue to the zebra 'master' struct. * zserv.c: (zread_ipv4_add) XMALLOC then memset should be XCALLOC. * zebra_rib.c: Clean up refcounting of route_node, make struct rib refcounted and convert rib_process to work-queue. In general, rib's should be rib_addnode'd and delnode'd to route_nodes, and these symmetrical functions will manage the locking of referenced route_node and freeing of struct rib - rather than having users manage each seperately - with much scope for bugs.. (newrib_free) removed and replaced with rib_lock (rib_lock) new function, check state of lock and increment. (rib_unlock) new function, check lock state and decrement. Free struct rib if refcount hits 0, freeing struct nexthop's, as newrib_free did. (rib_addnode) Add RIB to route_node, locking both. (rib_delnode) Delete RIB from route_node, unlocking each. (rib_process) Converted to a work-queue work function. Functional changes are minimal, just arguments, comments and whitespace. (rib_queue_add_qnode) Helper function to setup a ribq item. (rib_queue_add) Helper function, same arguments as old rib_process, to replace in callers of rib_process. (rib_queue_qnode_del) ribq deconstructor. (rib_queue_init) Create the ribq. (rib_init) call rib_queue_init. (remainder) Sanitise refcounting of route_node's. Convert to rib_queue_add, rib_addnode and rib_delnode. Change XMALLOC/memset to XCALLOC. Remove calls to nexthop_delete and nexthop_free.
2005-04-102005-04-10 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zserv.c (zebra_client_read): Fix bug: first read attempt should read ZEBRA_HEADER_SIZE minus the number of bytes already read. Improve efficiency by maintaining a calculation of the number of bytes read instead of calling stream_get_endp multiple times. If message length is too small, issue a warning message (not debug) before closing the connection. And also check that message length is not too big.
2005-04-072005-04-07 Paul Jakma <paul.jakma@sun.com>paul
* (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-052004-04-05 Paul Jakma <paul@dishone.st>paul
* lib/vty.c: Improve logging of failures to open vty socket(s). See bugid #163. * zebra/zserv.c: print more helpful errors when we fail to successfully bind and listen on zserv socket. Closes bugzilla #163.
2005-02-282005-02-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zserv.c: Must include network.h and buffer.h for non-blocking I/O. Remove global message_queue and t_write (need separate buffering for each client). (zebra_server_dequeue,zebra_server_enqueue) Remove functions related to old buggy buffering code. (zserv_delayed_close) New thread callback function to delete a client. (zserv_flush_data) New thread callback function to flush buffered data to client. (zebra_server_send_message) Rewritten to use buffer_write (so buffering of writes and non-blocking I/O work properly). (zsend_interface_add,zsend_interface_delete,zsend_interface_address, zsend_interface_update) Return 0 instead of -1 if !client->ifinfo (this is not really an error). Return value from zebra_server_send_message. (zsend_route_multipath,zsend_ipv4_nexthop_lookup, zsend_ipv4_import_lookup) Return value from zebra_server_send_message. (zsend_ipv6_nexthop_lookup) Fix scope to static, and return value from zebra_server_send_message. (zsend_router_id_update) Must use zebra_server_send_message instead of deprecated writen function. Return 0 instead of -1 if this client is not subscribed to router-id updates (since this is not really an error). (zread_interface_add) Change type to static int. If zsend_interface_add fails or zsend_interface_address fails, return -1 immediately (since the client has had an I/O error). (zread_interface_delete,zread_ipv4_add,zread_ipv4_delete, zread_ipv6_add,zread_ipv6_delete,zread_router_id_delete) Return 0 to indicate success. (zread_ipv4_nexthop_lookup) Return value from zsend_ipv4_nexthop_lookup. (zread_ipv4_import_lookup) Return value from zsend_ipv4_import_lookup. (zebra_read_ipv6) Remove unused function. (zread_ipv6_nexthop_lookup) Return value from zsend_ipv6_nexthop_lookup. (zread_router_id_add) Return value from zsend_router_id_update. (zebra_client_close) Call buffer_free(client->wb) and thread_cancel(client->t_suicide). (zebra_client_create) Allocate client->wb using buffer_new. (zebra_client_read) Support non-blocking I/O by using stream_read_try. Use ZEBRA_HEADER_SIZE instead of 3. (zebra_accept) Fix bug: reset accept thread at top. Make client socket non-blocking using the set_nonblocking function. (config_write_forwarding) Fix scope to static. (zebra_init) Remove initialization code for old buggy write buffering. * zserv.h: Add 2 new fields to struct zserv: struct buffer *wb (to enable buffered writes with non-blocking I/), and struct thread *t_suicide to support delayed close on I/O errors. * router-id.h: Remove prototypes for zread_router_id_add and zread_router_id_delete (their scope should be static to zserv.c).
2005-02-192005-02-19 Paul Jakma <paul@dishone.st>paul
* zserv.c: (zebra_read_ipv6) replace the char * arithmetic with STREAM_READABLE.
2005-02-092005-02-09 Paul Jakma <paul.jakma@sun.com>paul
* (global) Update code to match stream.h changes. stream_get_putp effectively replaced with stream_get_endp. stream_forward renamed to stream_forward_getp. stream_forward_endp introduced to replace some previous setting/manual twiddling of putp by daemons. * lib/stream.h: Remove putp. Update reference to putp with endp. Add stream_forward_endp, which daemons were doing manually. Rename stream_forward to stream_forward_getp. lib/stream.c: Remove/update references to putp. introduce stream_forward_endp.
2005-01-052005-01-05 Paul Jakma <paul@dishone.st>paul
* zserv.c: (zebra_accept) Comment out setting of socket to NONBLOCK for now, as we dont actually deal with with resending.... See bugzilla #122, fix from wawa@yandex-team.ru (Vladimir Ivanov). * kernel_socket.c: (routing_socket) ditto.
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-19Fix regression. It seems to me that this code still works only by accidenthasso
though. Needs serious cleanup.
2004-10-13* zserv.c: Remove useless warnings "forwarding is already on".hasso
2004-10-07Fix warnings. Didn't even look at files not compiled in Linux though.hasso
2004-10-03Common router id.hasso
2004-09-23Remove usage of evil list and listnode typedefs.hasso
2004-09-222004-09-22 Paul Jakma <paul.jakma@sun.com>paul
* zserv.c: (zsend_route_multipath) fix nasty bad memset of struct in_addr to sizeof(struct in6_addr), causing odd and hard to debug crash.
2004-08-232004-08-23 Paul Jakma <paul@dishone.st>paul
* zebra/zserv.c: (zebra_init) remove implicit ip forward enabling * NEWS: warn about forwarding change
2004-05-092004-05-09 Paul Jakma <paul@dishone.st>paul
* zserv.c: (zsend_route_multipath) Set the nexthop_num field correctly. Add NEXTHOP_TYPE_IPV6_IFNAME for v6. Conditionally set ZAPI_MESSAGE_METRIC flag - only for adds. (zsend_ipv4_add) cruft, deleted. (zsend_ipv4_delete) ditto. (zsend_ipv6_add) ditto. (zsend_ipv6_delete) ditto. 2004-05-09 Sowmini Varadhan <sowmini.varadhan@sun.com> * zserv.c: (zsend_ipv{4,6}_{add,delete}_multipath) collapsed into single zsend_route_multipath function. (zsend_interface_{up,down}) collapsed into zsend_interface_update. (zsend_interface_address_{add,delete}) collapsed into zsend_interface_address. (zsend_interface_add) send mtu6. (zsend_interface_delete) ditto. (zebra_write) remove unused function. (various) Apply static qualifier. Add comments. * zserv.h: Definitions changed as per above. * redistribute.c: Changes as per zserv.c.
2004-04-06* Fixed lowering privileges in proc ipforward method.hasso
* Fixed "(no) ipv6 forwarding" command logic. * Added --disable-capabilities switch to configure.
2004-03-04Many warning fixes from PC Drew ([quagga-dev 940]) and removing using PAGERhasso
from vtysh ([quagga-dev 932]).
2004-02-11Added "ipv6 forwarding" command and fixed "no ipv6 forwarding" help.hasso
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-25Last fixes from 6Wind patch.hasso
2003-05-25Route (reject|blackhole) support from 6Wind patch.hasso
2003-05-25"ip forwarding" command. Patch from Jim Crumpler.hasso
2003-03-01Sync to Zebra.org 20030301paul
2002-12-13zebra link state detection supportpaul
2002-12-13Initial revisionpaul