0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Fixes several problems in OSPF vlink implementation.

This commit is contained in:
Ondrej Zajicek 2010-04-21 21:50:38 +02:00
parent 607d991424
commit 3b89a2327b
6 changed files with 571 additions and 471 deletions

View File

@ -164,7 +164,6 @@ ospf_vlink_start: VIRTUAL LINK idval
add_tail(&this_area->vlink_list, NODE this_ipatt);
init_list(&this_ipatt->ipn_list);
OSPF_PATT->vid = $3;
OSPF_PATT->cost = COST_D;
OSPF_PATT->helloint = HELLOINT_D;
OSPF_PATT->rxmtint = RXMTINT_D;
OSPF_PATT->inftransdelay = INFTRANSDELAY_D;

View File

@ -260,6 +260,7 @@ ospf_iface_down(struct ospf_iface *ifa)
ifa->iface = NULL;
ifa->addr = NULL;
ifa->sk = NULL;
ifa->cost = 0;
ifa->vip = IPA_NONE;
return;
}
@ -445,27 +446,6 @@ ospf_iface_new(struct proto_ospf *po, struct iface *iface, struct ifa *addr,
#ifdef OSPFv3
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
if (ip->type == OSPF_IT_UNDEF)

File diff suppressed because it is too large Load Diff

View File

@ -17,22 +17,31 @@
typedef struct orta
{
int type;
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),
have just ORTA_ASBR in options, their real options are unknown */
u32 options;
/*
* For ORT_ROUTER routes, options field are router-LSA style
* 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_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 metric2;
ip_addr nh; /* Next hop */
struct ospf_iface *ifa; /* Outgoing interface */
struct top_hash_entry *ar; /* Advertising router (or ABR) */
u32 tag;
u32 rid; /* Router ID of real advertising router */
/* For ext-LSA from different area, 'ar' is a type 1 LSA of ABR.
Router ID of real advertising router is stored in 'rid'. */
struct ospf_area *oa;
struct ospf_iface *ifa; /* Outgoing interface */
ip_addr nh; /* Next hop */
}
orta;
@ -41,7 +50,6 @@ typedef struct ort
struct fib_node fn;
orta n;
orta o;
struct ort *efn; /* For RFC1583 */
}
ort;

View File

@ -1114,6 +1114,8 @@ originate_prefix_rt_lsa_body(struct ospf_area *oa, u16 *length)
struct proto_ospf *po = oa->po;
struct ospf_iface *ifa;
struct ospf_lsa_prefix *lp;
struct ifa *vlink_addr = NULL;
int host_addr = 0;
int net_lsa;
int i = 0;
u8 flags;
@ -1139,10 +1141,15 @@ originate_prefix_rt_lsa_body(struct ospf_area *oa, u16 *length)
struct ifa *a;
WALK_LIST(a, ifa->iface->addrs)
{
if (((a->pxlen < MAX_PREFIX_LENGTH) && net_lsa) ||
(a->flags & IA_SECONDARY) ||
if ((a->flags & IA_SECONDARY) ||
(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))
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)),
a->ip, a->pxlen, flags, ifa->cost);
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;
WALK_LIST(sn, oa->ac->stubnet_list)
@ -1227,6 +1244,7 @@ prefix_advance(u32 *buf)
return buf + IPV6_PREFIX_WORDS(pxl);
}
/* FIXME eliminate items wit LA bit set? see 4.4.3.9 */
static void
add_prefix(struct proto_ospf *po, u32 *px, int offset, int *pxc)
{

View File

@ -21,7 +21,7 @@ struct top_hash_entry
void *lsa_body;
bird_clock_t inst_t; /* Time of installation into DB */
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 */
#ifdef OSPFv3
u32 lb_id; /* Interface ID of link back iface (for bcast or NBMA networks) */