summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2013-06-04 02:28:27 +0000
committerclaudio <claudio@openbsd.org>2013-06-04 02:28:27 +0000
commit2a261b04a2e65f45e1984e19dd9f2ab90d0928fb (patch)
tree06bbc8e3d1894dd29176a7c042daa5689925aad8
parentRemove unused includes, constify cfattach and other small cleanings. (diff)
downloadwireguard-openbsd-2a261b04a2e65f45e1984e19dd9f2ab90d0928fb.tar.xz
wireguard-openbsd-2a261b04a2e65f45e1984e19dd9f2ab90d0928fb.zip
Cleanup ctl commands and remove unused variables inherited from ospfd
From Renato Westphal
-rw-r--r--usr.sbin/ldpd/interface.c25
-rw-r--r--usr.sbin/ldpd/ldpd.h30
-rw-r--r--usr.sbin/ldpd/ldpe.h7
3 files changed, 13 insertions, 49 deletions
diff --git a/usr.sbin/ldpd/interface.c b/usr.sbin/ldpd/interface.c
index 7c86d2b66f2..3441b564eee 100644
--- a/usr.sbin/ldpd/interface.c
+++ b/usr.sbin/ldpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.17 2013/06/04 02:25:28 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.18 2013/06/04 02:28:27 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -153,13 +153,11 @@ if_new(struct kif *kif)
kif->flags & IFF_MULTICAST)
iface->type = IF_TYPE_BROADCAST;
- /* get mtu, index and flags */
- iface->mtu = kif->mtu;
+ /* get index and flags */
iface->ifindex = kif->ifindex;
iface->flags = kif->flags;
iface->linkstate = kif->link_state;
iface->media_type = kif->media_type;
- iface->baudrate = kif->baudrate;
return (iface);
}
@@ -304,35 +302,30 @@ struct ctl_iface *
if_to_ctl(struct iface *iface)
{
static struct ctl_iface ictl;
- struct timeval tv, now, res;
+ struct timeval now;
+ struct adj *adj;
memcpy(ictl.name, iface->name, sizeof(ictl.name));
- ictl.rtr_id.s_addr = ldpe_router_id();
ictl.ifindex = iface->ifindex;
ictl.state = iface->state;
- ictl.mtu = iface->mtu;
- ictl.baudrate = iface->baudrate;
- ictl.holdtime = iface->hello_holdtime;
+ ictl.hello_holdtime = iface->hello_holdtime;
ictl.hello_interval = iface->hello_interval;
ictl.flags = iface->flags;
ictl.type = iface->type;
ictl.linkstate = iface->linkstate;
ictl.mediatype = iface->media_type;
- ictl.priority = iface->priority;
gettimeofday(&now, NULL);
- if (evtimer_pending(&iface->hello_timer, &tv)) {
- timersub(&tv, &now, &res);
- ictl.hello_timer = res.tv_sec;
- } else
- ictl.hello_timer = -1;
-
if (iface->state != IF_STA_DOWN &&
iface->uptime != 0) {
ictl.uptime = now.tv_sec - iface->uptime;
} else
ictl.uptime = 0;
+ ictl.adj_cnt = 0;
+ LIST_FOREACH(adj, &iface->adj_list, iface_entry)
+ ictl.adj_cnt++;
+
return (&ictl);
}
diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h
index b1e4da33580..c966f78ab40 100644
--- a/usr.sbin/ldpd/ldpd.h
+++ b/usr.sbin/ldpd/ldpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpd.h,v 1.40 2013/06/04 02:25:28 claudio Exp $ */
+/* $OpenBSD: ldpd.h,v 1.41 2013/06/04 02:28:27 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -210,20 +210,16 @@ struct iface {
LIST_HEAD(, if_addr) addr_list;
LIST_HEAD(, adj) adj_list;
- u_int64_t baudrate;
time_t uptime;
unsigned int ifindex;
int discovery_fd;
- int session_fd;
int state;
- int mtu;
u_int16_t hello_holdtime;
u_int16_t hello_interval;
u_int16_t flags;
enum iface_type type;
u_int8_t media_type;
u_int8_t linkstate;
- u_int8_t priority;
};
/* source of targeted hellos */
@@ -319,28 +315,16 @@ struct kif {
/* control data structures */
struct ctl_iface {
char name[IF_NAMESIZE];
- struct in_addr addr;
- struct in_addr mask;
- struct in_addr rtr_id;
- struct in_addr dr_id;
- struct in_addr dr_addr;
- struct in_addr bdr_id;
- struct in_addr bdr_addr;
- time_t hello_timer;
time_t uptime;
- u_int64_t baudrate;
unsigned int ifindex;
int state;
- int mtu;
- int nbr_cnt;
- int adj_cnt;
+ u_int16_t adj_cnt;
u_int16_t flags;
- u_int16_t holdtime;
+ u_int16_t hello_holdtime;
u_int16_t hello_interval;
enum iface_type type;
u_int8_t linkstate;
u_int8_t mediatype;
- u_int8_t priority;
};
struct ctl_adj {
@@ -354,16 +338,8 @@ struct ctl_adj {
struct ctl_nbr {
struct in_addr id;
struct in_addr addr;
- struct in_addr dr;
- struct in_addr bdr;
time_t uptime;
- u_int32_t db_sum_lst_cnt;
- u_int32_t ls_req_lst_cnt;
- u_int32_t ls_retrans_lst_cnt;
- u_int32_t state_chng_cnt;
int nbr_state;
- u_int8_t priority;
- u_int8_t options;
};
struct ctl_rt {
diff --git a/usr.sbin/ldpd/ldpe.h b/usr.sbin/ldpd/ldpe.h
index 33c68227f32..e9f7255b04f 100644
--- a/usr.sbin/ldpd/ldpe.h
+++ b/usr.sbin/ldpd/ldpe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpe.h,v 1.25 2013/06/04 02:25:28 claudio Exp $ */
+/* $OpenBSD: ldpe.h,v 1.26 2013/06/04 02:28:27 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -77,11 +77,6 @@ struct nbr {
int idtimer_cnt;
u_int16_t keepalive;
-
- u_int8_t priority;
- u_int8_t options;
-
- u_int8_t flags;
};
struct mapping_entry {