diff options
Diffstat (limited to 'ripngd')
-rw-r--r-- | ripngd/ripng_debug.c | 2 | ||||
-rw-r--r-- | ripngd/ripng_debug.h | 4 | ||||
-rw-r--r-- | ripngd/ripng_interface.c | 65 | ||||
-rw-r--r-- | ripngd/ripng_main.c | 6 | ||||
-rw-r--r-- | ripngd/ripng_nexthop.h | 13 | ||||
-rw-r--r-- | ripngd/ripng_offset.c | 24 | ||||
-rw-r--r-- | ripngd/ripng_peer.c | 14 | ||||
-rw-r--r-- | ripngd/ripng_route.c | 4 | ||||
-rw-r--r-- | ripngd/ripng_route.h | 17 | ||||
-rw-r--r-- | ripngd/ripng_routemap.c | 56 | ||||
-rw-r--r-- | ripngd/ripng_zebra.c | 16 | ||||
-rw-r--r-- | ripngd/ripngd.c | 60 | ||||
-rw-r--r-- | ripngd/ripngd.h | 130 |
13 files changed, 214 insertions, 197 deletions
diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index 7841fe21..4ed4fa36 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -211,7 +211,7 @@ struct cmd_node debug_node = 1 /* VTYSH */ }; -int +static int config_write_debug (struct vty *vty) { int write = 0; diff --git a/ripngd/ripng_debug.h b/ripngd/ripng_debug.h index 617a07de..f5ed6eab 100644 --- a/ripngd/ripng_debug.h +++ b/ripngd/ripng_debug.h @@ -47,7 +47,7 @@ extern unsigned long ripng_debug_event; extern unsigned long ripng_debug_packet; extern unsigned long ripng_debug_zebra; -void ripng_debug_init (); -void ripng_debug_reset (); +extern void ripng_debug_init (void); +extern void ripng_debug_reset (void); #endif /* _ZEBRA_RIPNG_DEBUG_H */ diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 140e3bef..d76e3a13 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -52,12 +52,12 @@ extern struct zebra_privs_t ripngd_privs; /* Static utility function. */ static void ripng_enable_apply (struct interface *); static void ripng_passive_interface_apply (struct interface *); -int ripng_enable_if_lookup (const char *ifname); -int ripng_enable_network_lookup2 (struct connected *connected); -void ripng_enable_apply_all (); +static int ripng_enable_if_lookup (const char *); +static int ripng_enable_network_lookup2 (struct connected *); +static void ripng_enable_apply_all (void); /* Join to the all rip routers multicast group. */ -int +static int ripng_multicast_join (struct interface *ifp) { int ret; @@ -109,7 +109,7 @@ ripng_multicast_join (struct interface *ifp) } /* Leave from the all rip routers multicast group. */ -int +static int ripng_multicast_leave (struct interface *ifp) { int ret; @@ -137,7 +137,7 @@ ripng_multicast_leave (struct interface *ifp) } /* How many link local IPv6 address could be used on the interface ? */ -int +static int ripng_if_ipv6_lladdress_check (struct interface *ifp) { struct listnode *nn; @@ -158,8 +158,8 @@ ripng_if_ipv6_lladdress_check (struct interface *ifp) } /* Check max mtu size. */ -unsigned int -ripng_check_max_mtu () +static unsigned int +ripng_check_max_mtu (void) { struct listnode *node; struct interface *ifp; @@ -173,7 +173,7 @@ ripng_check_max_mtu () return mtu; } -int +static int ripng_if_down (struct interface *ifp) { struct route_node *rp; @@ -335,7 +335,7 @@ ripng_interface_delete (int command, struct zclient *zclient, } void -ripng_interface_clean () +ripng_interface_clean (void) { struct listnode *node, *nnode; struct interface *ifp; @@ -358,7 +358,8 @@ ripng_interface_clean () } void -ripng_interface_reset () { +ripng_interface_reset (void) +{ struct listnode *node; struct interface *ifp; struct ripng_interface *ri; @@ -526,7 +527,7 @@ struct route_table *ripng_enable_network; /* Lookup RIPng enable network. */ /* Check wether the interface has at least a connected prefix that * is within the ripng_enable_network table. */ -int +static int ripng_enable_network_lookup_if (struct interface *ifp) { struct listnode *node; @@ -559,7 +560,7 @@ ripng_enable_network_lookup_if (struct interface *ifp) } /* Check wether connected is within the ripng_enable_network table. */ -int +static int ripng_enable_network_lookup2 (struct connected *connected) { struct prefix_ipv6 address; @@ -588,7 +589,7 @@ ripng_enable_network_lookup2 (struct connected *connected) } /* Add RIPng enable network. */ -int +static int ripng_enable_network_add (struct prefix *p) { struct route_node *node; @@ -610,7 +611,7 @@ ripng_enable_network_add (struct prefix *p) } /* Delete RIPng enable network. */ -int +static int ripng_enable_network_delete (struct prefix *p) { struct route_node *node; @@ -632,7 +633,7 @@ ripng_enable_network_delete (struct prefix *p) } /* Lookup function. */ -int +static int ripng_enable_if_lookup (const char *ifname) { unsigned int i; @@ -646,7 +647,7 @@ ripng_enable_if_lookup (const char *ifname) } /* Add interface to ripng_enable_if. */ -int +static int ripng_enable_if_add (const char *ifname) { int ret; @@ -663,7 +664,7 @@ ripng_enable_if_add (const char *ifname) } /* Delete interface from ripng_enable_if. */ -int +static int ripng_enable_if_delete (const char *ifname) { int index; @@ -683,7 +684,7 @@ ripng_enable_if_delete (const char *ifname) } /* Wake up interface. */ -int +static int ripng_interface_wakeup (struct thread *t) { struct interface *ifp; @@ -710,9 +711,7 @@ ripng_interface_wakeup (struct thread *t) return 0; } -int ripng_redistribute_check (int); - -void +static void ripng_connect_set (struct interface *ifp, int set) { struct listnode *node, *nnode; @@ -816,8 +815,8 @@ ripng_enable_apply (struct interface *ifp) } /* Set distribute list to all interfaces. */ -void -ripng_enable_apply_all () +static void +ripng_enable_apply_all (void) { struct interface *ifp; struct listnode *node; @@ -853,7 +852,7 @@ ripng_clean_network () vector Vripng_passive_interface; /* Utility function for looking up passive interface settings. */ -int +static int ripng_passive_interface_lookup (const char *ifname) { unsigned int i; @@ -881,7 +880,7 @@ ripng_passive_interface_apply (struct interface *ifp) ri->passive = 1; } -void +static void ripng_passive_interface_apply_all (void) { struct interface *ifp; @@ -892,7 +891,7 @@ ripng_passive_interface_apply_all (void) } /* Passive interface. */ -int +static int ripng_passive_interface_set (struct vty *vty, const char *ifname) { if (ripng_passive_interface_lookup (ifname) >= 0) @@ -905,7 +904,7 @@ ripng_passive_interface_set (struct vty *vty, const char *ifname) return CMD_SUCCESS; } -int +static int ripng_passive_interface_unset (struct vty *vty, const char *ifname) { int i; @@ -1117,8 +1116,8 @@ DEFUN (no_ripng_passive_interface, return ripng_passive_interface_unset (vty, argv[0]); } -struct ripng_interface * -ri_new () +static struct ripng_interface * +ri_new (void) { struct ripng_interface *ri; ri = XCALLOC (MTYPE_IF, sizeof (struct ripng_interface)); @@ -1133,7 +1132,7 @@ ri_new () return ri; } -int +static int ripng_if_new_hook (struct interface *ifp) { ifp->info = ri_new (); @@ -1141,7 +1140,7 @@ ripng_if_new_hook (struct interface *ifp) } /* Called when interface structure deleted. */ -int +static int ripng_if_delete_hook (struct interface *ifp) { XFREE (MTYPE_IF, ifp->info); @@ -1150,7 +1149,7 @@ ripng_if_delete_hook (struct interface *ifp) } /* Configuration write function for ripngd. */ -int +static int interface_config_write (struct vty *vty) { struct listnode *node; diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index a18ce9de..48774852 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -129,7 +129,7 @@ Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS); } /* SIGHUP handler. */ -void +static void sighup (void) { zlog_info ("SIGHUP received"); @@ -145,7 +145,7 @@ sighup (void) } /* SIGINT handler. */ -void +static void sigint (void) { zlog_notice ("Terminating on signal"); @@ -157,7 +157,7 @@ sigint (void) } /* SIGUSR1 handler. */ -void +static void sigusr1 (void) { zlog_rotate (NULL); diff --git a/ripngd/ripng_nexthop.h b/ripngd/ripng_nexthop.h index 50a86ad0..7c041059 100644 --- a/ripngd/ripng_nexthop.h +++ b/ripngd/ripng_nexthop.h @@ -27,12 +27,13 @@ #include "ripngd/ripng_route.h" #include "ripngd/ripngd.h" -struct list * ripng_rte_new(void); -void ripng_rte_free(struct list *ripng_rte_list); -void ripng_rte_add(struct list *ripng_rte_list, struct prefix_ipv6 *p, - struct ripng_info *rinfo, struct ripng_aggregate *aggregate); -void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, - struct sockaddr_in6 *to); +extern struct list * ripng_rte_new(void); +extern void ripng_rte_free(struct list *ripng_rte_list); +extern void ripng_rte_add(struct list *ripng_rte_list, struct prefix_ipv6 *p, + struct ripng_info *rinfo, + struct ripng_aggregate *aggregate); +extern void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, + struct sockaddr_in6 *to); /*** * 1 if A > B diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index 31d78ba8..5bc2568e 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -32,6 +32,8 @@ #include "linklist.h" #include "memory.h" +#include "ripngd/ripngd.h" + #define RIPNG_OFFSET_LIST_IN 0 #define RIPNG_OFFSET_LIST_OUT 1 #define RIPNG_OFFSET_LIST_MAX 2 @@ -50,7 +52,7 @@ struct ripng_offset_list static struct list *ripng_offset_list_master; -int +static int strcmp_safe (const char *s1, const char *s2) { if (s1 == NULL && s2 == NULL) @@ -62,7 +64,7 @@ strcmp_safe (const char *s1, const char *s2) return strcmp (s1, s2); } -struct ripng_offset_list * +static struct ripng_offset_list * ripng_offset_list_new () { struct ripng_offset_list *new; @@ -71,13 +73,13 @@ ripng_offset_list_new () return new; } -void +static void ripng_offset_list_free (struct ripng_offset_list *offset) { XFREE (MTYPE_RIPNG_OFFSET_LIST, offset); } -struct ripng_offset_list * +static struct ripng_offset_list * ripng_offset_list_lookup (const char *ifname) { struct ripng_offset_list *offset; @@ -91,7 +93,7 @@ ripng_offset_list_lookup (const char *ifname) return NULL; } -struct ripng_offset_list * +static struct ripng_offset_list * ripng_offset_list_get (const char *ifname) { struct ripng_offset_list *offset; @@ -108,7 +110,7 @@ ripng_offset_list_get (const char *ifname) return offset; } -int +static int ripng_offset_list_set (struct vty *vty, const char *alist, const char *direct_str, const char *metric_str, const char *ifname) @@ -147,7 +149,7 @@ ripng_offset_list_set (struct vty *vty, const char *alist, return CMD_SUCCESS; } -int +static int ripng_offset_list_unset (struct vty *vty, const char *alist, const char *direct_str, const char *metric_str, const char *ifname) @@ -338,13 +340,13 @@ DEFUN (no_ripng_offset_list_ifname, return ripng_offset_list_unset (vty, argv[0], argv[1], argv[2], argv[3]); } -int +static int offset_list_cmp (struct ripng_offset_list *o1, struct ripng_offset_list *o2) { return strcmp_safe (o1->ifname, o2->ifname); } -void +static void offset_list_del (struct ripng_offset_list *offset) { if (OFFSET_LIST_IN_NAME (offset)) @@ -357,7 +359,7 @@ offset_list_del (struct ripng_offset_list *offset) } void -ripng_offset_init () +ripng_offset_init (void) { ripng_offset_list_master = list_new (); ripng_offset_list_master->cmp = (int (*)(void *, void *)) offset_list_cmp; @@ -370,7 +372,7 @@ ripng_offset_init () } void -ripng_offset_clean () +ripng_offset_clean (void) { list_delete (ripng_offset_list_master); diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 34f5ac6c..1e58bb87 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -39,8 +39,8 @@ /* Linked list of RIPng peer. */ struct list *peer_list; -struct ripng_peer * -ripng_peer_new () +static struct ripng_peer * +ripng_peer_new (void) { struct ripng_peer *new; @@ -49,7 +49,7 @@ ripng_peer_new () return new; } -void +static void ripng_peer_free (struct ripng_peer *peer) { XFREE (MTYPE_RIPNG_PEER, peer); @@ -86,7 +86,7 @@ ripng_peer_lookup_next (struct in6_addr *addr) /* RIPng peer is timeout. * Garbage collector. **/ -int +static int ripng_peer_timeout (struct thread *t) { struct ripng_peer *peer; @@ -99,7 +99,7 @@ ripng_peer_timeout (struct thread *t) } /* Get RIPng peer. At the same time update timeout thread. */ -struct ripng_peer * +static struct ripng_peer * ripng_peer_get (struct in6_addr *addr) { struct ripng_peer *peer; @@ -153,7 +153,7 @@ ripng_peer_bad_packet (struct sockaddr_in6 *from) } /* Display peer uptime. */ -char * +static char * ripng_peer_uptime (struct ripng_peer *peer, char *buf, size_t len) { time_t uptime; @@ -206,7 +206,7 @@ ripng_peer_display (struct vty *vty) } } -int +static int ripng_peer_list_cmp (struct ripng_peer *p1, struct ripng_peer *p2) { return addr6_cmp(&p1->addr, &p2->addr) > 0; diff --git a/ripngd/ripng_route.c b/ripngd/ripng_route.c index 9c3c4f99..d4bf0262 100644 --- a/ripngd/ripng_route.c +++ b/ripngd/ripng_route.c @@ -31,7 +31,7 @@ #include "ripngd/ripngd.h" #include "ripngd/ripng_route.h" -struct ripng_aggregate * +static struct ripng_aggregate * ripng_aggregate_new () { struct ripng_aggregate *new; @@ -40,7 +40,7 @@ ripng_aggregate_new () return new; } -void +static void ripng_aggregate_free (struct ripng_aggregate *aggregate) { XFREE (MTYPE_RIPNG_AGGREGATE, aggregate); diff --git a/ripngd/ripng_route.h b/ripngd/ripng_route.h index db53f148..2f5b7575 100644 --- a/ripngd/ripng_route.h +++ b/ripngd/ripng_route.h @@ -44,16 +44,11 @@ struct ripng_aggregate u_short tag_out; }; -void -ripng_aggregate_increment (struct route_node *rp, struct ripng_info *rinfo); - -void -ripng_aggregate_decrement (struct route_node *rp, struct ripng_info *rinfo); - -int -ripng_aggregate_add (struct prefix *p); - -int -ripng_aggregate_delete (struct prefix *p); +extern void ripng_aggregate_increment (struct route_node *rp, + struct ripng_info *rinfo); +extern void ripng_aggregate_decrement (struct route_node *rp, + struct ripng_info *rinfo); +extern int ripng_aggregate_add (struct prefix *p); +extern int ripng_aggregate_delete (struct prefix *p); #endif /* _ZEBRA_RIPNG_ROUTE_H */ diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 1570c78b..0f5cca35 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -43,7 +43,7 @@ struct rip_metric_modifier }; -int +static int ripng_route_match_add (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -65,7 +65,7 @@ ripng_route_match_add (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ripng_route_match_delete (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -87,7 +87,7 @@ ripng_route_match_delete (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ripng_route_set_add (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -109,7 +109,7 @@ ripng_route_set_add (struct vty *vty, struct route_map_index *index, return CMD_SUCCESS; } -int +static int ripng_route_set_delete (struct vty *vty, struct route_map_index *index, const char *command, const char *arg) { @@ -133,7 +133,7 @@ ripng_route_set_delete (struct vty *vty, struct route_map_index *index, /* `match metric METRIC' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_metric (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -154,7 +154,7 @@ route_match_metric (void *rule, struct prefix *prefix, } /* Route map `match metric' match statement. `arg' is METRIC value */ -void * +static void * route_match_metric_compile (const char *arg) { u_int32_t *metric; @@ -170,14 +170,14 @@ route_match_metric_compile (const char *arg) } /* Free route map's compiled `match metric' value. */ -void +static void route_match_metric_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_metric_cmd = +static struct route_map_rule_cmd route_match_metric_cmd = { "metric", route_match_metric, @@ -187,7 +187,7 @@ struct route_map_rule_cmd route_match_metric_cmd = /* `match interface IFNAME' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_interface (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -214,19 +214,19 @@ route_match_interface (void *rule, struct prefix *prefix, } /* Route map `match interface' match statement. `arg' is IFNAME value */ -void * +static void * route_match_interface_compile (const char *arg) { return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); } -void +static void route_match_interface_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd route_match_interface_cmd = +static struct route_map_rule_cmd route_match_interface_cmd = { "interface", route_match_interface, @@ -236,7 +236,7 @@ struct route_map_rule_cmd route_match_interface_cmd = /* `match tag TAG' */ /* Match function return 1 if match is success else return zero. */ -route_map_result_t +static route_map_result_t route_match_tag (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -258,7 +258,7 @@ route_match_tag (void *rule, struct prefix *prefix, } /* Route map `match tag' match statement. `arg' is TAG value */ -void * +static void * route_match_tag_compile (const char *arg) { u_short *tag; @@ -270,14 +270,14 @@ route_match_tag_compile (const char *arg) } /* Free route map's compiled `match tag' value. */ -void +static void route_match_tag_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for tag matching. */ -struct route_map_rule_cmd route_match_tag_cmd = +static struct route_map_rule_cmd route_match_tag_cmd = { "tag", route_match_tag, @@ -288,7 +288,7 @@ struct route_map_rule_cmd route_match_tag_cmd = /* `set metric METRIC' */ /* Set metric to attribute. */ -route_map_result_t +static route_map_result_t route_set_metric (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -318,7 +318,7 @@ route_set_metric (void *rule, struct prefix *prefix, } /* set metric compilation. */ -void * +static void * route_set_metric_compile (const char *arg) { int len; @@ -371,13 +371,13 @@ route_set_metric_compile (const char *arg) } /* Free route map's compiled `set metric' value. */ -void +static void route_set_metric_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } -struct route_map_rule_cmd route_set_metric_cmd = +static struct route_map_rule_cmd route_set_metric_cmd = { "metric", route_set_metric, @@ -388,7 +388,7 @@ struct route_map_rule_cmd route_set_metric_cmd = /* `set ipv6 next-hop local IP_ADDRESS' */ /* Set nexthop to object. ojbect must be pointer to struct attr. */ -route_map_result_t +static route_map_result_t route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -410,7 +410,7 @@ route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix, /* Route map `ipv6 nexthop local' compile function. Given string is converted to struct in6_addr structure. */ -void * +static void * route_set_ipv6_nexthop_local_compile (const char *arg) { int ret; @@ -430,14 +430,14 @@ route_set_ipv6_nexthop_local_compile (const char *arg) } /* Free route map's compiled `ipv6 nexthop local' value. */ -void +static void route_set_ipv6_nexthop_local_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for ipv6 nexthop local set. */ -struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = +static struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = { "ipv6 next-hop local", route_set_ipv6_nexthop_local, @@ -448,7 +448,7 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = /* `set tag TAG' */ /* Set tag to object. ojbect must be pointer to struct attr. */ -route_map_result_t +static route_map_result_t route_set_tag (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { @@ -470,7 +470,7 @@ route_set_tag (void *rule, struct prefix *prefix, /* Route map `tag' compile function. Given string is converted to u_short. */ -void * +static void * route_set_tag_compile (const char *arg) { u_short *tag; @@ -482,14 +482,14 @@ route_set_tag_compile (const char *arg) } /* Free route map's compiled `ip nexthop' value. */ -void +static void route_set_tag_free (void *rule) { XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); } /* Route map commands for tag set. */ -struct route_map_rule_cmd route_set_tag_cmd = +static struct route_map_rule_cmd route_set_tag_cmd = { "tag", route_set_tag, diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 1f9bee0c..62185c0a 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -89,7 +89,7 @@ ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop, } /* Zebra route add and delete treatment. */ -int +static int ripng_zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length) { @@ -143,12 +143,12 @@ ripng_zebra_read_ipv6 (int command, struct zclient *zclient, } void -ripng_zclient_reset () +ripng_zclient_reset (void) { zclient_reset (zclient); } -int +static int ripng_redistribute_unset (int type) { if (! zclient->redist[type]) @@ -170,14 +170,14 @@ ripng_redistribute_check (int type) return (zclient->redist[type]); } -void +static void ripng_redistribute_metric_set (int type, int metric) { ripng->route_map[type].metric_config = 1; ripng->route_map[type].metric = metric; } -int +static int ripng_redistribute_metric_unset (int type) { ripng->route_map[type].metric_config = 0; @@ -185,7 +185,7 @@ ripng_redistribute_metric_unset (int type) return 0; } -void +static void ripng_redistribute_routemap_set (int type, const char *name) { if (ripng->route_map[type].name) @@ -195,7 +195,7 @@ ripng_redistribute_routemap_set (int type, const char *name) ripng->route_map[type].map = route_map_lookup_by_name (name); } -void +static void ripng_redistribute_routemap_unset (int type) { if (ripng->route_map[type].name) @@ -520,7 +520,7 @@ ripng_redistribute_write (struct vty *vty, int config_mode) } /* RIPng configuration write function. */ -int +static int zebra_config_write (struct vty *vty) { if (! zclient->enable) diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index a8277fe2..5e9bfc54 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -73,7 +73,7 @@ struct ripng_nexthop struct in6_addr address; }; -int +static int ripng_route_rte (struct ripng_info *rinfo) { return (rinfo->type == ZEBRA_ROUTE_RIPNG && rinfo->sub_type == RIPNG_ROUTE_RTE); @@ -97,7 +97,7 @@ ripng_info_free (struct ripng_info *rinfo) } /* Create ripng socket. */ -int +static int ripng_make_socket (void) { int ret; @@ -222,7 +222,7 @@ ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to, } /* Receive UDP RIPng packet from socket. */ -int +static int ripng_recv_packet (int sock, u_char *buf, int bufsize, struct sockaddr_in6 *from, unsigned int *ifindex, int *hoplimit) @@ -318,7 +318,7 @@ ripng_packet_dump (struct ripng_packet *packet, int size, const char *sndrcv) } /* RIPng next hop address RTE (Route Table Entry). */ -void +static void ripng_nexthop_rte (struct rte *rte, struct sockaddr_in6 *from, struct ripng_nexthop *nexthop) @@ -377,7 +377,7 @@ ripng_nexthop_rte (struct rte *rte, } /* If ifp has same link-local address then return 1. */ -int +static int ripng_lladdr_check (struct interface *ifp, struct in6_addr *addr) { struct listnode *node; @@ -397,7 +397,7 @@ ripng_lladdr_check (struct interface *ifp, struct in6_addr *addr) } /* RIPng route garbage collect timer. */ -int +static int ripng_garbage_collect (struct thread *t) { struct ripng_info *rinfo; @@ -423,7 +423,7 @@ ripng_garbage_collect (struct thread *t) } /* Timeout RIPng routes. */ -int +static int ripng_timeout (struct thread *t) { struct ripng_info *rinfo; @@ -460,7 +460,7 @@ ripng_timeout (struct thread *t) return 0; } -void +static void ripng_timeout_update (struct ripng_info *rinfo) { if (rinfo->metric != RIPNG_METRIC_INFINITY) @@ -470,7 +470,7 @@ ripng_timeout_update (struct ripng_info *rinfo) } } -int +static int ripng_incoming_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) { struct distribute *dist; @@ -541,7 +541,7 @@ ripng_incoming_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) return 0; } -int +static int ripng_outgoing_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) { struct distribute *dist; @@ -612,7 +612,7 @@ ripng_outgoing_filter (struct prefix_ipv6 *p, struct ripng_interface *ri) } /* Process RIPng route according to RFC2080. */ -void +static void ripng_route_process (struct rte *rte, struct sockaddr_in6 *from, struct ripng_nexthop *ripng_nexthop, struct interface *ifp) @@ -1100,7 +1100,7 @@ ripng_redistribute_withdraw (int type) } /* RIP routing information. */ -void +static void ripng_response_process (struct ripng_packet *packet, int size, struct sockaddr_in6 *from, struct interface *ifp, int hoplimit) @@ -1233,7 +1233,7 @@ ripng_response_process (struct ripng_packet *packet, int size, } /* Response to request message. */ -void +static void ripng_request_process (struct ripng_packet *packet,int size, struct sockaddr_in6 *from, struct interface *ifp) { @@ -1320,7 +1320,7 @@ ripng_request_process (struct ripng_packet *packet,int size, } /* First entry point of reading RIPng packet. */ -int +static int ripng_read (struct thread *thread) { int len; @@ -1410,8 +1410,8 @@ ripng_read (struct thread *thread) } /* Walk down the RIPng routing table then clear changed flag. */ -void -ripng_clear_changed_flag () +static void +ripng_clear_changed_flag (void) { struct route_node *rp; struct ripng_info *rinfo; @@ -1424,7 +1424,7 @@ ripng_clear_changed_flag () /* Regular update of RIPng route. Send all routing formation to RIPng enabled interface. */ -int +static int ripng_update (struct thread *t) { struct listnode *node; @@ -1484,7 +1484,7 @@ ripng_update (struct thread *t) } /* Triggered update interval timer. */ -int +static int ripng_triggered_interval (struct thread *t) { ripng->t_triggered_interval = NULL; @@ -1813,8 +1813,8 @@ ripng_output_process (struct interface *ifp, struct sockaddr_in6 *to, } /* Create new RIPng instance and set it to global variable. */ -int -ripng_create () +static int +ripng_create (void) { /* ripng should be NULL. */ assert (ripng == NULL); @@ -1880,7 +1880,7 @@ ripng_request (struct interface *ifp) } -int +static int ripng_update_jitter (int time) { return ((rand () % (time + 1)) - (time / 2)); @@ -1949,7 +1949,7 @@ ripng_vty_out_uptime (struct vty *vty, struct ripng_info *rinfo) } } -char * +static char * ripng_route_subtype_print (struct ripng_info *rinfo) { static char str[3]; @@ -2102,8 +2102,6 @@ DEFUN (show_ipv6_ripng_status, { struct listnode *node; struct interface *ifp; - int ripng_network_write (struct vty *, int); - void ripng_redistribute_write (struct vty *, int); if (! ripng) return CMD_SUCCESS; @@ -2607,7 +2605,7 @@ DEFUN (no_ripng_default_information_originate, } /* RIPng configuration write function. */ -int +static int ripng_config_write (struct vty *vty) { int ripng_network_write (struct vty *, int); @@ -2692,7 +2690,7 @@ struct cmd_node cmd_ripng_node = 1, }; -void +static void ripng_distribute_update (struct distribute *dist) { struct interface *ifp; @@ -2765,7 +2763,7 @@ ripng_distribute_update_interface (struct interface *ifp) } /* Update all interface's distribute list. */ -void +static void ripng_distribute_update_all (struct prefix_list *notused) { struct interface *ifp; @@ -2775,7 +2773,7 @@ ripng_distribute_update_all (struct prefix_list *notused) ripng_distribute_update_interface (ifp); } -void +static void ripng_distribute_update_all_wrapper (struct access_list *notused) { ripng_distribute_update_all(NULL); @@ -2878,7 +2876,7 @@ ripng_reset () ripng_zclient_reset (); } -void +static void ripng_if_rmap_update (struct if_rmap *if_rmap) { struct interface *ifp; @@ -2924,7 +2922,7 @@ ripng_if_rmap_update_interface (struct interface *ifp) ripng_if_rmap_update (if_rmap); } -void +static void ripng_routemap_update_redistribute (void) { int i; @@ -2940,7 +2938,7 @@ ripng_routemap_update_redistribute (void) } } -void +static void ripng_routemap_update (const char *unused) { struct interface *ifp; diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index b478e9bc..ab06d81b 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -23,6 +23,9 @@ #ifndef _ZEBRA_RIPNG_RIPNGD_H #define _ZEBRA_RIPNG_RIPNGD_H +#include <zclient.h> +#include <vty.h> + /* RIPng version and port number. */ #define RIPNG_V1 1 #define RIPNG_PORT_DEFAULT 521 @@ -340,60 +343,79 @@ extern struct ripng *ripng; extern struct thread_master *master; /* Prototypes. */ -void ripng_init (); -void ripng_reset (); -void ripng_clean (); -void ripng_clean_network (); -void ripng_interface_clean (); -void ripng_interface_reset (); -void ripng_passive_interface_clean (); -void ripng_if_init (); -void ripng_route_map_init (); -void ripng_route_map_reset (); -void ripng_terminate (); +extern void ripng_init (void); +extern void ripng_reset (void); +extern void ripng_clean (void); +extern void ripng_clean_network (void); +extern void ripng_interface_clean (void); +extern void ripng_interface_reset (void); +extern void ripng_passive_interface_clean (void); +extern void ripng_if_init (void); +extern void ripng_route_map_init (void); +extern void ripng_route_map_reset (void); +extern void ripng_terminate (void); /* zclient_init() is done by ripng_zebra.c:zebra_init() */ -void zebra_init (); -void ripng_zclient_start (); -void ripng_zclient_reset (); -void ripng_offset_init (); - -int config_write_ripng_offset_list (struct vty *); - -void ripng_peer_init (); -void ripng_peer_update (struct sockaddr_in6 *, u_char); -void ripng_peer_bad_route (struct sockaddr_in6 *); -void ripng_peer_bad_packet (struct sockaddr_in6 *); -void ripng_peer_display (struct vty *); -struct ripng_peer *ripng_peer_lookup (struct in6_addr *); -struct ripng_peer *ripng_peer_lookup_next (struct in6_addr *); - -int ripng_offset_list_apply_in (struct prefix_ipv6 *, struct interface *, u_char *); -int ripng_offset_list_apply_out (struct prefix_ipv6 *, struct interface *, u_char *); -void ripng_offset_clean (); - -struct ripng_info * ripng_info_new (); -void ripng_info_free (struct ripng_info *rinfo); -void ripng_event (enum ripng_event, int); -int ripng_request (struct interface *ifp); -void ripng_redistribute_add (int, int, struct prefix_ipv6 *, unsigned int, - struct in6_addr *); -void ripng_redistribute_delete (int, int, struct prefix_ipv6 *, unsigned int); -void ripng_redistribute_withdraw (int type); - -void ripng_distribute_update_interface (struct interface *); -void ripng_if_rmap_update_interface (struct interface *); - -void ripng_zebra_ipv6_add (struct prefix_ipv6 *p, struct in6_addr *nexthop, unsigned int ifindex, u_char metric); -void ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop, unsigned int ifindex); - -void ripng_redistribute_clean (); - -int ripng_write_rte (int num, struct stream *s, struct prefix_ipv6 *p, - struct in6_addr *nexthop, u_int16_t tag, u_char metric); -int ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to, - struct interface *ifp); - -void ripng_packet_dump (struct ripng_packet *packet, int size, const char *sndrcv); - +extern void zebra_init (void); +extern void ripng_zclient_start (void); +extern void ripng_zclient_reset (void); +extern void ripng_offset_init (void); + +extern int config_write_ripng_offset_list (struct vty *); + +extern void ripng_peer_init (void); +extern void ripng_peer_update (struct sockaddr_in6 *, u_char); +extern void ripng_peer_bad_route (struct sockaddr_in6 *); +extern void ripng_peer_bad_packet (struct sockaddr_in6 *); +extern void ripng_peer_display (struct vty *); +extern struct ripng_peer *ripng_peer_lookup (struct in6_addr *); +extern struct ripng_peer *ripng_peer_lookup_next (struct in6_addr *); + +extern int ripng_offset_list_apply_in (struct prefix_ipv6 *, + struct interface *, u_char *); +extern int ripng_offset_list_apply_out (struct prefix_ipv6 *, + struct interface *, u_char *); +extern void ripng_offset_clean (void); + +extern struct ripng_info * ripng_info_new (void); +extern void ripng_info_free (struct ripng_info *rinfo); +extern void ripng_event (enum ripng_event, int); +extern int ripng_request (struct interface *ifp); +extern void ripng_redistribute_add (int, int, struct prefix_ipv6 *, + unsigned int, struct in6_addr *); +extern void ripng_redistribute_delete (int, int, struct prefix_ipv6 *, + unsigned int); +extern void ripng_redistribute_withdraw (int type); + +extern void ripng_distribute_update_interface (struct interface *); +extern void ripng_if_rmap_update_interface (struct interface *); + +extern void ripng_zebra_ipv6_add (struct prefix_ipv6 *p, + struct in6_addr *nexthop, + unsigned int ifindex, u_char metric); +extern void ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, + struct in6_addr *nexthop, + unsigned int ifindex); + +extern void ripng_redistribute_clean (void); +extern int ripng_redistribute_check (int); +extern void ripng_redistribute_write (struct vty *, int); + +extern int ripng_write_rte (int num, struct stream *s, struct prefix_ipv6 *p, + struct in6_addr *nexthop, + u_int16_t tag, u_char metric); +extern int ripng_send_packet (caddr_t buf, int bufsize, + struct sockaddr_in6 *to, struct interface *ifp); + +extern void ripng_packet_dump (struct ripng_packet *packet, int size, + const char *sndrcv); + +extern int ripng_interface_up (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_down (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_add (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_delete (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_address_add (int command, struct zclient *, zebra_size_t); +extern int ripng_interface_address_delete (int command, struct zclient *, zebra_size_t); + +extern int ripng_network_write (struct vty *, int); #endif /* _ZEBRA_RIPNG_RIPNGD_H */ |