summaryrefslogtreecommitdiff
path: root/usr.sbin/dvmrpd
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2009-03-07 12:47:18 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2009-03-07 12:47:18 +0000
commit8872ac2dca9523913806b1a6d08496c1734dc84e (patch)
tree935f84f4d828a553740acf51b05c415d9e093d37 /usr.sbin/dvmrpd
parent5e131218ed75c75cece52976b0f57ace8d508990 (diff)
Get rid of rde_nbr structure as it is no more needed in RDE to make
routing decisions. ok claudio@
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r--usr.sbin/dvmrpd/dvmrpd.h4
-rw-r--r--usr.sbin/dvmrpd/neighbor.c10
-rw-r--r--usr.sbin/dvmrpd/rde.c117
-rw-r--r--usr.sbin/dvmrpd/rde.h11
4 files changed, 4 insertions, 138 deletions
diff --git a/usr.sbin/dvmrpd/dvmrpd.h b/usr.sbin/dvmrpd/dvmrpd.h
index 40923a8e221..9c02a357487 100644
--- a/usr.sbin/dvmrpd/dvmrpd.h
+++ b/usr.sbin/dvmrpd/dvmrpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvmrpd.h,v 1.14 2009/03/06 18:39:13 michele Exp $ */
+/* $OpenBSD: dvmrpd.h,v 1.15 2009/03/07 12:47:17 michele Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -109,8 +109,6 @@ enum imsg_type {
IMSG_FULL_ROUTE_REPORT_END,
IMSG_MFC_ADD,
IMSG_MFC_DEL,
- IMSG_NEIGHBOR_UP,
- IMSG_NEIGHBOR_DOWN,
IMSG_GROUP_ADD,
IMSG_GROUP_DEL,
IMSG_FLASH_UPDATE,
diff --git a/usr.sbin/dvmrpd/neighbor.c b/usr.sbin/dvmrpd/neighbor.c
index e5ae5ccab18..93c50b7230d 100644
--- a/usr.sbin/dvmrpd/neighbor.c
+++ b/usr.sbin/dvmrpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.5 2009/01/27 08:53:47 michele Exp $ */
+/* $OpenBSD: neighbor.c,v 1.6 2009/03/07 12:47:17 michele Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -188,7 +188,6 @@ nbr_new(u_int32_t nbr_id, struct iface *iface, int self)
{
struct nbr_head *head;
struct nbr *nbr = NULL;
- struct rde_nbr rn;
if ((nbr = calloc(1, sizeof(*nbr))) == NULL)
fatal("nbr_new");
@@ -212,11 +211,6 @@ nbr_new(u_int32_t nbr_id, struct iface *iface, int self)
/* set event structures */
evtimer_set(&nbr->inactivity_timer, nbr_itimer, nbr);
- bzero(&rn, sizeof(rn));
- rn.iface = iface;
- dvmrpe_imsg_compose_rde(IMSG_NEIGHBOR_UP, nbr->peerid, 0, &rn,
- sizeof(rn));
-
log_debug("nbr_new: neighbor ID %s, peerid %lu",
inet_ntoa(nbr->id), nbr->peerid);
@@ -226,8 +220,6 @@ nbr_new(u_int32_t nbr_id, struct iface *iface, int self)
int
nbr_del(struct nbr *nbr)
{
- dvmrpe_imsg_compose_rde(IMSG_NEIGHBOR_DOWN, nbr->peerid, 0, NULL, 0);
-
/* clear lists */
rr_list_clr(&nbr->rr_list);
diff --git a/usr.sbin/dvmrpd/rde.c b/usr.sbin/dvmrpd/rde.c
index b46c8421bde..6098765cacf 100644
--- a/usr.sbin/dvmrpd/rde.c
+++ b/usr.sbin/dvmrpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.11 2009/03/06 18:39:13 michele Exp $ */
+/* $OpenBSD: rde.c,v 1.12 2009/03/07 12:47:17 michele Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -39,12 +39,6 @@
#include "log.h"
#include "rde.h"
-void rde_nbr_init(u_int32_t);
-void rde_nbr_free(void);
-struct rde_nbr *rde_nbr_find(u_int32_t);
-struct rde_nbr *rde_nbr_new(u_int32_t, struct rde_nbr *);
-void rde_nbr_del(struct rde_nbr *);
-
void rde_sig_handler(int sig, short, void *);
void rde_shutdown(void);
void rde_dispatch_imsg(int, short, void *);
@@ -111,7 +105,6 @@ rde(struct dvmrpd_conf *xconf, int pipe_parent2rde[2], int pipe_dvmrpe2rde[2],
endpwent();
event_init();
- rde_nbr_init(NBR_HASHSIZE);
/* setup signal handler */
signal_set(&ev_sigint, SIGINT, rde_sig_handler, NULL);
@@ -165,7 +158,6 @@ rde_shutdown(void)
LIST_FOREACH(iface, &rdeconf->iface_list, entry) {
if_del(iface);
}
- rde_nbr_free();
msgbuf_clear(&ibuf_dvmrpe->w);
free(ibuf_dvmrpe);
@@ -198,7 +190,6 @@ rde_dispatch_imsg(int fd, short event, void *bula)
struct imsgbuf *ibuf = bula;
struct imsg imsg;
struct route_report rr;
- struct rde_nbr rn;
int i, n, connected = 0;
struct iface *iface;
@@ -277,19 +268,6 @@ rde_dispatch_imsg(int fd, short event, void *bula)
mfc_delete(&mfc);
#endif
break;
- case IMSG_NEIGHBOR_UP:
- if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(rn))
- fatalx("invalid size of OE request");
- memcpy(&rn, imsg.data, sizeof(rn));
-
- if (rde_nbr_new(imsg.hdr.peerid, &rn) == NULL)
- fatalx("rde_dispatch_imsg: "
- "neighbor already exists");
- break;
- case IMSG_NEIGHBOR_DOWN:
- rde_nbr_del(rde_nbr_find(imsg.hdr.peerid));
-
- break;
case IMSG_GROUP_ADD:
if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(mfc))
fatalx("invalid size of OE request");
@@ -326,99 +304,6 @@ rde_dispatch_imsg(int fd, short event, void *bula)
imsg_event_add(ibuf);
}
-LIST_HEAD(rde_nbr_head, rde_nbr);
-
-struct nbr_table {
- struct rde_nbr_head *hashtbl;
- u_int32_t hashmask;
-} rdenbrtable;
-
-#define RDE_NBR_HASH(x) \
- &rdenbrtable.hashtbl[(x) & rdenbrtable.hashmask]
-
-void
-rde_nbr_init(u_int32_t hashsize)
-{
- struct rde_nbr_head *head;
- u_int32_t hs, i;
-
- for (hs = 1; hs < hashsize; hs <<= 1)
- ;
- rdenbrtable.hashtbl = calloc(hs, sizeof(struct rde_nbr_head));
- if (rdenbrtable.hashtbl == NULL)
- fatal("rde_nbr_init");
-
- for (i = 0; i < hs; i++)
- LIST_INIT(&rdenbrtable.hashtbl[i]);
-
- rdenbrtable.hashmask = hs - 1;
-
- if ((nbrself = calloc(1, sizeof(*nbrself))) == NULL)
- fatal("rde_nbr_init");
-
- nbrself->peerid = NBR_IDSELF;
- head = RDE_NBR_HASH(NBR_IDSELF);
- LIST_INSERT_HEAD(head, nbrself, hash);
-}
-
-void
-rde_nbr_free(void)
-{
- free(nbrself);
- free(rdenbrtable.hashtbl);
-}
-
-struct rde_nbr *
-rde_nbr_find(u_int32_t peerid)
-{
- struct rde_nbr_head *head;
- struct rde_nbr *nbr;
-
- head = RDE_NBR_HASH(peerid);
-
- LIST_FOREACH(nbr, head, hash) {
- if (nbr->peerid == peerid)
- return (nbr);
- }
-
- return (NULL);
-}
-
-struct rde_nbr *
-rde_nbr_new(u_int32_t peerid, struct rde_nbr *new)
-{
- struct rde_nbr_head *head;
- struct rde_nbr *nbr;
-
- if (rde_nbr_find(peerid))
- return (NULL);
-
- if ((nbr = calloc(1, sizeof(*nbr))) == NULL)
- fatal("rde_nbr_new");
-
- memcpy(nbr, new, sizeof(*nbr));
- nbr->peerid = peerid;
-
- head = RDE_NBR_HASH(peerid);
- LIST_INSERT_HEAD(head, nbr, hash);
-
- return (nbr);
-}
-
-void
-rde_nbr_del(struct rde_nbr *nbr)
-{
- if (nbr == NULL)
- return;
-
- srt_expire_nbr(nbr->addr, nbr->iface);
-
- LIST_REMOVE(nbr, entry);
- LIST_REMOVE(nbr, hash);
-
- free(nbr);
-}
-
/* rde group functions */
void
rde_group_list_add(struct iface *iface, struct in_addr group)
diff --git a/usr.sbin/dvmrpd/rde.h b/usr.sbin/dvmrpd/rde.h
index 6410932dbdd..4a55e096165 100644
--- a/usr.sbin/dvmrpd/rde.h
+++ b/usr.sbin/dvmrpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.11 2009/03/06 18:39:13 michele Exp $ */
+/* $OpenBSD: rde.h,v 1.12 2009/03/07 12:47:17 michele Exp $ */
/*
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -61,15 +61,6 @@ struct mfc_node {
time_t uptime;
};
-/* just the infos rde needs */
-struct rde_nbr {
- LIST_ENTRY(rde_nbr) entry, hash;
- struct in_addr addr;
- u_int32_t peerid;
-
- struct iface *iface;
-};
-
/* downstream neighbor per source */
struct ds_nbr {
LIST_ENTRY(ds_nbr) entry;