diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rw-r--r-- | lib/zclient.c | 34 | ||||
-rw-r--r-- | lib/zclient.h | 3 | ||||
-rw-r--r-- | lib/zebra.h | 5 |
4 files changed, 46 insertions, 1 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 05ad4db5..e92147f3 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2004-10-03 James R. Leu <jleu at mindspring.com> + + * zclient.c, zclient.h: zclient functions for router id handling. + * zebra.h: New message types for router id handling. + 2004-09-27 Paul Jakma <paul@dishone.st> * zebra.h: Add WANT_OSPF_WRITE_FRAGMENT for ospfd diff --git a/lib/zclient.c b/lib/zclient.c index 3b683387..5df420f2 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -260,6 +260,9 @@ zclient_start (struct zclient *zclient) /* We need interface information. */ zebra_message_send (zclient, ZEBRA_INTERFACE_ADD); + /* We need router-id information. */ + zebra_message_send (zclient, ZEBRA_ROUTER_ID_ADD); + /* Flush all redistribute request. */ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) if (i != zclient->redist_default && zclient->redist[i]) @@ -477,6 +480,20 @@ zebra_redistribute_send (int command, int sock, int type) return ret; } +/* Router-id update from zebra daemon. */ +void +zebra_router_id_update_read (struct stream *s, struct prefix *rid) +{ + int plen; + + /* Fetch interface address. */ + rid->family = stream_getc (s); + + plen = prefix_blen (rid); + stream_get (&rid->u.prefix, s, plen); + rid->prefixlen = stream_getc (s); +} + /* Interface addition from zebra daemon. */ /* * The format of the message sent with type ZEBRA_INTERFACE_ADD or @@ -614,6 +631,19 @@ zebra_interface_state_read (struct stream *s) * */ +void +zebra_interface_if_set_value (struct stream *s, struct interface *ifp) +{ + /* Read interface's index. */ + ifp->ifindex = stream_getl (s); + + /* Read interface's value. */ + ifp->flags = stream_getl (s); + ifp->metric = stream_getl (s); + ifp->mtu = stream_getl (s); + ifp->bandwidth = stream_getl (s); +} + struct connected * zebra_interface_address_read (int type, struct stream *s) { @@ -745,6 +775,10 @@ zclient_read (struct thread *thread) switch (command) { + case ZEBRA_ROUTER_ID_UPDATE: + if (zclient->router_id_update) + ret = (*zclient->router_id_update) (command, zclient, length); + break; case ZEBRA_INTERFACE_ADD: if (zclient->interface_add) ret = (*zclient->interface_add) (command, zclient, length); diff --git a/lib/zclient.h b/lib/zclient.h index da8d016d..03a6e0a7 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -62,6 +62,7 @@ struct zclient u_char default_information; /* Pointer to the callback functions. */ + int (*router_id_update) (int, struct zclient *, zebra_size_t); int (*interface_add) (int, struct zclient *, zebra_size_t); int (*interface_delete) (int, struct zclient *, zebra_size_t); int (*interface_up) (int, struct zclient *, zebra_size_t); @@ -119,6 +120,8 @@ int zebra_redistribute_send (int, int, int); struct interface *zebra_interface_add_read (struct stream *); struct interface *zebra_interface_state_read (struct stream *s); struct connected *zebra_interface_address_read (int, struct stream *); +void zebra_interface_if_set_value (struct stream *, struct interface *); +void zebra_router_id_update_read (struct stream *s, struct prefix *rid); int zapi_ipv4_route (u_char, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv4 *); diff --git a/lib/zebra.h b/lib/zebra.h index e53a40c5..0b8b654c 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -314,7 +314,10 @@ struct in_pktinfo #define ZEBRA_IPV4_IMPORT_LOOKUP 17 #define ZEBRA_IPV6_IMPORT_LOOKUP 18 #define ZEBRA_INTERFACE_RENAME 19 -#define ZEBRA_MESSAGE_MAX 20 +#define ZEBRA_ROUTER_ID_ADD 20 +#define ZEBRA_ROUTER_ID_DELETE 21 +#define ZEBRA_ROUTER_ID_UPDATE 22 +#define ZEBRA_MESSAGE_MAX 23 /* Zebra route's types. */ #define ZEBRA_ROUTE_SYSTEM 0 |