summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_interface.c')
-rw-r--r--ospf6d/ospf6_interface.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 334f1bd2a5..75917b9d85 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -118,7 +118,7 @@ static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
/* If all else fails, use default OSPF cost */
uint32_t cost;
uint32_t bw, refbw;
-
+ struct ospf6 *ospf6;
/* interface speed and bw can be 0 in some platforms,
* use ospf default bw. If bw is configured then it would
* be used.
@@ -130,6 +130,7 @@ static uint32_t ospf6_interface_get_cost(struct ospf6_interface *oi)
: OSPF6_INTERFACE_BANDWIDTH;
}
+ ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id);
refbw = ospf6 ? ospf6->ref_bandwidth : OSPF6_REFERENCE_BANDWIDTH;
/* A specifed ip ospf cost overrides a calculated one. */
@@ -259,7 +260,7 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
ospf6_lsdb_delete(oi->lsupdate_list);
ospf6_lsdb_delete(oi->lsack_list);
- ospf6_route_table_delete(oi->route_connected);
+ ospf6_route_table_delete(oi->route_connected, oi->area->ospf6);
/* cut link */
oi->interface->info = NULL;
@@ -415,7 +416,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
return;
/* update "route to advertise" interface route table */
- ospf6_route_remove_all(oi->route_connected);
+ ospf6_route_remove_all(oi->route_connected, oi->area->ospf6);
for (ALL_LIST_ELEMENTS(oi->interface->connected, node, nnode, c)) {
if (c->address->family != AF_INET6)
@@ -436,16 +437,14 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
if (oi->plist_name) {
struct prefix_list *plist;
enum prefix_list_type ret;
- char buf[PREFIX2STR_BUFFER];
- prefix2str(c->address, buf, sizeof(buf));
plist = prefix_list_lookup(AFI_IP6, oi->plist_name);
ret = prefix_list_apply(plist, (void *)c->address);
if (ret == PREFIX_DENY) {
if (IS_OSPF6_DEBUG_INTERFACE)
zlog_debug(
- "%s on %s filtered by prefix-list %s ",
- buf, oi->interface->name,
+ "%pFX on %s filtered by prefix-list %s ",
+ c->address, oi->interface->name,
oi->plist_name);
continue;
}
@@ -461,7 +460,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
inet_pton(AF_INET6, "::1", &nh_addr);
ospf6_route_add_nexthop(route, oi->interface->ifindex,
&nh_addr);
- ospf6_route_add(route, oi->route_connected);
+ ospf6_route_add(route, oi->route_connected, oi->area->ospf6);
}
/* create new Link-LSA */
@@ -474,6 +473,7 @@ static void ospf6_interface_state_change(uint8_t next_state,
struct ospf6_interface *oi)
{
uint8_t prev_state;
+ struct ospf6 *ospf6;
prev_state = oi->state;
oi->state = next_state;
@@ -489,20 +489,21 @@ static void ospf6_interface_state_change(uint8_t next_state,
ospf6_interface_state_str[next_state]);
}
oi->state_change++;
+ ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id);
if ((prev_state == OSPF6_INTERFACE_DR
|| prev_state == OSPF6_INTERFACE_BDR)
&& (next_state != OSPF6_INTERFACE_DR
&& next_state != OSPF6_INTERFACE_BDR))
ospf6_sso(oi->interface->ifindex, &alldrouters6,
- IPV6_LEAVE_GROUP);
+ IPV6_LEAVE_GROUP, ospf6->fd);
if ((prev_state != OSPF6_INTERFACE_DR
&& prev_state != OSPF6_INTERFACE_BDR)
&& (next_state == OSPF6_INTERFACE_DR
|| next_state == OSPF6_INTERFACE_BDR))
ospf6_sso(oi->interface->ifindex, &alldrouters6,
- IPV6_JOIN_GROUP);
+ IPV6_JOIN_GROUP, ospf6->fd);
OSPF6_ROUTER_LSA_SCHEDULE(oi->area);
if (next_state == OSPF6_INTERFACE_DOWN) {
@@ -679,6 +680,7 @@ static uint8_t dr_election(struct ospf6_interface *oi)
int interface_up(struct thread *thread)
{
struct ospf6_interface *oi;
+ struct ospf6 *ospf6;
oi = (struct ospf6_interface *)THREAD_ARG(thread);
assert(oi && oi->interface);
@@ -749,9 +751,14 @@ int interface_up(struct thread *thread)
return 0;
}
#endif /* __FreeBSD__ */
+ if (oi->area->ospf6)
+ ospf6 = oi->area->ospf6;
+ else
+ ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id);
/* Join AllSPFRouters */
- if (ospf6_sso(oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP)
+ if (ospf6_sso(oi->interface->ifindex, &allspfrouters6, IPV6_JOIN_GROUP,
+ ospf6->fd)
< 0) {
if (oi->sso_try_cnt++ < OSPF6_INTERFACE_SSO_RETRY_MAX) {
zlog_info(
@@ -848,6 +855,7 @@ int interface_down(struct thread *thread)
struct ospf6_interface *oi;
struct listnode *node, *nnode;
struct ospf6_neighbor *on;
+ struct ospf6 *ospf6;
oi = (struct ospf6_interface *)THREAD_ARG(thread);
assert(oi && oi->interface);
@@ -861,11 +869,11 @@ int interface_down(struct thread *thread)
/* Stop trying to set socket options. */
THREAD_OFF(oi->thread_sso);
-
+ ospf6 = ospf6_lookup_by_vrf_id(oi->interface->vrf_id);
/* Leave AllSPFRouters */
if (oi->state > OSPF6_INTERFACE_DOWN)
ospf6_sso(oi->interface->ifindex, &allspfrouters6,
- IPV6_LEAVE_GROUP);
+ IPV6_LEAVE_GROUP, ospf6->fd);
ospf6_interface_state_change(OSPF6_INTERFACE_DOWN, oi);
@@ -906,7 +914,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
uint8_t default_iftype;
struct timeval res, now;
char duration[32];
- struct ospf6_lsa *lsa;
+ struct ospf6_lsa *lsa, *lsanext;
default_iftype = ospf6_default_iftype(ifp);
@@ -929,16 +937,15 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) {
p = c->address;
- prefix2str(p, strbuf, sizeof(strbuf));
switch (p->family) {
case AF_INET:
- vty_out(vty, " inet : %s\n", strbuf);
+ vty_out(vty, " inet : %pFX\n", p);
break;
case AF_INET6:
- vty_out(vty, " inet6: %s\n", strbuf);
+ vty_out(vty, " inet6: %pFX\n", p);
break;
default:
- vty_out(vty, " ??? : %s\n", strbuf);
+ vty_out(vty, " ??? : %pFX\n", p);
break;
}
}
@@ -977,7 +984,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
" %d Pending LSAs for LSUpdate in Time %s [thread %s]\n",
oi->lsupdate_list->count, duration,
(oi->thread_send_lsupdate ? "on" : "off"));
- for (ALL_LSDB(oi->lsupdate_list, lsa))
+ for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);
timerclear(&res);
@@ -987,7 +994,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
vty_out(vty, " %d Pending LSAs for LSAck in Time %s [thread %s]\n",
oi->lsack_list->count, duration,
(oi->thread_send_lsack ? "on" : "off"));
- for (ALL_LSDB(oi->lsack_list, lsa))
+ for (ALL_LSDB(oi->lsack_list, lsa, lsanext))
vty_out(vty, " %s\n", lsa->name);
ospf6_bfd_show_info(vty, oi->bfd_info, 1);
return 0;