From 39db97e4e02eae08a1e18528367b6e9b07eb6a93 Mon Sep 17 00:00:00 2001 From: hasso Date: Tue, 12 Oct 2004 20:50:58 +0000 Subject: Some compiler warnings fixes and fix for bugzilla #119. --- zebra/ChangeLog | 4 ++++ zebra/interface.c | 28 ++++++++++++++++++++-------- zebra/irdp_interface.c | 6 +++--- zebra/rib.h | 9 +++++---- zebra/zebra_rib.c | 9 +++++---- zebra/zebra_snmp.c | 10 +++++----- zebra/zebra_vty.c | 17 ++++++++++------- 7 files changed, 52 insertions(+), 31 deletions(-) (limited to 'zebra') diff --git a/zebra/ChangeLog b/zebra/ChangeLog index a4076495..fad80a14 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -2,6 +2,10 @@ * zebra_vty.c: Unbreak "show ip route" command help and make it work for isis routes. + * interface.c(if_dump_vty): Show IPv6 addresses in "show interface" + output. Fixes Bugzilla #119. + * *.c: Make some strings const and some (unsigned) casts to fix + compiler warnings. 2004-10-07 Hasso Tepper diff --git a/zebra/interface.c b/zebra/interface.c index f95efa4e..5664f41a 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -728,6 +728,14 @@ if_dump_vty (struct vty *vty, struct interface *ifp) } } + for (node = listhead (ifp->connected); node; nextnode (node)) + { + connected = getdata (node); + if (CHECK_FLAG (connected->conf, ZEBRA_IFC_REAL) && + (connected->address->family == AF_INET6)) + connected_dump_vty (vty, connected); + } + #ifdef RTADV nd_dump_vty (vty, ifp); #endif /* RTADV */ @@ -1092,8 +1100,9 @@ ALIAS (no_bandwidth_if, "Bandwidth in kilobits\n") int -ip_address_install (struct vty *vty, struct interface *ifp, char *addr_str, - char *peer_str, char *label) +ip_address_install (struct vty *vty, struct interface *ifp, + const char *addr_str, const char *peer_str, + const char *label) { struct prefix_ipv4 cp; struct connected *ifc; @@ -1178,8 +1187,9 @@ ip_address_install (struct vty *vty, struct interface *ifp, char *addr_str, } int -ip_address_uninstall (struct vty *vty, struct interface *ifp, char *addr_str, - char *peer_str, char *label) +ip_address_uninstall (struct vty *vty, struct interface *ifp, + const char *addr_str, const char *peer_str, + const char *label) { struct prefix_ipv4 cp; struct connected *ifc; @@ -1288,8 +1298,9 @@ DEFUN (no_ip_address_label, #ifdef HAVE_IPV6 int -ipv6_address_install (struct vty *vty, struct interface *ifp, char *addr_str, - char *peer_str, char *label, int secondary) +ipv6_address_install (struct vty *vty, struct interface *ifp, + const char *addr_str, const char *peer_str, + const char *label, int secondary) { struct prefix_ipv6 cp; struct connected *ifc; @@ -1365,8 +1376,9 @@ ipv6_address_install (struct vty *vty, struct interface *ifp, char *addr_str, } int -ipv6_address_uninstall (struct vty *vty, struct interface *ifp, char *addr_str, - char *peer_str, char *label, int secondry) +ipv6_address_uninstall (struct vty *vty, struct interface *ifp, + const char *addr_str, const char *peer_str, + const char *label, int secondry) { struct prefix_ipv6 cp; struct connected *ifc; diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 76654c47..e824abed 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -155,7 +155,7 @@ int if_drop_group (struct interface *ifp) return 0; } -struct interface *get_iflist_ifp(int idx) +struct interface *get_iflist_ifp(unsigned int idx) { struct listnode *node; struct interface *ifp; @@ -500,7 +500,7 @@ DEFUN (ip_irdp_minadvertinterval, zi=ifp->info; irdp=&zi->irdp; - if( atoi(argv[0]) <= irdp->MaxAdvertInterval) { + if( (unsigned) atoi(argv[0]) <= irdp->MaxAdvertInterval) { irdp->MinAdvertInterval = atoi(argv[0]); return CMD_SUCCESS; @@ -534,7 +534,7 @@ DEFUN (ip_irdp_maxadvertinterval, irdp=&zi->irdp; - if( irdp->MinAdvertInterval <= atoi(argv[0]) ) { + if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[0]) ) { irdp->MaxAdvertInterval = atoi(argv[0]); return CMD_SUCCESS; diff --git a/zebra/rib.h b/zebra/rib.h index 1141db11..b21e087f 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -234,11 +234,11 @@ void rib_close (); void rib_init (); int -static_add_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname, +static_add_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, u_char flags, u_char distance, u_int32_t vrf_id); int -static_delete_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname, +static_delete_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, u_char distance, u_int32_t vrf_id); #ifdef HAVE_IPV6 @@ -258,11 +258,12 @@ extern struct route_table *rib_table_ipv6; int static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, - char *ifname, u_char flags, u_char distance, u_int32_t vrf_id); + const char *ifname, u_char flags, u_char distance, + u_int32_t vrf_id); int static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, - char *ifname, u_char distance, u_int32_t vrf_id); + const char *ifname, u_char distance, u_int32_t vrf_id); #endif /* HAVE_IPV6 */ diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index a06fd909..dc27d1f9 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1437,7 +1437,7 @@ static_uninstall_ipv4 (struct prefix *p, struct static_ipv4 *si) /* Add static route into static route configuration. */ int -static_add_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname, +static_add_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, u_char flags, u_char distance, u_int32_t vrf_id) { u_char type = 0; @@ -1533,7 +1533,7 @@ static_add_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname, /* Delete static route from static route configuration. */ int -static_delete_ipv4 (struct prefix *p, struct in_addr *gate, char *ifname, +static_delete_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, u_char distance, u_int32_t vrf_id) { u_char type = 0; @@ -2002,7 +2002,8 @@ static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si) /* Add static route into static route configuration. */ int static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, - char *ifname, u_char flags, u_char distance, u_int32_t vrf_id) + const char *ifname, u_char flags, u_char distance, + u_int32_t vrf_id) { struct route_node *rn; struct static_ipv6 *si; @@ -2082,7 +2083,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, /* Delete static route from static route configuration. */ int static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, - char *ifname, u_char distance, u_int32_t vrf_id) + const char *ifname, u_char distance, u_int32_t vrf_id) { struct route_node *rn; struct static_ipv6 *si; diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index 5095095c..dece89ea 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -328,7 +328,7 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len, /* Short circuit exact matches of wrong length */ - if (exact && (*objid_len != v->namelen + 10)) + if (exact && (*objid_len != (unsigned) v->namelen + 10)) return; table = vrf_table (AFI_IP, SAFI_UNICAST, 0); @@ -342,19 +342,19 @@ get_fwtable_route_node(struct variable *v, oid objid[], size_t *objid_len, if (*objid_len > v->namelen) oid2in_addr (objid + v->namelen, MIN(4, *objid_len - v->namelen), &dest); - if (*objid_len > v->namelen + 4) + if (*objid_len > (unsigned) v->namelen + 4) proto = objid[v->namelen + 4]; - if (*objid_len > v->namelen + 5) + if (*objid_len > (unsigned) v->namelen + 5) policy = objid[v->namelen + 5]; - if (*objid_len > v->namelen + 6) + if (*objid_len > (unsigned) v->namelen + 6) oid2in_addr (objid + v->namelen + 6, MIN(4, *objid_len - v->namelen - 6), &nexthop); /* Apply GETNEXT on not exact search */ - if (!exact && (*objid_len >= v->namelen + 10)) + if (!exact && (*objid_len >= (unsigned) v->namelen + 10)) { if (! in_addr_add((u_char *) &nexthop, 1)) return; diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 044448e1..ae4083ed 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -91,16 +91,16 @@ route_type_char (u_char type) /* General fucntion for static route. */ int -zebra_static_ipv4 (struct vty *vty, int add_cmd, - char *dest_str, char *mask_str, char *gate_str, - char *flag_str, char *distance_str) +zebra_static_ipv4 (struct vty *vty, int add_cmd, const char *dest_str, + const char *mask_str, const char *gate_str, + const char *flag_str, const char *distance_str) { int ret; u_char distance; struct prefix p; struct in_addr gate; struct in_addr mask; - char *ifname; + const char *ifname; u_char flag = 0; ret = str2prefix (dest_str, &p); @@ -754,7 +754,9 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib) } } -#define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, > - selected route, * - FIB route%s%s" +#define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \ + "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \ + "> - selected route, * - FIB route%s%s" DEFUN (show_ip_route, show_ip_route_cmd, @@ -1114,8 +1116,9 @@ static_config_ipv4 (struct vty *vty) #ifdef HAVE_IPV6 /* General fucntion for IPv6 static route. */ int -static_ipv6_func (struct vty *vty, int add_cmd, char *dest_str, - char *gate_str, char *ifname, char *flag_str, char *distance_str) +static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, + const char *gate_str, const char *ifname, + const char *flag_str, const char *distance_str) { int ret; u_char distance; -- cgit v1.2.1