1999-11-17 23:50:41 +08:00
|
|
|
/*
|
|
|
|
* BIRD -- OSPF
|
|
|
|
*
|
2004-07-01 23:01:04 +08:00
|
|
|
* (c) 1999--2004 Ondrej Filip <feela@network.cz>
|
2014-06-26 17:58:57 +08:00
|
|
|
* (c) 2009--2014 Ondrej Zajicek <santiago@crfreenet.org>
|
|
|
|
* (c) 2009--2014 CZ.NIC z.s.p.o.
|
1999-11-17 23:50:41 +08:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ospf.h"
|
|
|
|
|
2009-08-21 15:27:52 +08:00
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
struct ospf_hello2_packet
|
2009-08-21 15:27:52 +08:00
|
|
|
{
|
2014-06-26 17:58:57 +08:00
|
|
|
struct ospf_packet hdr;
|
2018-04-25 21:50:57 +08:00
|
|
|
union ospf_auth2 auth;
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
u32 netmask;
|
2009-08-21 15:27:52 +08:00
|
|
|
u16 helloint;
|
|
|
|
u8 options;
|
|
|
|
u8 priority;
|
|
|
|
u32 deadint;
|
|
|
|
u32 dr;
|
|
|
|
u32 bdr;
|
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
u32 neighbors[];
|
|
|
|
};
|
2009-08-21 15:27:52 +08:00
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
struct ospf_hello3_packet
|
2009-08-21 15:27:52 +08:00
|
|
|
{
|
2014-06-26 17:58:57 +08:00
|
|
|
struct ospf_packet hdr;
|
|
|
|
|
2009-08-21 15:27:52 +08:00
|
|
|
u32 iface_id;
|
2017-10-09 07:16:29 +08:00
|
|
|
u32 options;
|
2009-08-21 15:27:52 +08:00
|
|
|
u16 helloint;
|
|
|
|
u16 deadint;
|
|
|
|
u32 dr;
|
|
|
|
u32 bdr;
|
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
u32 neighbors[];
|
|
|
|
};
|
2000-05-09 19:27:31 +08:00
|
|
|
|
1999-11-17 23:50:41 +08:00
|
|
|
|
2018-04-25 21:50:57 +08:00
|
|
|
uint
|
|
|
|
ospf_hello3_options(struct ospf_packet *pkt)
|
|
|
|
{
|
|
|
|
struct ospf_hello3_packet *ps = (void *) pkt;
|
|
|
|
return ntohl(ps->options) & 0x00FFFFFF;
|
|
|
|
}
|
|
|
|
|
2000-09-02 08:03:36 +08:00
|
|
|
void
|
2014-06-26 17:58:57 +08:00
|
|
|
ospf_send_hello(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn)
|
1999-11-17 23:50:41 +08:00
|
|
|
{
|
2014-06-26 17:58:57 +08:00
|
|
|
struct ospf_proto *p = ifa->oa->po;
|
|
|
|
struct ospf_packet *pkt;
|
2004-06-26 00:39:53 +08:00
|
|
|
struct ospf_neighbor *neigh, *n1;
|
|
|
|
struct nbma_node *nb;
|
2014-06-26 17:58:57 +08:00
|
|
|
u32 *neighbors;
|
|
|
|
uint length;
|
|
|
|
int i, max;
|
2004-07-16 00:37:52 +08:00
|
|
|
|
2010-11-19 20:46:21 +08:00
|
|
|
if (ifa->state <= OSPF_IS_LOOP)
|
2004-06-26 00:39:53 +08:00
|
|
|
return;
|
|
|
|
|
2004-06-05 01:12:27 +08:00
|
|
|
if (ifa->stub)
|
2014-06-26 17:58:57 +08:00
|
|
|
return;
|
2000-09-02 16:54:40 +08:00
|
|
|
|
1999-11-17 23:50:41 +08:00
|
|
|
|
2010-03-12 01:07:24 +08:00
|
|
|
pkt = ospf_tx_buffer(ifa);
|
2004-06-27 04:15:34 +08:00
|
|
|
ospf_pkt_fill_hdr(ifa, pkt, HELLO_P);
|
2000-06-06 07:44:26 +08:00
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
if (ospf_is_v2(p))
|
|
|
|
{
|
|
|
|
struct ospf_hello2_packet *ps = (void *) pkt;
|
|
|
|
|
|
|
|
if ((ifa->type == OSPF_IT_VLINK) ||
|
|
|
|
((ifa->type == OSPF_IT_PTP) && !ifa->ptp_netmask))
|
|
|
|
ps->netmask = 0;
|
|
|
|
else
|
2015-11-12 09:03:59 +08:00
|
|
|
ps->netmask = htonl(u32_mkmask(ifa->addr->prefix.pxlen));
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
ps->helloint = ntohs(ifa->helloint);
|
2019-07-11 00:25:36 +08:00
|
|
|
ps->options = ifa->oa->options & HELLO2_OPT_MASK;
|
2014-06-26 17:58:57 +08:00
|
|
|
ps->priority = ifa->priority;
|
|
|
|
ps->deadint = htonl(ifa->deadint);
|
|
|
|
ps->dr = htonl(ipa_to_u32(ifa->drip));
|
|
|
|
ps->bdr = htonl(ipa_to_u32(ifa->bdrip));
|
|
|
|
|
|
|
|
length = sizeof(struct ospf_hello2_packet);
|
|
|
|
neighbors = ps->neighbors;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct ospf_hello3_packet *ps = (void *) pkt;
|
2018-04-25 21:50:57 +08:00
|
|
|
u32 options = ifa->oa->options | (ifa->autype == OSPF_AUTH_CRYPT ? OPT_AT : 0);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
ps->iface_id = htonl(ifa->iface_id);
|
2019-07-11 00:25:36 +08:00
|
|
|
ps->options = ntohl((options & HELLO3_OPT_MASK) | (ifa->priority << 24));
|
2014-06-26 17:58:57 +08:00
|
|
|
ps->helloint = ntohs(ifa->helloint);
|
|
|
|
ps->deadint = htons(ifa->deadint);
|
|
|
|
ps->dr = htonl(ifa->drid);
|
|
|
|
ps->bdr = htonl(ifa->bdrid);
|
|
|
|
|
|
|
|
length = sizeof(struct ospf_hello3_packet);
|
|
|
|
neighbors = ps->neighbors;
|
|
|
|
}
|
2000-06-06 07:44:26 +08:00
|
|
|
|
2004-06-05 01:12:27 +08:00
|
|
|
i = 0;
|
2014-06-26 17:58:57 +08:00
|
|
|
max = (ospf_pkt_maxsize(ifa) - length) / sizeof(u32);
|
2011-03-17 22:53:36 +08:00
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
/* Fill all neighbors */
|
2011-03-17 22:53:36 +08:00
|
|
|
if (kind != OHS_SHUTDOWN)
|
2000-06-06 07:44:26 +08:00
|
|
|
{
|
2011-03-17 22:53:36 +08:00
|
|
|
WALK_LIST(neigh, ifa->neigh_list)
|
2004-06-27 04:15:34 +08:00
|
|
|
{
|
2014-06-26 17:58:57 +08:00
|
|
|
if (i == max)
|
2011-03-17 22:53:36 +08:00
|
|
|
{
|
2014-10-24 16:27:21 +08:00
|
|
|
log(L_WARN "%s: Too many neighbors on %s", p->p.name, ifa->ifname);
|
2011-03-17 22:53:36 +08:00
|
|
|
break;
|
|
|
|
}
|
2014-06-26 17:58:57 +08:00
|
|
|
neighbors[i] = htonl(neigh->rid);
|
2011-03-17 22:53:36 +08:00
|
|
|
i++;
|
2004-06-27 04:15:34 +08:00
|
|
|
}
|
2000-06-06 07:44:26 +08:00
|
|
|
}
|
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
length += i * sizeof(u32);
|
|
|
|
pkt->length = htons(length);
|
|
|
|
|
|
|
|
OSPF_TRACE(D_PACKETS, "HELLO packet sent via %s", ifa->ifname);
|
2000-06-06 07:44:26 +08:00
|
|
|
|
2004-06-26 00:39:53 +08:00
|
|
|
switch(ifa->type)
|
2000-06-06 07:44:26 +08:00
|
|
|
{
|
2010-12-25 01:08:07 +08:00
|
|
|
case OSPF_IT_BCAST:
|
|
|
|
case OSPF_IT_PTP:
|
2012-05-14 17:47:41 +08:00
|
|
|
ospf_send_to_all(ifa);
|
2010-12-25 01:08:07 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OSPF_IT_NBMA:
|
2011-07-07 23:43:39 +08:00
|
|
|
if (dirn) /* Response to received hello */
|
2010-12-25 01:08:07 +08:00
|
|
|
{
|
|
|
|
ospf_send_to(ifa, dirn->ip);
|
2004-06-26 00:39:53 +08:00
|
|
|
break;
|
2010-12-25 01:08:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int to_all = ifa->state > OSPF_IS_DROTHER;
|
|
|
|
int me_elig = ifa->priority > 0;
|
2014-07-19 23:28:38 +08:00
|
|
|
|
2011-03-17 22:53:36 +08:00
|
|
|
if (kind == OHS_POLL) /* Poll timer */
|
2010-12-25 01:08:07 +08:00
|
|
|
{
|
|
|
|
WALK_LIST(nb, ifa->nbma_list)
|
|
|
|
if (!nb->found && (to_all || (me_elig && nb->eligible)))
|
|
|
|
ospf_send_to(ifa, nb->ip);
|
|
|
|
}
|
|
|
|
else /* Hello timer */
|
|
|
|
{
|
|
|
|
WALK_LIST(n1, ifa->neigh_list)
|
|
|
|
if (to_all || (me_elig && (n1->priority > 0)) ||
|
|
|
|
(n1->rid == ifa->drid) || (n1->rid == ifa->bdrid))
|
|
|
|
ospf_send_to(ifa, n1->ip);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSPF_IT_PTMP:
|
|
|
|
WALK_LIST(n1, ifa->neigh_list)
|
|
|
|
ospf_send_to(ifa, n1->ip);
|
|
|
|
|
|
|
|
WALK_LIST(nb, ifa->nbma_list)
|
|
|
|
if (!nb->found)
|
|
|
|
ospf_send_to(ifa, nb->ip);
|
|
|
|
|
|
|
|
/* If there is no other target, we also send HELLO packet to the other end */
|
|
|
|
if (ipa_nonzero(ifa->addr->opposite) && !ifa->strictnbma &&
|
|
|
|
EMPTY_LIST(ifa->neigh_list) && EMPTY_LIST(ifa->nbma_list))
|
|
|
|
ospf_send_to(ifa, ifa->addr->opposite);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OSPF_IT_VLINK:
|
|
|
|
ospf_send_to(ifa, ifa->vip);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2014-06-26 17:58:57 +08:00
|
|
|
bug("Bug in ospf_send_hello()");
|
2000-06-06 07:44:26 +08:00
|
|
|
}
|
2014-06-26 17:58:57 +08:00
|
|
|
}
|
2009-04-06 22:17:47 +08:00
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
ospf_receive_hello(struct ospf_packet *pkt, struct ospf_iface *ifa,
|
|
|
|
struct ospf_neighbor *n, ip_addr faddr)
|
|
|
|
{
|
|
|
|
struct ospf_proto *p = ifa->oa->po;
|
2014-10-24 16:27:21 +08:00
|
|
|
const char *err_dsc = NULL;
|
2014-06-26 17:58:57 +08:00
|
|
|
u32 rcv_iface_id, rcv_helloint, rcv_deadint, rcv_dr, rcv_bdr;
|
2017-10-09 07:16:29 +08:00
|
|
|
uint rcv_options, rcv_priority;
|
|
|
|
uint loc_options = ifa->oa->options;
|
2014-06-26 17:58:57 +08:00
|
|
|
u32 *neighbors;
|
|
|
|
u32 neigh_count;
|
2014-10-24 16:27:21 +08:00
|
|
|
uint plen, i, err_val = 0;
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
/* RFC 2328 10.5 */
|
|
|
|
|
2014-10-24 16:27:21 +08:00
|
|
|
/*
|
2015-11-12 09:03:59 +08:00
|
|
|
* We may not yet have the associate neighbor, so we use Router ID from the
|
2014-10-24 16:27:21 +08:00
|
|
|
* packet instead of one from the neighbor structure for log messages.
|
|
|
|
*/
|
|
|
|
u32 rcv_rid = ntohl(pkt->routerid);
|
|
|
|
OSPF_TRACE(D_PACKETS, "HELLO packet received from nbr %R on %s", rcv_rid, ifa->ifname);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
plen = ntohs(pkt->length);
|
|
|
|
|
|
|
|
if (ospf_is_v2(p))
|
|
|
|
{
|
|
|
|
struct ospf_hello2_packet *ps = (void *) pkt;
|
|
|
|
|
|
|
|
if (plen < sizeof(struct ospf_hello2_packet))
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("too short", plen);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
rcv_iface_id = 0;
|
|
|
|
rcv_helloint = ntohs(ps->helloint);
|
|
|
|
rcv_deadint = ntohl(ps->deadint);
|
|
|
|
rcv_dr = ntohl(ps->dr);
|
|
|
|
rcv_bdr = ntohl(ps->bdr);
|
|
|
|
rcv_options = ps->options;
|
|
|
|
rcv_priority = ps->priority;
|
|
|
|
|
|
|
|
int pxlen = u32_masklen(ntohl(ps->netmask));
|
2016-10-14 21:37:04 +08:00
|
|
|
if (pxlen < 0)
|
|
|
|
DROP("prefix garbled", ntohl(ps->netmask));
|
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
if ((ifa->type != OSPF_IT_VLINK) &&
|
|
|
|
(ifa->type != OSPF_IT_PTP) &&
|
2016-11-09 02:27:58 +08:00
|
|
|
((uint) pxlen != ifa->addr->prefix.pxlen))
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("prefix length mismatch", pxlen);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
neighbors = ps->neighbors;
|
|
|
|
neigh_count = (plen - sizeof(struct ospf_hello2_packet)) / sizeof(u32);
|
|
|
|
}
|
|
|
|
else /* OSPFv3 */
|
|
|
|
{
|
|
|
|
struct ospf_hello3_packet *ps = (void *) pkt;
|
|
|
|
|
|
|
|
if (plen < sizeof(struct ospf_hello3_packet))
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("too short", plen);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
rcv_iface_id = ntohl(ps->iface_id);
|
|
|
|
rcv_helloint = ntohs(ps->helloint);
|
|
|
|
rcv_deadint = ntohs(ps->deadint);
|
|
|
|
rcv_dr = ntohl(ps->dr);
|
|
|
|
rcv_bdr = ntohl(ps->bdr);
|
2017-10-09 07:16:29 +08:00
|
|
|
rcv_options = ntohl(ps->options) & 0x00FFFFFF;
|
|
|
|
rcv_priority = ntohl(ps->options) >> 24;
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
neighbors = ps->neighbors;
|
|
|
|
neigh_count = (plen - sizeof(struct ospf_hello3_packet)) / sizeof(u32);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rcv_helloint != ifa->helloint)
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("hello interval mismatch", rcv_helloint);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
if (rcv_deadint != ifa->deadint)
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("dead interval mismatch", rcv_deadint);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
/* Check whether bits E, N match */
|
2017-10-09 07:16:29 +08:00
|
|
|
if ((rcv_options ^ loc_options) & (OPT_E | OPT_N))
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("area type mismatch", rcv_options);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
2017-10-09 07:16:29 +08:00
|
|
|
/* RFC 5838 2.4 - AF-bit check unless on IPv6 unicast */
|
|
|
|
if ((loc_options & OPT_AF) && !(loc_options & OPT_V6) && !(rcv_options & OPT_AF))
|
|
|
|
DROP("AF-bit mismatch", rcv_options);
|
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
/* Check consistency of existing neighbor entry */
|
|
|
|
if (n)
|
|
|
|
{
|
2014-07-19 00:24:12 +08:00
|
|
|
uint t = ifa->type;
|
2014-06-26 17:58:57 +08:00
|
|
|
if (ospf_is_v2(p) && ((t == OSPF_IT_BCAST) || (t == OSPF_IT_NBMA) || (t == OSPF_IT_PTMP)))
|
|
|
|
{
|
|
|
|
/* Neighbor identified by IP address; Router ID may change */
|
2014-10-24 16:27:21 +08:00
|
|
|
if (n->rid != rcv_rid)
|
2014-06-26 17:58:57 +08:00
|
|
|
{
|
2014-10-24 16:27:21 +08:00
|
|
|
OSPF_TRACE(D_EVENTS, "Neighbor %R on %s changed Router ID to %R",
|
|
|
|
n->rid, ifa->ifname, rcv_rid);
|
|
|
|
ospf_neigh_sm(n, INM_KILLNBR);
|
2014-06-26 17:58:57 +08:00
|
|
|
n = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* OSPFv3 or OSPFv2/PtP */
|
|
|
|
{
|
|
|
|
/* Neighbor identified by Router ID; IP address may change */
|
|
|
|
if (!ipa_equal(faddr, n->ip))
|
|
|
|
{
|
2014-10-24 16:27:21 +08:00
|
|
|
OSPF_TRACE(D_EVENTS, "Neighbor %R on %s changed IP address to %I",
|
2018-10-25 23:22:37 +08:00
|
|
|
n->rid, ifa->ifname, faddr);
|
2014-06-26 17:58:57 +08:00
|
|
|
n->ip = faddr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!n)
|
|
|
|
{
|
|
|
|
if ((ifa->type == OSPF_IT_NBMA) || (ifa->type == OSPF_IT_PTMP))
|
|
|
|
{
|
|
|
|
struct nbma_node *nn = find_nbma_node(ifa, faddr);
|
|
|
|
|
|
|
|
if (!nn && ifa->strictnbma)
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP1("new neighbor denied");
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
if (nn && (ifa->type == OSPF_IT_NBMA) &&
|
|
|
|
(((rcv_priority == 0) && nn->eligible) ||
|
|
|
|
((rcv_priority > 0) && !nn->eligible)))
|
2014-10-24 16:27:21 +08:00
|
|
|
DROP("eligibility mismatch", rcv_priority);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
if (nn)
|
|
|
|
nn->found = 1;
|
|
|
|
}
|
|
|
|
|
2014-11-03 17:42:55 +08:00
|
|
|
OSPF_TRACE(D_EVENTS, "New neighbor %R on %s, IP address %I",
|
|
|
|
rcv_rid, ifa->ifname, faddr);
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
n = ospf_neighbor_new(ifa);
|
|
|
|
|
2014-10-24 16:27:21 +08:00
|
|
|
n->rid = rcv_rid;
|
2014-06-26 17:58:57 +08:00
|
|
|
n->ip = faddr;
|
|
|
|
n->dr = rcv_dr;
|
|
|
|
n->bdr = rcv_bdr;
|
|
|
|
n->priority = rcv_priority;
|
|
|
|
n->iface_id = rcv_iface_id;
|
|
|
|
|
|
|
|
if (n->ifa->cf->bfd)
|
|
|
|
ospf_neigh_update_bfd(n, n->ifa->bfd);
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 n_id = ospf_is_v2(p) ? ipa_to_u32(n->ip) : n->rid;
|
|
|
|
|
|
|
|
u32 old_dr = n->dr;
|
|
|
|
u32 old_bdr = n->bdr;
|
|
|
|
u32 old_priority = n->priority;
|
|
|
|
u32 old_iface_id = n->iface_id;
|
|
|
|
|
|
|
|
n->dr = rcv_dr;
|
|
|
|
n->bdr = rcv_bdr;
|
|
|
|
n->priority = rcv_priority;
|
|
|
|
n->iface_id = rcv_iface_id;
|
|
|
|
|
|
|
|
/* Update inactivity timer */
|
|
|
|
ospf_neigh_sm(n, INM_HELLOREC);
|
|
|
|
|
|
|
|
/* RFC 2328 9.5.1 - non-eligible routers reply to hello on NBMA nets */
|
|
|
|
if (ifa->type == OSPF_IT_NBMA)
|
|
|
|
if ((ifa->priority == 0) && (n->priority > 0))
|
|
|
|
ospf_send_hello(n->ifa, OHS_HELLO, n);
|
2014-07-19 23:28:38 +08:00
|
|
|
|
2014-06-26 17:58:57 +08:00
|
|
|
|
|
|
|
/* Examine list of neighbors */
|
|
|
|
for (i = 0; i < neigh_count; i++)
|
|
|
|
if (neighbors[i] == htonl(p->router_id))
|
|
|
|
goto found_self;
|
|
|
|
|
|
|
|
ospf_neigh_sm(n, INM_1WAYREC);
|
|
|
|
return;
|
|
|
|
|
2014-10-24 16:27:21 +08:00
|
|
|
found_self:
|
2014-06-26 17:58:57 +08:00
|
|
|
ospf_neigh_sm(n, INM_2WAYREC);
|
|
|
|
|
|
|
|
|
|
|
|
if (n->iface_id != old_iface_id)
|
|
|
|
{
|
|
|
|
/* If neighbor is DR, also update cached DR interface ID */
|
|
|
|
if (ifa->drid == n->rid)
|
|
|
|
ifa->dr_iface_id = n->iface_id;
|
|
|
|
|
|
|
|
/* RFC 5340 4.4.3 Event 4 - change of neighbor's interface ID */
|
|
|
|
ospf_notify_rt_lsa(ifa->oa);
|
|
|
|
|
|
|
|
/* Missed in RFC 5340 4.4.3 Event 4 - (Px-)Net-LSA uses iface_id to ref Link-LSAs */
|
|
|
|
ospf_notify_net_lsa(ifa);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ifa->state == OSPF_IS_WAITING)
|
|
|
|
{
|
|
|
|
/* Neighbor is declaring itself DR (and there is no BDR) or as BDR */
|
|
|
|
if (((n->dr == n_id) && (n->bdr == 0)) || (n->bdr == n_id))
|
|
|
|
ospf_iface_sm(ifa, ISM_BACKS);
|
|
|
|
}
|
|
|
|
else if (ifa->state >= OSPF_IS_DROTHER)
|
|
|
|
{
|
|
|
|
/* Neighbor changed priority or started/stopped declaring itself as DR/BDR */
|
|
|
|
if ((n->priority != old_priority) ||
|
|
|
|
((n->dr == n_id) && (old_dr != n_id)) ||
|
|
|
|
((n->dr != n_id) && (old_dr == n_id)) ||
|
|
|
|
((n->bdr == n_id) && (old_bdr != n_id)) ||
|
|
|
|
((n->bdr != n_id) && (old_bdr == n_id)))
|
|
|
|
ospf_iface_sm(ifa, ISM_NEICH);
|
|
|
|
}
|
2014-10-24 16:27:21 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
drop:
|
|
|
|
LOG_PKT("Bad HELLO packet from nbr %R on %s - %s (%u)",
|
|
|
|
rcv_rid, ifa->ifname, err_dsc, err_val);
|
1999-11-17 23:50:41 +08:00
|
|
|
}
|