summaryrefslogtreecommitdiff
path: root/nest/config.Y
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-03-31 00:56:44 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2014-03-31 01:52:28 +0200
commitd7c0628591b802e202903b63fce53b6a422a3db2 (patch)
tree2202050e07a73c435785565b6e74e0116f8fad39 /nest/config.Y
parent0c3d9dacafdb807d2101c67610969707353f434a (diff)
Check validity of interface definitions.
Thanks to Aleksey Berezin for the bugreport.
Diffstat (limited to 'nest/config.Y')
-rw-r--r--nest/config.Y14
1 files changed, 14 insertions, 0 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 59d354b8..5b544e59 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -24,6 +24,17 @@ static list *this_p_list;
static struct password_item *this_p_item;
static int password_id;
+static void
+iface_patt_check(void)
+{
+ struct iface_patt_node *pn;
+
+ WALK_LIST(pn, this_ipatt->ipn_list)
+ if (!pn->pattern || pn->pxlen)
+ cf_error("Interface name/mask expected, not IP prefix");
+}
+
+
static inline void
reset_passwords(void)
{
@@ -272,6 +283,9 @@ iface_patt_list:
| iface_patt_list ',' iface_patt_node
;
+/* For name/mask-only iface patterns */
+iface_patt_list_nopx: iface_patt_list { iface_patt_check(); }
+
iface_patt_init: {
/* Generic this_ipatt init */
this_ipatt = cfg_allocz(sizeof(struct iface_patt));