zebra: fix more warnings in rtadv
* zebra/rtadv.c
* rtadv_free(): remove unused function
* rtadv_recv_packet(): break up cast/dereference to avoid
compiler type pun warning
* rtadv_read(): initialize ifindex, because compiler can't
figure out that it is okay
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 0bcdafb..8cc3c4c 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -87,12 +87,6 @@
return XCALLOC (MTYPE_TMP, sizeof (struct rtadv));
}
-static void
-rtadv_free (struct rtadv *rtadv)
-{
- XFREE (MTYPE_TMP, rtadv);
-}
-
static int
rtadv_recv_packet (int sock, u_char *buf, int buflen,
struct sockaddr_in6 *from, unsigned int *ifindex,
@@ -138,7 +132,10 @@
/* Incoming packet's hop limit. */
if (cmsgptr->cmsg_level == IPPROTO_IPV6 &&
cmsgptr->cmsg_type == IPV6_HOPLIMIT)
- *hoplimit = *((int *) CMSG_DATA (cmsgptr));
+ {
+ int *hoptr = (int *) CMSG_DATA (cmsgptr);
+ *hoplimit = *hoptr;
+ }
}
return ret;
}
@@ -467,7 +464,7 @@
int len;
u_char buf[RTADV_MSG_SIZE];
struct sockaddr_in6 from;
- unsigned int ifindex;
+ unsigned int ifindex = 0;
int hoplimit = -1;
sock = THREAD_FD (thread);