From fafcca9d0e42d9a6e03ef570d77dca5315942a58 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 13 Dec 2007 08:54:06 +0000 Subject: Monster commit of stuff I did mostly last month. What it does: * removes kif and uses iface for everything interface related. This removes unneeded data redundancy which makes the code more complex. * adds the link local prefix to struct iface and attaches a list with the other prefixes to the struct iface. This is needed to generate the link LSA. * disconnects struct iface from struct area (the backpointer is gone) this will make the reload code a bit easier. norby@ agrees with the direction we're heading with this --- usr.sbin/ospf6d/parse.y | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) (limited to 'usr.sbin/ospf6d/parse.y') diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y index 5235bf2821e..0bc09123b30 100644 --- a/usr.sbin/ospf6d/parse.y +++ b/usr.sbin/ospf6d/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.11 2007/11/12 23:59:41 mpf Exp $ */ +/* $OpenBSD: parse.y,v 1.12 2007/12/13 08:54:05 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby @@ -101,7 +101,6 @@ struct config_defaults ifacedefs; struct config_defaults *defs; struct area *conf_get_area(struct in_addr); -struct iface *conf_get_if(struct kif *, struct kif_addr *); typedef struct { union { @@ -436,24 +435,18 @@ areaoptsl : interface ; interface : INTERFACE STRING { - struct kif *kif; - struct kif_addr *ka = NULL; - - if ((kif = kif_findname($2, &ka)) == NULL) { + if ((iface = if_findname($2)) == NULL) { yyerror("unknown interface %s", $2); free($2); YYERROR; } - if (ka == NULL) { + if (IN6_IS_ADDR_UNSPECIFIED(&iface->addr)) { yyerror("unnumbered interface %s", $2); free($2); YYERROR; } free($2); - iface = conf_get_if(kif, ka); - if (iface == NULL) - YYERROR; - iface->area = area; + iface->area_id.s_addr = area->id.s_addr; LIST_INSERT_HEAD(&area->iface_list, iface, entry); memcpy(&ifacedefs, defs, sizeof(ifacedefs)); @@ -465,6 +458,7 @@ interface : INTERFACE STRING { iface->rxmt_interval = defs->rxmt_interval; iface->metric = defs->metric; iface->priority = defs->priority; + iface->cflags |= F_IFACE_CONFIGURED; iface = NULL; /* interface is always part of an area */ defs = &areadefs; @@ -480,7 +474,7 @@ interfaceopts_l : interfaceopts_l interfaceoptsl nl | interfaceoptsl optnl ; -interfaceoptsl : PASSIVE { iface->passive = 1; } +interfaceoptsl : PASSIVE { iface->cflags |= F_IFACE_PASSIVE; } | DEMOTE STRING { if (strlcpy(iface->demote_group, $2, sizeof(iface->demote_group)) >= @@ -1020,26 +1014,6 @@ conf_get_area(struct in_addr id) return (a); } -struct iface * -conf_get_if(struct kif *kif, struct kif_addr *ka) -{ - struct area *a; - struct iface *i; - - LIST_FOREACH(a, &conf->area_list, entry) - LIST_FOREACH(i, &a->iface_list, entry) - if (i->ifindex == kif->ifindex /*&& XXX - i->addr.s_addr == ka->addr.s_addr*/) { - yyerror("interface %s already configured", - kif->ifname); - return (NULL); - } - - i = if_new(kif, ka); - - return (i); -} - void clear_config(struct ospfd_conf *xconf) { -- cgit v1.2.3