summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-05-25 13:29:46 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-05-25 13:29:46 +0000
commitb8379c16519a0f48b0a4538d8b652d8f6a32fa19 (patch)
tree6aa71bc35971a422b7ef5a4afdad1b0df404b3c4 /usr.sbin/ldpd
parent61d994d521f0b9eee9813a2d94cb06b3b7369afc (diff)
Remove another leftover from ospfd. ldpd does not have a concept of ext_tag
and so there is no need to carry ext_tag and rtlabels around. "Yes! kill kill kill" michele@
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r--usr.sbin/ldpd/Makefile4
-rw-r--r--usr.sbin/ldpd/kroute.c36
-rw-r--r--usr.sbin/ldpd/lde.c4
-rw-r--r--usr.sbin/ldpd/lde.h3
-rw-r--r--usr.sbin/ldpd/ldpd.h24
-rw-r--r--usr.sbin/ldpd/name2id.c228
-rw-r--r--usr.sbin/ldpd/parse.y14
-rw-r--r--usr.sbin/ldpd/printconf.c14
8 files changed, 9 insertions, 318 deletions
diff --git a/usr.sbin/ldpd/Makefile b/usr.sbin/ldpd/Makefile
index 93ecc267177..f011dc8d548 100644
--- a/usr.sbin/ldpd/Makefile
+++ b/usr.sbin/ldpd/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.1 2009/06/01 20:59:45 michele Exp $
+# $OpenBSD: Makefile,v 1.2 2010/05/25 13:29:45 claudio Exp $
PROG= ldpd
SRCS= address.c buffer.c control.c hello.c imsg.c init.c interface.c \
keepalive.c kroute.c labelmapping.c lde.c lde_lib.c ldpd.c ldpe.c \
- log.c name2id.c neighbor.c notification.c packet.c parse.y printconf.c
+ log.c neighbor.c notification.c packet.c parse.y printconf.c
MAN= ldpd.8 ldpd.conf.5
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index 94e846e5dd3..cfcc3d6b31a 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.11 2010/05/19 13:13:36 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.12 2010/05/25 13:29:45 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -199,9 +199,6 @@ kr_change_fib(struct kroute_node *kr, struct kroute *kroute, int action)
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.ext_tag = kroute->ext_tag;
- rtlabel_unref(kr->r.rtlabel); /* for RTM_CHANGE */
- kr->r.rtlabel = kroute->rtlabel;
/* send update */
if (send_rtmsg(kr_state.fd, action, &kr->r, AF_MPLS) == -1)
@@ -222,8 +219,6 @@ kr_change(struct kroute *kroute)
struct kroute_node *kr;
int action = RTM_ADD;
- kroute->rtlabel = rtlabel_tag2id(kroute->ext_tag);
-
kr = kroute_find_fec(kroute->prefix.s_addr, kroute->prefixlen,
kroute->nexthop.s_addr);
@@ -701,7 +696,6 @@ kroute_remove(struct kroute_node *kr)
}
kr_redist_remove(kr);
- rtlabel_unref(kr->r.rtlabel);
free(kr);
return (0);
@@ -1185,7 +1179,6 @@ fetchtable(void)
struct rt_msghdr *rtm;
struct sockaddr *sa, *rti_info[RTAX_MAX];
struct sockaddr_in *sa_in;
- struct sockaddr_rtlabel *label;
struct sockaddr_mpls *sa_mpls;
struct kroute_node *kr;
@@ -1277,13 +1270,6 @@ fetchtable(void)
!= NULL)
kr->r.local_label = sa_mpls->smpls_label;
- if ((label = (struct sockaddr_rtlabel *)
- rti_info[RTAX_LABEL]) != NULL) {
- kr->r.rtlabel =
- rtlabel_name2id(label->sr_label);
- kr->r.ext_tag =
- rtlabel_id2tag(kr->r.rtlabel);
- }
kroute_insert(kr);
}
@@ -1376,7 +1362,6 @@ dispatch_rtmsg(void)
struct ifa_msghdr *ifam;
struct sockaddr *sa, *rti_info[RTAX_MAX];
struct sockaddr_in *sa_in;
- struct sockaddr_rtlabel *label;
struct kroute_node *kr;
struct in_addr prefix, nexthop;
u_int8_t prefixlen;
@@ -1485,17 +1470,6 @@ dispatch_rtmsg(void)
kr->r.flags = flags;
kr->r.ifindex = ifindex;
- rtlabel_unref(kr->r.rtlabel);
- kr->r.rtlabel = 0;
- kr->r.ext_tag = 0;
- if ((label = (struct sockaddr_rtlabel *)
- rti_info[RTAX_LABEL]) != NULL) {
- kr->r.rtlabel =
- rtlabel_name2id(label->sr_label);
- kr->r.ext_tag =
- rtlabel_id2tag(kr->r.rtlabel);
- }
-
if (kif_validate(kr->r.ifindex))
kr->r.flags &= ~F_DOWN;
else
@@ -1518,14 +1492,6 @@ dispatch_rtmsg(void)
kr->r.local_label = NO_LABEL;
kr->r.remote_label = NO_LABEL;
- if ((label = (struct sockaddr_rtlabel *)
- rti_info[RTAX_LABEL]) != NULL) {
- kr->r.rtlabel =
- rtlabel_name2id(label->sr_label);
- kr->r.ext_tag =
- rtlabel_id2tag(kr->r.rtlabel);
- }
-
kroute_insert(kr);
}
break;
diff --git a/usr.sbin/ldpd/lde.c b/usr.sbin/ldpd/lde.c
index 34ede6c55c5..2213fbc66ff 100644
--- a/usr.sbin/ldpd/lde.c
+++ b/usr.sbin/ldpd/lde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.c,v 1.13 2010/05/25 09:35:45 claudio Exp $ */
+/* $OpenBSD: lde.c,v 1.14 2010/05/25 13:29:45 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -441,7 +441,6 @@ lde_send_insert_klabel(struct rt_node *r)
kr.local_label = r->local_label;
kr.remote_label = r->remote_label;
kr.prefixlen = r->prefixlen;
- kr.ext_tag = r->ext_tag;
imsg_compose_event(iev_main, IMSG_KLABEL_INSERT, 0, 0, -1,
&kr, sizeof(kr));
@@ -458,7 +457,6 @@ lde_send_change_klabel(struct rt_node *r)
kr.local_label = r->local_label;
kr.remote_label = r->remote_label;
kr.prefixlen = r->prefixlen;
- kr.ext_tag = r->ext_tag;
imsg_compose_event(iev_main, IMSG_KLABEL_CHANGE, 0, 0, -1,
&kr, sizeof(kr));
diff --git a/usr.sbin/ldpd/lde.h b/usr.sbin/ldpd/lde.h
index 9647fc661e5..331df88872b 100644
--- a/usr.sbin/ldpd/lde.h
+++ b/usr.sbin/ldpd/lde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde.h,v 1.9 2010/05/25 09:31:25 claudio Exp $ */
+/* $OpenBSD: lde.h,v 1.10 2010/05/25 13:29:45 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -83,7 +83,6 @@ struct rt_node {
u_int32_t local_label;
u_int32_t remote_label;
- u_int32_t ext_tag;
u_int16_t lspace;
u_int8_t flags;
u_int8_t prefixlen;
diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h
index 80233d849fe..1947219051c 100644
--- a/usr.sbin/ldpd/ldpd.h
+++ b/usr.sbin/ldpd/ldpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.h,v 1.19 2010/05/25 09:35:45 claudio Exp $ */
+/* $OpenBSD: ldpd.h,v 1.20 2010/05/25 13:29:45 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -275,8 +275,6 @@ struct kroute {
u_int32_t local_label;
u_int32_t remote_label;
u_int16_t flags;
- u_int16_t rtlabel;
- u_int32_t ext_tag;
u_short ifindex;
u_int8_t prefixlen;
u_int8_t priority;
@@ -300,18 +298,6 @@ struct kif {
u_int8_t nh_reachable; /* for nexthop verification */
};
-/* name2id */
-struct n2id_label {
- TAILQ_ENTRY(n2id_label) entry;
- char *name;
- u_int16_t id;
- u_int32_t ext_tag;
- int ref;
-};
-
-TAILQ_HEAD(n2id_labels, n2id_label);
-extern struct n2id_labels rt_labels;
-
/* control data structures */
struct ctl_iface {
char name[IF_NAMESIZE];
@@ -429,14 +415,6 @@ const char *if_state_name(int);
const char *if_type_name(enum iface_type);
const char *notification_name(u_int32_t);
-/* name2id.c */
-u_int16_t rtlabel_name2id(const char *);
-const char *rtlabel_id2name(u_int16_t);
-void rtlabel_unref(u_int16_t);
-u_int32_t rtlabel_id2tag(u_int16_t);
-u_int16_t rtlabel_tag2id(u_int32_t);
-void rtlabel_tag(u_int16_t, u_int32_t);
-
/* ldpd.c */
void main_imsg_compose_ldpe(int, pid_t, void *, u_int16_t);
void main_imsg_compose_lde(int, pid_t, void *, u_int16_t);
diff --git a/usr.sbin/ldpd/name2id.c b/usr.sbin/ldpd/name2id.c
index 23f8ea773a7..e69de29bb2d 100644
--- a/usr.sbin/ldpd/name2id.c
+++ b/usr.sbin/ldpd/name2id.c
@@ -1,228 +0,0 @@
-/* $OpenBSD: name2id.c,v 1.1 2009/06/01 20:59:45 michele Exp $ */
-
-/*
- * Copyright (c) 2004, 2005 Henning Brauer <henning@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <net/route.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ldpd.h"
-
-#define IDVAL_MAX 50000
-
-u_int16_t _name2id(struct n2id_labels *, const char *);
-const char *_id2name(struct n2id_labels *, u_int16_t);
-u_int32_t _id2tag(struct n2id_labels *, u_int16_t);
-u_int16_t _tag2id(struct n2id_labels *, u_int32_t);
-void _tag(struct n2id_labels *, u_int16_t, u_int32_t);
-void _unref(struct n2id_labels *, u_int16_t);
-void _ref(struct n2id_labels *, u_int16_t);
-
-struct n2id_labels rt_labels = TAILQ_HEAD_INITIALIZER(rt_labels);
-
-u_int16_t
-rtlabel_name2id(const char *name)
-{
- return (_name2id(&rt_labels, name));
-}
-
-const char *
-rtlabel_id2name(u_int16_t id)
-{
- return (_id2name(&rt_labels, id));
-}
-
-u_int32_t
-rtlabel_id2tag(u_int16_t id)
-{
- return (_id2tag(&rt_labels, id));
-}
-
-u_int16_t
-rtlabel_tag2id(u_int32_t tag)
-{
- return (_tag2id(&rt_labels, tag));
-}
-
-void
-rtlabel_tag(u_int16_t id, u_int32_t tag)
-{
- _tag(&rt_labels, id, tag);
-}
-
-void
-rtlabel_unref(u_int16_t id)
-{
- _unref(&rt_labels, id);
-}
-
-/*
-void
-rtlabel_ref(u_int16_t id)
-{
- _ref(&rt_labels, id);
-}
-*/
-
-u_int16_t
-_name2id(struct n2id_labels *head, const char *name)
-{
- struct n2id_label *label, *p = NULL;
- u_int16_t new_id = 1;
-
- if (!name[0]) {
- errno = EINVAL;
- return (0);
- }
-
- TAILQ_FOREACH(label, head, entry)
- if (strcmp(name, label->name) == 0) {
- label->ref++;
- return (label->id);
- }
-
- /*
- * to avoid fragmentation, we do a linear search from the beginning
- * and take the first free slot we find. if there is none or the list
- * is empty, append a new entry at the end.
- */
-
- if (!TAILQ_EMPTY(head))
- for (p = TAILQ_FIRST(head); p != NULL &&
- p->id == new_id; p = TAILQ_NEXT(p, entry))
- new_id = p->id + 1;
-
- if (new_id > IDVAL_MAX) {
- errno = ERANGE;
- return (0);
- }
-
- if ((label = calloc(1, sizeof(struct n2id_label))) == NULL)
- return (0);
- if ((label->name = strdup(name)) == NULL) {
- free(label);
- return (0);
- }
- label->id = new_id;
- label->ref++;
-
- if (p != NULL) /* insert new entry before p */
- TAILQ_INSERT_BEFORE(p, label, entry);
- else /* either list empty or no free slot in between */
- TAILQ_INSERT_TAIL(head, label, entry);
-
- return (label->id);
-}
-
-const char *
-_id2name(struct n2id_labels *head, u_int16_t id)
-{
- struct n2id_label *label;
-
- if (id == 0)
- return ("");
-
- TAILQ_FOREACH(label, head, entry)
- if (label->id == id)
- return (label->name);
-
- return ("");
-}
-
-u_int32_t
-_id2tag(struct n2id_labels *head, u_int16_t id)
-{
- struct n2id_label *label;
-
- if (id == 0)
- return (0);
-
- TAILQ_FOREACH(label, head, entry)
- if (label->id == id)
- return (label->ext_tag);
-
- return (0);
-}
-
-u_int16_t
-_tag2id(struct n2id_labels *head, u_int32_t tag)
-{
- struct n2id_label *label;
-
- if (tag == 0)
- return (0);
-
- TAILQ_FOREACH(label, head, entry)
- if (label->ext_tag == tag)
- return (label->id);
-
- return (0);
-}
-
-void
-_tag(struct n2id_labels *head, u_int16_t id, u_int32_t tag)
-{
- struct n2id_label *label;
-
- if (id == 0)
- return;
-
- TAILQ_FOREACH(label, head, entry)
- if (label->id == id)
- label->ext_tag = tag;
-}
-
-void
-_unref(struct n2id_labels *head, u_int16_t id)
-{
- struct n2id_label *p, *next;
-
- if (id == 0)
- return;
-
- for (p = TAILQ_FIRST(head); p != NULL; p = next) {
- next = TAILQ_NEXT(p, entry);
- if (id == p->id) {
- if (--p->ref == 0) {
- TAILQ_REMOVE(head, p, entry);
- free(p->name);
- free(p);
- }
- break;
- }
- }
-}
-
-void
-_ref(struct n2id_labels *head, u_int16_t id)
-{
- struct n2id_label *label;
-
- if (id == 0)
- return;
-
- TAILQ_FOREACH(label, head, entry)
- if (label->id == id) {
- ++label->ref;
- break;
- }
-}
diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y
index 09bb62beebb..86b70200404 100644
--- a/usr.sbin/ldpd/parse.y
+++ b/usr.sbin/ldpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.3 2010/02/18 15:25:28 michele Exp $ */
+/* $OpenBSD: parse.y,v 1.4 2010/05/25 13:29:45 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -107,7 +107,7 @@ typedef struct {
%}
-%token LSPACE INTERFACE ROUTERID LFIBUPDATE RTLABEL
+%token LSPACE INTERFACE ROUTERID LFIBUPDATE
%token HOLDTIME HELLOINTERVAL KEEPALIVE
%token DISTRIBUTION RETENTION ADVERTISEMENT
%token EXTTAG PASSIVE
@@ -212,15 +212,6 @@ conf_main : ROUTERID STRING {
YYERROR;
}
}
- | RTLABEL STRING EXTTAG NUMBER {
- if ($4 < 0 || $4 > UINT_MAX) {
- yyerror("invalid external route tag");
- free($2);
- YYERROR;
- }
- rtlabel_tag(rtlabel_name2id($2), $4);
- free($2);
- }
| defaults
;
defaults : HOLDTIME NUMBER {
@@ -365,7 +356,6 @@ lookup(char *s)
{"passive", PASSIVE},
{"retention", RETENTION},
{"router-id", ROUTERID},
- {"rtlabel", RTLABEL},
{"yes", YES}
};
const struct keywords *p;
diff --git a/usr.sbin/ldpd/printconf.c b/usr.sbin/ldpd/printconf.c
index 9114e978201..f9833380cda 100644
--- a/usr.sbin/ldpd/printconf.c
+++ b/usr.sbin/ldpd/printconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printconf.c,v 1.2 2010/02/18 15:27:31 claudio Exp $ */
+/* $OpenBSD: printconf.c,v 1.3 2010/05/25 13:29:45 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -29,7 +29,6 @@
#include "ldpe.h"
void print_mainconf(struct ldpd_conf *);
-void print_rtlabel(struct ldpd_conf *);
void print_iface(struct iface *);
void
@@ -54,17 +53,6 @@ print_mainconf(struct ldpd_conf *conf)
}
void
-print_rtlabel(struct ldpd_conf *conf)
-{
- struct n2id_label *label;
-
- TAILQ_FOREACH(label, &rt_labels, entry)
- if (label->ext_tag)
- printf("rtlabel \"%s\" external-tag %u\n",
- label->name, label->ext_tag);
-}
-
-void
print_iface(struct iface *iface)
{
printf("\ninterface %s {\n", iface->name);