summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_lsa.c')
-rw-r--r--ospfd/ospf_lsa.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 634bc435..e9d1a858 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -543,7 +543,7 @@ lsa_link_ptop_set (struct stream *s, struct ospf_interface *oi)
{
int links = 0;
struct ospf_neighbor *nbr;
- struct in_addr id, mask;
+ struct in_addr id, mask, data;
u_int16_t cost = ospf_link_cost (oi);
if (IS_DEBUG_OSPF (lsa, LSA_GENERATE))
@@ -552,19 +552,34 @@ lsa_link_ptop_set (struct stream *s, struct ospf_interface *oi)
if ((nbr = ospf_nbr_lookup_ptop (oi)))
if (nbr->state == NSM_Full)
{
- /* For unnumbered point-to-point networks, the Link Data field
- should specify the interface's MIB-II ifIndex value. */
- links += link_info_set (s, nbr->router_id, oi->address->u.prefix4,
- LSA_LINK_TYPE_POINTOPOINT, 0, cost);
+ if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
+ {
+ /* For unnumbered point-to-point networks, the Link Data field
+ should specify the interface's MIB-II ifIndex value. */
+ data.s_addr = htonl(oi->ifp->ifindex);
+ links += link_info_set (s, nbr->router_id, data,
+ LSA_LINK_TYPE_POINTOPOINT, 0, cost);
+ }
+ else
+ {
+ links += link_info_set (s, nbr->router_id,
+ oi->address->u.prefix4,
+ LSA_LINK_TYPE_POINTOPOINT, 0, cost);
+ }
}
- /* Regardless of the state of the neighboring router, we must
- add a Type 3 link (stub network).
- N.B. Options 1 & 2 share basically the same logic. */
- masklen2ip (oi->address->prefixlen, &mask);
- id.s_addr = CONNECTED_PREFIX(oi->connected)->u.prefix4.s_addr & mask.s_addr;
- links += link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0,
- oi->output_cost);
+ /* no need for a stub link for unnumbered interfaces */
+ if (!CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
+ {
+ /* Regardless of the state of the neighboring router, we must
+ add a Type 3 link (stub network).
+ N.B. Options 1 & 2 share basically the same logic. */
+ masklen2ip (oi->address->prefixlen, &mask);
+ id.s_addr = CONNECTED_PREFIX(oi->connected)->u.prefix4.s_addr & mask.s_addr;
+ links += link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0,
+ oi->output_cost);
+ }
+
return links;
}
@@ -1649,8 +1664,8 @@ ospf_external_lsa_body_set (struct stream *s, struct external_info *ei,
/* Put forwarding address. */
stream_put_ipv4 (s, fwd_addr.s_addr);
- /* Put route tag -- This value should be introduced from configuration. */
- stream_putl (s, 0);
+ /* Put route tag -- only first 16bits are used for compatibility */
+ stream_putl (s, ei->tag);
}
/* Create new external-LSA. */
@@ -2163,7 +2178,7 @@ ospf_default_originate_timer (struct thread *thread)
/* If there is no default route via redistribute,
then originate AS-external-LSA with nexthop 0 (self). */
nexthop.s_addr = 0;
- ospf_external_info_add (DEFAULT_ROUTE, p, 0, nexthop);
+ ospf_external_info_add (DEFAULT_ROUTE, p, 0, nexthop, 0);
}
if ((ei = ospf_default_external_info (ospf)))