summaryrefslogtreecommitdiff
path: root/zebra
diff options
context:
space:
mode:
authorpaul <paul>2003-10-22 02:51:38 +0000
committerpaul <paul>2003-10-22 02:51:38 +0000
commit30be80287aeb91e97159aacd48ee90603a9dfef5 (patch)
tree78a98045aab8b9a92688f10ff8e3cca9c8535f31 /zebra
parent1ac09d3e435a0a430cc3d218aa82015aa5741ed9 (diff)
2003-10-22 Paul Jakma <paul@dishone.st>
* zebra/kernel_socket.c: HAVE_IPV6 conditional for WRAPUP when HAVE_SA_LEN is not defined. bcopy -> memcpy, bcopy is not portable.
Diffstat (limited to 'zebra')
-rw-r--r--zebra/kernel_socket.c16
1 files changed, 12 insertions, 4 deletions
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);
}