summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-06-30 05:21:39 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-06-30 05:21:39 +0000
commit47b1bec7d8e79b7abff2d561aa1365cf4547da3b (patch)
tree0fbec181c1d62403061e05c3d09d54fc3867d6e7 /usr.sbin/ldpd
parentd6e7c69099ed85b9685b00cc7162aa0f5de698e4 (diff)
Kill IMSG_KLABEL_INSERT and all the related functions around it.
IMSG_KLABEL_CHANGE is smart enough to know when something is a change or an insert.
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r--usr.sbin/ldpd/kroute.c35
-rw-r--r--usr.sbin/ldpd/lde.c18
-rw-r--r--usr.sbin/ldpd/lde.h3
-rw-r--r--usr.sbin/ldpd/lde_lib.c4
-rw-r--r--usr.sbin/ldpd/ldpd.c8
-rw-r--r--usr.sbin/ldpd/ldpd.h4
6 files changed, 8 insertions, 64 deletions
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index 6946f4ffbb3..37d599b43f6 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.16 2010/06/30 05:07:09 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.17 2010/06/30 05:21:38 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -190,17 +190,10 @@ kr_init(int fs)
int
kr_change_fib(struct kroute_node *kr, struct kroute *kroute, int action)
{
- /* nexthop within 127/8 -> ignore silently */
- if ((kroute->nexthop.s_addr & htonl(IN_CLASSA_NET)) ==
- htonl(INADDR_LOOPBACK & IN_CLASSA_NET))
- return (0);
-
- kr->r.prefix.s_addr = kroute->prefix.s_addr;
- kr->r.prefixlen = kroute->prefixlen;
kr->r.local_label = kroute->local_label;
kr->r.remote_label = kroute->remote_label;
kr->r.nexthop.s_addr = kroute->nexthop.s_addr;
- kr->r.flags = kroute->flags | F_LDPD_INSERTED;
+ kr->r.flags = kr->r.flags | F_LDPD_INSERTED;
/* send update */
if (send_rtmsg(kr_state.fd, action, &kr->r, AF_MPLS) == -1)
@@ -622,30 +615,6 @@ kroute_insert(struct kroute_node *kr)
}
int
-kroute_insert_label(struct kroute *kr)
-{
- struct kroute_node *krn;
-
- krn = kroute_find(kr->prefix.s_addr, kr->prefixlen, RTP_ANY);
- if (krn == NULL) {
- log_debug("kroute_insert_label: prefix %s/%d not present",
- inet_ntoa(kr->prefix), kr->prefixlen);
- return (-1);
- }
-
- krn->r.flags |= F_LDPD_INSERTED;
- krn->r.local_label = kr->local_label;
- krn->r.remote_label = kr->remote_label;
-
- send_rtmsg(kr_state.fd, RTM_ADD, kr, AF_MPLS);
-
- if (kr->nexthop.s_addr != INADDR_ANY && kr->remote_label != NO_LABEL)
- send_rtmsg(kr_state.fd, RTM_CHANGE, kr, AF_INET);
-
- return (0);
-}
-
-int
kroute_remove(struct kroute_node *kr)
{
struct kroute_node *krm;
diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c
index 5fd2328a3eb..0a87fafa813 100644
--- a/usr.sbin/ldpd/lde.c
+++ b/usr.sbin/ldpd/lde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.c,v 1.18 2010/06/30 01:47:11 claudio Exp $ */
+/* $OpenBSD: lde.c,v 1.19 2010/06/30 05:21:38 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -431,22 +431,6 @@ lde_assign_label(void)
}
void
-lde_send_insert_klabel(struct rt_node *r)
-{
- struct kroute kr;
-
- bzero(&kr, sizeof(kr));
- kr.prefix.s_addr = r->fec.prefix.s_addr;
- kr.prefixlen = r->fec.prefixlen;
- kr.nexthop.s_addr = r->nexthop.s_addr;
- kr.local_label = r->local_label;
- kr.remote_label = r->remote_label;
-
- imsg_compose_event(iev_main, IMSG_KLABEL_INSERT, 0, 0, -1,
- &kr, sizeof(kr));
-}
-
-void
lde_send_change_klabel(struct rt_node *r)
{
struct kroute kr;
diff --git a/usr.sbin/ldpd/lde.h b/usr.sbin/ldpd/lde.h
index 71e4aa3a99e..16a09be974c 100644
--- a/usr.sbin/ldpd/lde.h
+++ b/usr.sbin/ldpd/lde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.h,v 1.13 2010/06/23 16:26:47 claudio Exp $ */
+/* $OpenBSD: lde.h,v 1.14 2010/06/30 05:21:38 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -95,7 +95,6 @@ struct rt_node {
pid_t lde(struct ldpd_conf *, int [2], int [2], int [2]);
int lde_imsg_compose_ldpe(int, u_int32_t, pid_t, void *, u_int16_t);
u_int32_t lde_assign_label(void);
-void lde_send_insert_klabel(struct rt_node *);
void lde_send_change_klabel(struct rt_node *);
void lde_send_delete_klabel(struct rt_node *);
void lde_send_labelmapping(u_int32_t, struct map *);
diff --git a/usr.sbin/ldpd/lde_lib.c b/usr.sbin/ldpd/lde_lib.c
index 4d1366555d1..3b4051a39fe 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.22 2010/06/30 01:47:11 claudio Exp $ */
+/* $OpenBSD: lde_lib.c,v 1.23 2010/06/30 05:21:38 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -260,7 +260,7 @@ lde_kernel_insert(struct kroute *kr)
rn->local_label = lde_assign_label();
}
- lde_send_insert_klabel(rn);
+ lde_send_change_klabel(rn);
/* Redistribute the current mapping to every nbr */
lde_nbr_do_mappings(rn);
diff --git a/usr.sbin/ldpd/ldpd.c b/usr.sbin/ldpd/ldpd.c
index 161244cd640..d63bcd1ce44 100644
--- a/usr.sbin/ldpd/ldpd.c
+++ b/usr.sbin/ldpd/ldpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.c,v 1.9 2010/06/02 16:01:41 claudio Exp $ */
+/* $OpenBSD: ldpd.c,v 1.10 2010/06/30 05:21:38 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -428,12 +428,6 @@ main_dispatch_lde(int fd, short event, void *bula)
break;
switch (imsg.hdr.type) {
- case IMSG_KLABEL_INSERT:
- if (imsg.hdr.len - IMSG_HEADER_SIZE !=
- sizeof(struct kroute))
- fatalx("invalid size of IMSG_KLABEL_INSERT");
- kroute_insert_label(imsg.data);
- break;
case IMSG_KLABEL_CHANGE:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
sizeof(struct kroute))
diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h
index 3bf282ae126..2aedb6147a0 100644
--- a/usr.sbin/ldpd/ldpd.h
+++ b/usr.sbin/ldpd/ldpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.h,v 1.22 2010/06/30 01:47:11 claudio Exp $ */
+/* $OpenBSD: ldpd.h,v 1.23 2010/06/30 05:21:38 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -84,7 +84,6 @@ enum imsg_type {
IMSG_CTL_IFINFO,
IMSG_CTL_END,
IMSG_CTL_LOG_VERBOSE,
- IMSG_KLABEL_INSERT,
IMSG_KLABEL_CHANGE,
IMSG_KLABEL_DELETE,
IMSG_IFINFO,
@@ -404,7 +403,6 @@ void kr_show_route(struct imsg *);
void kr_ifinfo(char *, pid_t);
struct kif *kif_findname(char *, struct in_addr, struct kif_addr **);
void kr_reload(void);
-int kroute_insert_label(struct kroute *);
u_int8_t mask2prefixlen(in_addr_t);
in_addr_t prefixlen2mask(u_int8_t);