Some compiler warnings fixes and fix for bugzilla #119.
diff --git a/zebra/ChangeLog b/zebra/ChangeLog
index a407649..fad80a1 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 <hasso at quagga.net>
diff --git a/zebra/interface.c b/zebra/interface.c
index f95efa4..5664f41 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -728,6 +728,14 @@
}
}
+ 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 @@
"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 @@
}
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 @@
#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 @@
}
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 76654c4..e824abe 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -155,7 +155,7 @@
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 @@
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 @@
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 1141db1..b21e087 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -234,11 +234,11 @@
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 @@
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 a06fd90..dc27d1f 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1437,7 +1437,7 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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 5095095..dece89e 100644
--- a/zebra/zebra_snmp.c
+++ b/zebra/zebra_snmp.c
@@ -328,7 +328,7 @@
/* 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 @@
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 044448e..ae4083e 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -91,16 +91,16 @@
/* 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 @@
}
}
-#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 @@
#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;