From b9df2d25fc8d06ca63fa792d162d97656361338b Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 9 May 2004 09:09:59 +0000 Subject: 2004-05-09 Paul Jakma * 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 * 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. --- zebra/zserv.c | 696 +++++++++++++++++----------------------------------------- 1 file changed, 202 insertions(+), 494 deletions(-) (limited to 'zebra/zserv.c') diff --git a/zebra/zserv.c b/zebra/zserv.c index c623151e..3c582afb 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -45,12 +45,12 @@ enum event { ZEBRA_SERV, ZEBRA_READ, ZEBRA_WRITE }; extern struct zebra_t zebrad; -void zebra_event (enum event event, int sock, struct zserv *client); +static void zebra_event (enum event event, int sock, struct zserv *client); extern struct zebra_privs_t zserv_privs; /* For logging of zebra meesages. */ -char *zebra_command_str [] = +static char *zebra_command_str [] = { "NULL", "ZEBRA_INTERFACE_ADD", @@ -172,6 +172,16 @@ zebra_server_send_message (int sock, u_char *buf, unsigned long length) } /* Interface is added. Send ZEBRA_INTERFACE_ADD to client. */ +/* + * This function is called in the following situations: + * - in response to a 3-byte ZEBRA_INTERFACE_ADD request + * from the client. + * - at startup, when zebra figures out the available interfaces + * - when an interface is added (where support for + * RTM_IFANNOUNCE or AF_NETLINK sockets is available), or when + * an interface is marked IFF_UP (i.e., an RTM_IFINFO message is + * received) + */ int zsend_interface_add (struct zserv *client, struct interface *ifp) { @@ -197,6 +207,7 @@ zsend_interface_add (struct zserv *client, struct interface *ifp) stream_putl (s, ifp->flags); stream_putl (s, ifp->metric); stream_putl (s, ifp->mtu); + stream_putl (s, ifp->mtu6); stream_putl (s, ifp->bandwidth); #ifdef HAVE_SOCKADDR_DL stream_put (s, &ifp->sdl, sizeof (ifp->sdl)); @@ -215,6 +226,12 @@ zsend_interface_add (struct zserv *client, struct interface *ifp) } /* Interface deletion from zebra daemon. */ +/* + * This function is only called when support for + * RTM_IFANNOUNCE or AF_NETLINK sockets (RTM_DELLINK message) + * is available. It is not called on Solaris. + */ +#if (defined(RTM_IFANNOUNCE) || defined(HAVE_NETLINK)) int zsend_interface_delete (struct zserv *client, struct interface *ifp) { @@ -238,6 +255,7 @@ zsend_interface_delete (struct zserv *client, struct interface *ifp) stream_putl (s, ifp->flags); stream_putl (s, ifp->metric); stream_putl (s, ifp->mtu); + stream_putl (s, ifp->mtu6); stream_putl (s, ifp->bandwidth); /* Write packet length. */ @@ -247,12 +265,49 @@ zsend_interface_delete (struct zserv *client, struct interface *ifp) return 0; } +#endif /* (defined(RTM_IFANNOUNCE) || defined(HAVE_LINUX_RTNETLINK_H)) */ -/* Interface address is added. Send ZEBRA_INTERFACE_ADDRESS_ADD to the - client. */ +/* Interface address is added/deleted. Send ZEBRA_INTERFACE_ADDRESS_ADD or + * ZEBRA_INTERFACE_ADDRESS_DELETE to the client. + * + * A ZEBRA_INTERFACE_ADDRESS_ADD is sent in the following situations: + * - in response to a 3-byte ZEBRA_INTERFACE_ADD request + * from the client, after the ZEBRA_INTERFACE_ADD has been + * sent from zebra to the client + * - redistribute new address info to all clients in the following situations + * - at startup, when zebra figures out the available interfaces + * - when an interface is added (where support for + * RTM_IFANNOUNCE or AF_NETLINK sockets is available), or when + * an interface is marked IFF_UP (i.e., an RTM_IFINFO message is + * received) + * - for the vty commands "ip address A.B.C.D/M [|