Fixes several problems in OSPF vlink implementation.
This commit is contained in:
parent
607d991424
commit
3b89a2327b
6 changed files with 571 additions and 471 deletions
|
@ -164,7 +164,6 @@ ospf_vlink_start: VIRTUAL LINK idval
|
||||||
add_tail(&this_area->vlink_list, NODE this_ipatt);
|
add_tail(&this_area->vlink_list, NODE this_ipatt);
|
||||||
init_list(&this_ipatt->ipn_list);
|
init_list(&this_ipatt->ipn_list);
|
||||||
OSPF_PATT->vid = $3;
|
OSPF_PATT->vid = $3;
|
||||||
OSPF_PATT->cost = COST_D;
|
|
||||||
OSPF_PATT->helloint = HELLOINT_D;
|
OSPF_PATT->helloint = HELLOINT_D;
|
||||||
OSPF_PATT->rxmtint = RXMTINT_D;
|
OSPF_PATT->rxmtint = RXMTINT_D;
|
||||||
OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
|
OSPF_PATT->inftransdelay = INFTRANSDELAY_D;
|
||||||
|
|
|
@ -260,6 +260,7 @@ ospf_iface_down(struct ospf_iface *ifa)
|
||||||
ifa->iface = NULL;
|
ifa->iface = NULL;
|
||||||
ifa->addr = NULL;
|
ifa->addr = NULL;
|
||||||
ifa->sk = NULL;
|
ifa->sk = NULL;
|
||||||
|
ifa->cost = 0;
|
||||||
ifa->vip = IPA_NONE;
|
ifa->vip = IPA_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -445,27 +446,6 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ifa *addr,
|
||||||
|
|
||||||
#ifdef OSPFv3
|
#ifdef OSPFv3
|
||||||
ifa->instance_id = ip->instance_id;
|
ifa->instance_id = ip->instance_id;
|
||||||
|
|
||||||
/*
|
|
||||||
addr = NULL;
|
|
||||||
if (ifa->type != OSPF_IT_VLINK)
|
|
||||||
{
|
|
||||||
struct ifa *a;
|
|
||||||
WALK_LIST(a, iface->addrs)
|
|
||||||
if (a->scope == SCOPE_LINK)
|
|
||||||
{
|
|
||||||
addr = a;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!addr)
|
|
||||||
{
|
|
||||||
log(L_ERR "%s: Missing link-local address on interface %s, declaring as stub", p->name, iface->name);
|
|
||||||
ifa->ioprob = OSPF_I_LL;
|
|
||||||
ifa->stub = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ip->type == OSPF_IT_UNDEF)
|
if (ip->type == OSPF_IT_UNDEF)
|
||||||
|
|
959
proto/ospf/rt.c
959
proto/ospf/rt.c
File diff suppressed because it is too large
Load diff
|
@ -18,21 +18,30 @@ typedef struct orta
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
u32 options;
|
u32 options;
|
||||||
/* router-LSA style options (for ORT_ROUTER), with V,E,B bits.
|
/*
|
||||||
In OSPFv2, ASBRs from another areas (that we know from rt-summary-lsa),
|
* For ORT_ROUTER routes, options field are router-LSA style
|
||||||
have just ORTA_ASBR in options, their real options are unknown */
|
* options, with V,E,B bits. In OSPFv2, ASBRs from another areas
|
||||||
|
* (that we know from rt-summary-lsa) have just ORTA_ASBR in
|
||||||
|
* options, their real options are unknown.
|
||||||
|
*/
|
||||||
#define ORTA_ASBR OPT_RT_E
|
#define ORTA_ASBR OPT_RT_E
|
||||||
#define ORTA_ABR OPT_RT_B
|
#define ORTA_ABR OPT_RT_B
|
||||||
struct ospf_area *oa;
|
/*
|
||||||
|
* For ORT_NET routes, the field is almost unused with one
|
||||||
|
* exception: ORTA_PREF for external routes means that the route is
|
||||||
|
* preferred in AS external route selection according to 16.4.1. -
|
||||||
|
* it is intra-area path using non-backbone area. In other words,
|
||||||
|
* the forwarding address (or ASBR if forwarding address is zero) is
|
||||||
|
* intra-area (type == RTS_OSPF) and its area is not a backbone.
|
||||||
|
*/
|
||||||
|
#define ORTA_PREF 0x80000000
|
||||||
u32 metric1;
|
u32 metric1;
|
||||||
u32 metric2;
|
u32 metric2;
|
||||||
ip_addr nh; /* Next hop */
|
|
||||||
struct ospf_iface *ifa; /* Outgoing interface */
|
|
||||||
struct top_hash_entry *ar; /* Advertising router (or ABR) */
|
|
||||||
u32 tag;
|
u32 tag;
|
||||||
u32 rid; /* Router ID of real advertising router */
|
u32 rid; /* Router ID of real advertising router */
|
||||||
/* For ext-LSA from different area, 'ar' is a type 1 LSA of ABR.
|
struct ospf_area *oa;
|
||||||
Router ID of real advertising router is stored in 'rid'. */
|
struct ospf_iface *ifa; /* Outgoing interface */
|
||||||
|
ip_addr nh; /* Next hop */
|
||||||
}
|
}
|
||||||
orta;
|
orta;
|
||||||
|
|
||||||
|
@ -41,7 +50,6 @@ typedef struct ort
|
||||||
struct fib_node fn;
|
struct fib_node fn;
|
||||||
orta n;
|
orta n;
|
||||||
orta o;
|
orta o;
|
||||||
struct ort *efn; /* For RFC1583 */
|
|
||||||
}
|
}
|
||||||
ort;
|
ort;
|
||||||
|
|
||||||
|
|
|
@ -1114,6 +1114,8 @@ originate_prefix_rt_lsa_body(struct ospf_area *oa, u16 *length)
|
||||||
struct proto_ospf *po = oa->po;
|
struct proto_ospf *po = oa->po;
|
||||||
struct ospf_iface *ifa;
|
struct ospf_iface *ifa;
|
||||||
struct ospf_lsa_prefix *lp;
|
struct ospf_lsa_prefix *lp;
|
||||||
|
struct ifa *vlink_addr = NULL;
|
||||||
|
int host_addr = 0;
|
||||||
int net_lsa;
|
int net_lsa;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
u8 flags;
|
u8 flags;
|
||||||
|
@ -1139,10 +1141,15 @@ originate_prefix_rt_lsa_body(struct ospf_area *oa, u16 *length)
|
||||||
struct ifa *a;
|
struct ifa *a;
|
||||||
WALK_LIST(a, ifa->iface->addrs)
|
WALK_LIST(a, ifa->iface->addrs)
|
||||||
{
|
{
|
||||||
if (((a->pxlen < MAX_PREFIX_LENGTH) && net_lsa) ||
|
if ((a->flags & IA_SECONDARY) ||
|
||||||
(a->flags & IA_SECONDARY) ||
|
|
||||||
(a->flags & IA_UNNUMBERED) ||
|
(a->flags & IA_UNNUMBERED) ||
|
||||||
(a->scope <= SCOPE_LINK) ||
|
(a->scope <= SCOPE_LINK))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!vlink_addr)
|
||||||
|
vlink_addr = a;
|
||||||
|
|
||||||
|
if (((a->pxlen < MAX_PREFIX_LENGTH) && net_lsa) ||
|
||||||
configured_stubnet(oa, a))
|
configured_stubnet(oa, a))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1150,10 +1157,20 @@ originate_prefix_rt_lsa_body(struct ospf_area *oa, u16 *length)
|
||||||
put_ipv6_prefix(lsab_alloc(po, IPV6_PREFIX_SPACE(a->pxlen)),
|
put_ipv6_prefix(lsab_alloc(po, IPV6_PREFIX_SPACE(a->pxlen)),
|
||||||
a->ip, a->pxlen, flags, ifa->cost);
|
a->ip, a->pxlen, flags, ifa->cost);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
if (flags & OPT_PX_LA)
|
||||||
|
host_addr = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Handle vlinks? see RFC5340, page 38 */
|
/* If there are some configured vlinks, add some global address,
|
||||||
|
which will be used as a vlink endpoint. */
|
||||||
|
if (!EMPTY_LIST(oa->ac->vlink_list) && !host_addr && vlink_addr)
|
||||||
|
{
|
||||||
|
put_ipv6_prefix(lsab_alloc(po, IPV6_PREFIX_SPACE(MAX_PREFIX_LENGTH)),
|
||||||
|
vlink_addr->ip, MAX_PREFIX_LENGTH, OPT_PX_LA, 0);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
struct ospf_stubnet_config *sn;
|
struct ospf_stubnet_config *sn;
|
||||||
WALK_LIST(sn, oa->ac->stubnet_list)
|
WALK_LIST(sn, oa->ac->stubnet_list)
|
||||||
|
@ -1227,6 +1244,7 @@ prefix_advance(u32 *buf)
|
||||||
return buf + IPV6_PREFIX_WORDS(pxl);
|
return buf + IPV6_PREFIX_WORDS(pxl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME eliminate items wit LA bit set? see 4.4.3.9 */
|
||||||
static void
|
static void
|
||||||
add_prefix(struct proto_ospf *po, u32 *px, int offset, int *pxc)
|
add_prefix(struct proto_ospf *po, u32 *px, int offset, int *pxc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct top_hash_entry
|
||||||
void *lsa_body;
|
void *lsa_body;
|
||||||
bird_clock_t inst_t; /* Time of installation into DB */
|
bird_clock_t inst_t; /* Time of installation into DB */
|
||||||
ip_addr nh; /* Next hop */
|
ip_addr nh; /* Next hop */
|
||||||
ip_addr lb; /* Link back */
|
ip_addr lb; /* In OSPFv2, link back address. In OSPFv3, any global address in the area useful for vlinks */
|
||||||
struct ospf_iface *nhi; /* Next hop interface */
|
struct ospf_iface *nhi; /* Next hop interface */
|
||||||
#ifdef OSPFv3
|
#ifdef OSPFv3
|
||||||
u32 lb_id; /* Interface ID of link back iface (for bcast or NBMA networks) */
|
u32 lb_id; /* Interface ID of link back iface (for bcast or NBMA networks) */
|
||||||
|
|
Loading…
Reference in a new issue