From b0b709ab6656ba07f12fe0d256912dcabba19017 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 8 Dec 2009 13:26:14 +0300 Subject: 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 --- zebra/rtadv.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'zebra') diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 0bcdafb0..8cc3c4cb 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -87,12 +87,6 @@ rtadv_new (void) 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 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen, /* 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 @@ rtadv_read (struct thread *thread) 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); -- cgit v1.2.1