diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2013-06-01 18:26:41 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2013-06-01 18:26:41 +0000 |
commit | a44037a34a18eb6de040fd10ed35e5be9286dac1 (patch) | |
tree | f5c795eaf2799e62d251820d75dc8f32b67a0fbe /usr.sbin | |
parent | 6c9f4e58bf9aa8a7dc666b91c25ec144a753d664 (diff) |
Don't allow enabling LDP on loopback and carp interfaces.
LDP should be allowed only on physical or tunnel interfaces.
Diff by Renato Westphal
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ldpd/interface.c | 14 | ||||
-rw-r--r-- | usr.sbin/ldpd/ldpd.h | 7 | ||||
-rw-r--r-- | usr.sbin/ldpd/log.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldpd/parse.y | 9 |
4 files changed, 13 insertions, 21 deletions
diff --git a/usr.sbin/ldpd/interface.c b/usr.sbin/ldpd/interface.c index 582197772fb..480e13bdb29 100644 --- a/usr.sbin/ldpd/interface.c +++ b/usr.sbin/ldpd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.11 2013/05/30 16:22:52 claudio Exp $ */ +/* $OpenBSD: interface.c,v 1.12 2013/06/01 18:26:40 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -52,7 +52,6 @@ struct { } iface_fsm[] = { /* current state event that happened action to take resulting state */ {IF_STA_DOWN, IF_EVT_UP, IF_ACT_STRT, 0}, - {IF_STA_LOOPBACK, IF_EVT_DOWN, IF_ACT_NOTHING, IF_STA_DOWN}, {IF_STA_ANY, IF_EVT_DOWN, IF_ACT_RST, IF_STA_DOWN}, {-1, IF_EVT_NOTHING, IF_ACT_NOTHING, 0}, }; @@ -143,10 +142,6 @@ if_new(struct kif *kif, struct kif_addr *ka) if (kif->flags & IFF_BROADCAST && kif->flags & IFF_MULTICAST) iface->type = IF_TYPE_BROADCAST; - if (kif->flags & IFF_LOOPBACK) { - iface->type = IF_TYPE_POINTOPOINT; - iface->state = IF_STA_LOOPBACK; - } /* get mtu, index and flags */ iface->mtu = kif->mtu; @@ -235,13 +230,6 @@ if_act_start(struct iface *iface) return (0); } - if (iface->media_type == IFT_CARP && iface->passive == 0) { - /* force passive mode on carp interfaces */ - log_warnx("if_act_start: forcing interface %s to passive", - iface->name); - iface->passive = 1; - } - gettimeofday(&now, NULL); iface->uptime = now.tv_sec; diff --git a/usr.sbin/ldpd/ldpd.h b/usr.sbin/ldpd/ldpd.h index d1780268727..9ac07a6d46e 100644 --- a/usr.sbin/ldpd/ldpd.h +++ b/usr.sbin/ldpd/ldpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpd.h,v 1.31 2013/06/01 18:16:35 claudio Exp $ */ +/* $OpenBSD: ldpd.h,v 1.32 2013/06/01 18:26:40 claudio Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -111,9 +111,8 @@ enum imsg_type { /* interface states */ #define IF_STA_NEW 0x00 /* dummy state for reload */ #define IF_STA_DOWN 0x01 -#define IF_STA_LOOPBACK 0x02 -#define IF_STA_ACTIVE 0x04 -#define IF_STA_ANY 0x07 +#define IF_STA_ACTIVE 0x02 +#define IF_STA_ANY (IF_STA_DOWN | IF_STA_ACTIVE) /* interface events */ enum iface_event { diff --git a/usr.sbin/ldpd/log.c b/usr.sbin/ldpd/log.c index ea0befd0462..ee85eedaecc 100644 --- a/usr.sbin/ldpd/log.c +++ b/usr.sbin/ldpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.9 2011/08/20 19:02:28 sthen Exp $ */ +/* $OpenBSD: log.c,v 1.10 2013/06/01 18:26:40 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -202,8 +202,6 @@ if_state_name(int state) switch (state) { case IF_STA_DOWN: return ("DOWN"); - case IF_STA_LOOPBACK: - return ("LOOP"); case IF_STA_ACTIVE: return ("ACTIVE"); default: diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y index e23b155e747..b8dbe4faec9 100644 --- a/usr.sbin/ldpd/parse.y +++ b/usr.sbin/ldpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.9 2013/05/30 15:44:37 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.10 2013/06/01 18:26:40 claudio Exp $ */ /* * Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org> @@ -32,6 +32,7 @@ #include <errno.h> #include <unistd.h> #include <ifaddrs.h> +#include <net/if_types.h> #include <limits.h> #include <stdarg.h> #include <stdio.h> @@ -287,6 +288,12 @@ interface : INTERFACE STRING { iface = conf_get_if(kif, ka); if (iface == NULL) YYERROR; + if (iface->media_type == IFT_LOOP || + iface->media_type == IFT_CARP) { + yyerror("unsupported interface type %s", + iface->name); + YYERROR; + } LIST_INSERT_HEAD(&conf->iface_list, iface, entry); memcpy(&ifacedefs, defs, sizeof(ifacedefs)); |