From 30be80287aeb91e97159aacd48ee90603a9dfef5 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 22 Oct 2003 02:51:38 +0000 Subject: 2003-10-22 Paul Jakma * zebra/kernel_socket.c: HAVE_IPV6 conditional for WRAPUP when HAVE_SA_LEN is not defined. bcopy -> memcpy, bcopy is not portable. --- zebra/kernel_socket.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'zebra/kernel_socket.c') diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index e4f85aa0..6950d680 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -45,16 +45,24 @@ extern struct zebra_t zebrad; ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) /* And this macro is wrapper for handling sa_len. */ -#ifdef HAVE_SA_LEN +#if defined(HAVE_SA_LEN) #define WRAPUP(X) ROUNDUP(((struct sockaddr *)(X))->sa_len) -#else +#elif defined(HAVE_IPV6) #define WRAPUP(X) \ + do { \ (((struct sockaddr *)(X))->sa_family == AF_INET ? \ ROUNDUP(sizeof(struct sockaddr_in)):\ (((struct sockaddr *)(X))->sa_family == AF_INET6 ? \ ROUNDUP(sizeof(struct sockaddr_in6)) : \ (((struct sockaddr *)(X))->sa_family == AF_LINK ? \ - ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr)))) + ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr)))) \ + } while (0) +#else /* HAVE_IPV6 */ +#define WRAPUP(X) \ + (((struct sockaddr *)(X))->sa_family == AF_INET ? \ + ROUNDUP(sizeof(struct sockaddr_in)):\ + (((struct sockaddr *)(X))->sa_family == AF_LINK ? \ + ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr))) #endif /* HAVE_SA_LEN */ /* Routing socket message types. */ @@ -250,7 +258,7 @@ ifm_read (struct if_msghdr *ifm) */ if (sdl != NULL) { - bcopy(sdl->sdl_data, ifname, sdl->sdl_nlen); + memcpy (ifname, sdl->sdl_data, sdl->sdl_nlen); ifname[sdl->sdl_nlen] = '\0'; ifp = if_lookup_by_name (ifname); } -- cgit v1.2.1