summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-05-25 09:35:46 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-05-25 09:35:46 +0000
commit83f8184091e94b05e8d2b12af39914f7a5e2b900 (patch)
tree67945019023e0fd57900ecbf22d15f8a042317e0 /usr.sbin
parentc723a5093555c4005dbc0da7c48098ab7aeab5cc (diff)
Add upcomming IMSG_LABEL_RELEASE, IMSG_LABEL_WITHDRAW and IMSG_LABEL_ABORT.
Add missing bits to struct map and restructure/simplify the lde.c imsg code.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ldpd/lde.c35
-rw-r--r--usr.sbin/ldpd/ldpd.h10
2 files changed, 27 insertions, 18 deletions
diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c
index 09e44ada180..34ede6c55c5 100644
--- a/usr.sbin/ldpd/lde.c
+++ b/usr.sbin/ldpd/lde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.c,v 1.12 2010/05/19 15:28:51 claudio Exp $ */
+/* $OpenBSD: lde.c,v 1.13 2010/05/25 09:35:45 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -223,28 +223,17 @@ lde_dispatch_imsg(int fd, short event, void *bula)
break;
switch (imsg.hdr.type) {
- case IMSG_LABEL_MAPPING:
- if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(map))
- fatalx("invalid size of OE request");
- memcpy(&map, imsg.data, sizeof(map));
-
- nbr = lde_nbr_find(imsg.hdr.peerid);
- if (nbr == NULL) {
- log_debug("lde_dispatch_imsg: cannot find "
- "lde neighbor");
- return;
- }
-
- lde_check_mapping(&map, nbr);
- break;
case IMSG_LABEL_MAPPING_FULL:
rt_snap(imsg.hdr.peerid);
lde_imsg_compose_ldpe(IMSG_MAPPING_ADD_END,
imsg.hdr.peerid, 0, NULL, 0);
-
break;
+ case IMSG_LABEL_MAPPING:
case IMSG_LABEL_REQUEST:
+ case IMSG_LABEL_RELEASE:
+ case IMSG_LABEL_WITHDRAW:
+ case IMSG_LABEL_ABORT:
if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(map))
fatalx("invalid size of OE request");
memcpy(&map, imsg.data, sizeof(map));
@@ -256,7 +245,19 @@ lde_dispatch_imsg(int fd, short event, void *bula)
return;
}
- lde_check_request(&map, nbr);
+ switch (imsg.hdr.type) {
+ case IMSG_LABEL_MAPPING:
+ lde_check_mapping(&map, nbr);
+ break;
+ case IMSG_LABEL_REQUEST:
+ lde_check_request(&map, nbr);
+ break;
+ case IMSG_LABEL_RELEASE:
+ lde_check_release(&map, nbr);
+ break;
+ default:
+ log_warnx("not yet");
+ }
break;
case IMSG_ADDRESS_ADD:
if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(addr))
diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h
index da2e7e7b253..80233d849fe 100644
--- a/usr.sbin/ldpd/ldpd.h
+++ b/usr.sbin/ldpd/ldpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.h,v 1.18 2010/05/19 15:28:51 claudio Exp $ */
+/* $OpenBSD: ldpd.h,v 1.19 2010/05/25 09:35:45 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -91,6 +91,9 @@ enum imsg_type {
IMSG_LABEL_MAPPING,
IMSG_LABEL_MAPPING_FULL,
IMSG_LABEL_REQUEST,
+ IMSG_LABEL_RELEASE,
+ IMSG_LABEL_WITHDRAW,
+ IMSG_LABEL_ABORT,
IMSG_REQUEST_ADD,
IMSG_REQUEST_ADD_END,
IMSG_MAPPING_ADD,
@@ -184,8 +187,13 @@ struct map {
u_int32_t prefix;
u_int32_t label;
u_int32_t messageid;
+ u_int32_t requestid;
u_int8_t prefixlen;
+ u_int8_t flags;
};
+#define F_MAP_WILDCARD 0x01 /* wildcard FEC */
+#define F_MAP_OPTLABEL 0x02 /* optional label present */
+#define F_MAP_REQ_ID 0x04 /* optional request message id present */
struct notify_msg {
u_int32_t messageid;