From 23c212e7f1e80a3c6b88b49918972bc28375bd51 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Mon, 21 Dec 2015 03:27:41 +0100 Subject: Follow-up work on integration --- proto/ospf/config.Y | 14 ++++++++++---- proto/ospf/ospf.c | 3 +++ proto/ospf/ospf.h | 14 +------------- proto/ospf/rt.c | 2 +- 4 files changed, 15 insertions(+), 18 deletions(-) (limited to 'proto/ospf') diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index e8fb7f2e..6d8fa755 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -130,21 +130,27 @@ CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK, ONLY, BFD) CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL) CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY) CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK, TX, PRIORITY, LENGTH) -CF_KEYWORDS(SECONDARY, MERGE, LSA, SUPPRESSION) +CF_KEYWORDS(SECONDARY, MERGE, LSA, SUPPRESSION, OSPF2, OSPF3) %type lsadb_args -%type nbma_eligible +%type ospf_variant nbma_eligible CF_GRAMMAR CF_ADDTO(proto, ospf_proto '}' { ospf_proto_finish(); } ) -ospf_proto_start: proto_start OSPF { +ospf_variant: + OSPF { $$ = 1; } + | OSPF2 { $$ = 1; } + | OSPF3 { $$ = 0; } + ; + +ospf_proto_start: proto_start ospf_variant { this_proto = proto_config_new(&proto_ospf, $1); init_list(&OSPF_CFG->area_list); init_list(&OSPF_CFG->vlink_list); OSPF_CFG->tick = OSPF_DEFAULT_TICK; - OSPF_CFG->ospf2 = OSPF_IS_V2; + OSPF_CFG->ospf2 = $2; } ; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 983f76f1..8008e4d8 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -648,6 +648,9 @@ ospf_reconfigure(struct proto *P, struct proto_config *c) if (proto_get_router_id(c) != p->router_id) return 0; + if (p->ospf2 != new->ospf2) + return 0; + if (p->rfc1583 != new->rfc1583) return 0; diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 3e96b511..f4f91de1 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -37,14 +37,6 @@ #endif -#ifdef IPV6 -#define OSPF_IS_V2 0 -#else -#define OSPF_IS_V2 1 -#endif - -// FIXME: MAX_PREFIX_LENGTH - #define OSPF_TRACE(flags, msg, args...) \ do { if ((p->p.debug & flags) || OSPF_FORCE_DEBUG) \ log(L_TRACE "%s: " msg, p->p.name , ## args ); } while(0) @@ -837,16 +829,12 @@ static inline void ospf_notify_net_lsa(struct ospf_iface *ifa) static inline void ospf_notify_link_lsa(struct ospf_iface *ifa) { ifa->update_link_lsa = 1; } - -#define ospf_is_v2(X) OSPF_IS_V2 -#define ospf_is_v3(X) (!OSPF_IS_V2) -/* static inline int ospf_is_v2(struct ospf_proto *p) { return p->ospf2; } static inline int ospf_is_v3(struct ospf_proto *p) { return ! p->ospf2; } -*/ + static inline int ospf_get_version(struct ospf_proto *p) { return ospf_is_v2(p) ? 2 : 3; } diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index 0adc3871..0031089c 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1428,7 +1428,7 @@ loop: static void * ospf_fib_route(struct fib *f, ip_addr a) { - if (ospf_is_v2(p)) + if (f->addr_type == NET_IP4) return ospf_fib_route_ip4(f, ipa_to_ip4(a), IP4_MAX_PREFIX_LENGTH); else return ospf_fib_route_ip6(f, ipa_to_ip6(a), IP6_MAX_PREFIX_LENGTH); -- cgit v1.2.3