Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ldpd use RT_ROUNDUP provided by net/route.h
details: https://anonhg.NetBSD.org/src/rev/4c23eddb693b
branches: trunk
changeset: 761850:4c23eddb693b
user: kefren <kefren%NetBSD.org@localhost>
date: Wed Feb 09 11:38:57 2011 +0000
description:
use RT_ROUNDUP provided by net/route.h
diffstat:
usr.sbin/ldpd/mpls_interface.c | 10 ++++------
usr.sbin/ldpd/mpls_routes.c | 10 ++++------
2 files changed, 8 insertions(+), 12 deletions(-)
diffs (72 lines):
diff -r 98fb9f0c94d9 -r 4c23eddb693b usr.sbin/ldpd/mpls_interface.c
--- a/usr.sbin/ldpd/mpls_interface.c Wed Feb 09 11:22:49 2011 +0000
+++ b/usr.sbin/ldpd/mpls_interface.c Wed Feb 09 11:38:57 2011 +0000
@@ -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 @@
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 @@
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) {
diff -r 98fb9f0c94d9 -r 4c23eddb693b usr.sbin/ldpd/mpls_routes.c
--- a/usr.sbin/ldpd/mpls_routes.c Wed Feb 09 11:22:49 2011 +0000
+++ b/usr.sbin/ldpd/mpls_routes.c Wed Feb 09 11:38:57 2011 +0000
@@ -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 @@
/* 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)
Home |
Main Index |
Thread Index |
Old Index