summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2010-06-30 01:47:11 +0000
committerclaudio <claudio@openbsd.org>2010-06-30 01:47:11 +0000
commit1b9b024e22c6dd453c1b4bcf7f0be95924954b28 (patch)
tree1f579a8405dd5fb084bde24e20c2400bea5aa398
parentclarify why carp demotion is necessary, and who is doing it. (diff)
downloadwireguard-openbsd-1b9b024e22c6dd453c1b4bcf7f0be95924954b28.tar.xz
wireguard-openbsd-1b9b024e22c6dd453c1b4bcf7f0be95924954b28.zip
Switch prefix in struct map to a struct in_addr instead of a u_int32_t.
Needed for further clean etc.
-rw-r--r--usr.sbin/ldpd/labelmapping.c14
-rw-r--r--usr.sbin/ldpd/lde.c4
-rw-r--r--usr.sbin/ldpd/lde_lib.c10
-rw-r--r--usr.sbin/ldpd/ldpd.h4
-rw-r--r--usr.sbin/ldpd/neighbor.c6
5 files changed, 19 insertions, 19 deletions
diff --git a/usr.sbin/ldpd/labelmapping.c b/usr.sbin/ldpd/labelmapping.c
index 0a005506e83..6667f93decd 100644
--- a/usr.sbin/ldpd/labelmapping.c
+++ b/usr.sbin/ldpd/labelmapping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: labelmapping.c,v 1.12 2010/06/09 14:01:03 claudio Exp $ */
+/* $OpenBSD: labelmapping.c,v 1.13 2010/06/30 01:47:11 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -134,7 +134,7 @@ recv_labelmapping(struct nbr *nbr, char *buf, u_int16_t len)
do {
if ((tlen = tlv_decode_fec_elm(buf, feclen, &addr_type,
- &map.prefix, &map.prefixlen)) == -1 ||
+ &map.prefix.s_addr, &map.prefixlen)) == -1 ||
addr_type == FEC_WILDCARD) {
session_shutdown(nbr, S_BAD_TLV_VAL, lm->msgid,
lm->type);
@@ -229,7 +229,7 @@ recv_labelrequest(struct nbr *nbr, char *buf, u_int16_t len)
do {
if ((tlen = tlv_decode_fec_elm(buf, feclen, &addr_type,
- &map.prefix, &map.prefixlen)) == -1 ||
+ &map.prefix.s_addr, &map.prefixlen)) == -1 ||
addr_type == FEC_WILDCARD) {
session_shutdown(nbr, S_BAD_TLV_VAL, lr->msgid,
lr->type);
@@ -349,14 +349,14 @@ recv_labelwithdraw(struct nbr *nbr, char *buf, u_int16_t len)
}
do {
if ((tlen = tlv_decode_fec_elm(buf, feclen, &addr_type,
- &map.prefix, &map.prefixlen)) == -1) {
+ &map.prefix.s_addr, &map.prefixlen)) == -1) {
session_shutdown(nbr, S_BAD_TLV_VAL, lw->msgid,
lw->type);
return (-1);
}
if (addr_type == FEC_WILDCARD) {
- map.prefix = 0;
+ map.prefix.s_addr = 0;
map.prefixlen = 0;
map.flags |= F_MAP_WILDCARD;
@@ -476,14 +476,14 @@ recv_labelrelease(struct nbr *nbr, char *buf, u_int16_t len)
}
do {
if ((tlen = tlv_decode_fec_elm(buf, feclen, &addr_type,
- &map.prefix, &map.prefixlen)) == -1) {
+ &map.prefix.s_addr, &map.prefixlen)) == -1) {
session_shutdown(nbr, S_BAD_TLV_VAL, lr->msgid,
lr->type);
return (-1);
}
if (addr_type == FEC_WILDCARD) {
- map.prefix = 0;
+ map.prefix.s_addr = 0;
map.prefixlen = 0;
map.flags |= F_MAP_WILDCARD;
diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c
index e1fc76a4609..5fd2328a3eb 100644
--- a/usr.sbin/ldpd/lde.c
+++ b/usr.sbin/ldpd/lde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.c,v 1.17 2010/06/09 13:32:15 claudio Exp $ */
+/* $OpenBSD: lde.c,v 1.18 2010/06/30 01:47:11 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -607,7 +607,7 @@ lde_nbr_do_mappings(struct rt_node *rn)
struct map map;
map.label = rn->local_label;
- map.prefix = rn->fec.prefix.s_addr;
+ map.prefix = rn->fec.prefix;
map.prefixlen = rn->fec.prefixlen;
RB_FOREACH(ln, nbr_tree, &lde_nbrs) {
diff --git a/usr.sbin/ldpd/lde_lib.c b/usr.sbin/ldpd/lde_lib.c
index 8c1b26429e6..4d1366555d1 100644
--- a/usr.sbin/ldpd/lde_lib.c
+++ b/usr.sbin/ldpd/lde_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde_lib.c,v 1.21 2010/06/09 14:01:03 claudio Exp $ */
+/* $OpenBSD: lde_lib.c,v 1.22 2010/06/30 01:47:11 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -159,7 +159,7 @@ rt_snap(u_int32_t peerid)
bzero(&map, sizeof(map));
RB_FOREACH(f, fec_tree, &rt) {
r = (struct rt_node *)f;
- map.prefix = r->fec.prefix.s_addr;
+ map.prefix = r->fec.prefix;
map.prefixlen = r->fec.prefixlen;
map.label = r->local_label;
@@ -314,7 +314,7 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
log_debug("label mapping from nbr %s, FEC %s/%u, label %u",
inet_ntoa(ln->id), log_fec(map), map->label);
- rn = (struct rt_node *)fec_find_prefix(&rt, map->prefix,
+ rn = (struct rt_node *)fec_find_prefix(&rt, map->prefix.s_addr,
map->prefixlen);
if (rn == NULL) {
/* The route is not yet in fib. If we are in liberal mode
@@ -326,7 +326,7 @@ lde_check_mapping(struct map *map, struct lde_nbr *ln)
if (rn == NULL)
fatal("lde_check_mapping");
- rn->fec.prefix.s_addr = map->prefix;
+ rn->fec.prefix = map->prefix;
rn->fec.prefixlen = map->prefixlen;
rn->local_label = lde_assign_label();
rn->remote_label = NO_LABEL;
@@ -419,7 +419,7 @@ lde_check_request(struct map *map, struct lde_nbr *ln)
log_debug("label request from nbr %s, FEC %s",
inet_ntoa(ln->id), log_fec(map));
- rn = (struct rt_node *)fec_find_prefix(&rt, map->prefix,
+ rn = (struct rt_node *)fec_find_prefix(&rt, map->prefix.s_addr,
map->prefixlen);
if (rn == NULL || rn->remote_label == NO_LABEL) {
lde_send_notification(ln->peerid, S_NO_ROUTE, map->messageid,
diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h
index 236065e1900..3bf282ae126 100644
--- a/usr.sbin/ldpd/ldpd.h
+++ b/usr.sbin/ldpd/ldpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.h,v 1.21 2010/05/26 13:56:07 nicm Exp $ */
+/* $OpenBSD: ldpd.h,v 1.22 2010/06/30 01:47:11 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -184,7 +184,7 @@ enum nbr_action {
TAILQ_HEAD(mapping_head, mapping_entry);
struct map {
- u_int32_t prefix;
+ struct in_addr prefix;
u_int32_t label;
u_int32_t messageid;
u_int32_t requestid;
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c
index 8394676041e..fa3d58ebfe0 100644
--- a/usr.sbin/ldpd/neighbor.c
+++ b/usr.sbin/ldpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.17 2010/06/10 10:04:10 claudio Exp $ */
+/* $OpenBSD: neighbor.c,v 1.18 2010/06/30 01:47:11 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -608,7 +608,7 @@ nbr_mapping_add(struct nbr *nbr, struct mapping_head *mh, struct map *map)
if (me == NULL)
fatal("nbr_mapping_add");
- me->prefix = map->prefix;
+ me->prefix = map->prefix.s_addr;
me->prefixlen = map->prefixlen;
me->label = map->label;
@@ -621,7 +621,7 @@ nbr_mapping_find(struct nbr *nbr, struct mapping_head *mh, struct map *map)
struct mapping_entry *me = NULL;
TAILQ_FOREACH(me, mh, entry) {
- if (me->prefix == map->prefix &&
+ if (me->prefix == map->prefix.s_addr &&
me->prefixlen == map->prefixlen)
return (me);
}