use RT_ROUNDUP provided by net/route.h
This commit is contained in:
parent
a804f47907
commit
34493327dd
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mpls_interface.c,v 1.4 2011/01/04 10:18:42 kefren Exp $ */
|
||||
/* $NetBSD: mpls_interface.c,v 1.5 2011/02/09 11:38:57 kefren Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -32,6 +32,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netmpls/mpls.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
@ -49,9 +50,6 @@
|
||||
#include "mpls_interface.h"
|
||||
#include "mpls_routes.h"
|
||||
|
||||
#define ROUNDUP(a) \
|
||||
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
|
||||
|
||||
int
|
||||
mpls_add_label(struct ldp_peer * p, struct rt_msg * inh_rg,
|
||||
struct in_addr * addr, int len, int label, int rlookup)
|
||||
@ -116,7 +114,7 @@ mpls_add_label(struct ldp_peer * p, struct rt_msg * inh_rg,
|
||||
|
||||
so_gate = (union sockunion *) rgp->m_space;
|
||||
so_gate = (union sockunion *)((char*)so_gate +
|
||||
ROUNDUP(so_gate->sa.sa_len));
|
||||
RT_ROUNDUP(so_gate->sa.sa_len));
|
||||
if (rgp->m_rtm.rtm_addrs & RTA_IFA) {
|
||||
int li = 1;
|
||||
so_oldifa = so_gate;
|
||||
@ -128,7 +126,7 @@ mpls_add_label(struct ldp_peer * p, struct rt_msg * inh_rg,
|
||||
li++;
|
||||
for (int i = 0; i < li; i++)
|
||||
so_oldifa = (union sockunion *)((char*)so_oldifa +
|
||||
ROUNDUP(so_oldifa->sa.sa_len));
|
||||
RT_ROUNDUP(so_oldifa->sa.sa_len));
|
||||
}
|
||||
|
||||
if (so_gate->sa.sa_family != AF_INET) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mpls_routes.c,v 1.3 2011/01/04 10:58:15 kefren Exp $ */
|
||||
/* $NetBSD: mpls_routes.c,v 1.4 2011/02/09 11:38:57 kefren Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -71,14 +71,12 @@ extern struct sockaddr mplssockaddr;
|
||||
|
||||
/* Many lines inspired or shamelessly stolen from sbin/route/route.c */
|
||||
|
||||
#define ROUNDUP(a) \
|
||||
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
|
||||
#define NEXTADDR(u) \
|
||||
do { l = ROUNDUP(u->sa.sa_len); memcpy(cp, u, l); cp += l; } while(0);
|
||||
do { l = RT_ROUNDUP(u->sa.sa_len); memcpy(cp, u, l); cp += l; } while(0);
|
||||
#define NEXTADDR2(u) \
|
||||
do { l = ROUNDUP(u.sa_len); memcpy(cp, &u, l); cp += l; } while(0);
|
||||
do { l = RT_ROUNDUP(u.sa_len); memcpy(cp, &u, l); cp += l; } while(0);
|
||||
#define GETNEXT(sunion) \
|
||||
(union sockunion *) ((char *) (sunion) + ROUNDUP((sunion)->sa.sa_len))
|
||||
(union sockunion *) ((char *) (sunion) + RT_ROUNDUP((sunion)->sa.sa_len))
|
||||
|
||||
int
|
||||
read_route_socket(char *s, int max)
|
||||
|
Loading…
Reference in New Issue
Block a user