mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-22 07:39:24 +00:00
Merge pull request #4995 from opensourcerouting/ospf6d-iftype
ospf6d: fix interface type handling
This commit is contained in:
commit
e4bf00fdf9
@ -355,8 +355,6 @@ void ospf6_interface_state_update(struct interface *ifp)
|
|||||||
oi = (struct ospf6_interface *)ifp->info;
|
oi = (struct ospf6_interface *)ifp->info;
|
||||||
if (oi == NULL)
|
if (oi == NULL)
|
||||||
return;
|
return;
|
||||||
if (oi->area == NULL)
|
|
||||||
return;
|
|
||||||
if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE))
|
if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -683,6 +681,9 @@ int interface_up(struct thread *thread)
|
|||||||
oi = (struct ospf6_interface *)THREAD_ARG(thread);
|
oi = (struct ospf6_interface *)THREAD_ARG(thread);
|
||||||
assert(oi && oi->interface);
|
assert(oi && oi->interface);
|
||||||
|
|
||||||
|
if (!oi->type_cfg)
|
||||||
|
oi->type = ospf6_default_iftype(oi->interface);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove old pointer. If this thread wasn't a timer this
|
* Remove old pointer. If this thread wasn't a timer this
|
||||||
* operation won't make a difference, because it is already NULL.
|
* operation won't make a difference, because it is already NULL.
|
||||||
@ -774,8 +775,7 @@ int interface_up(struct thread *thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* decide next interface state */
|
/* decide next interface state */
|
||||||
if ((if_is_pointopoint(oi->interface))
|
if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
|
||||||
|| (oi->type == OSPF_IFTYPE_POINTOPOINT)) {
|
|
||||||
ospf6_interface_state_change(OSPF6_INTERFACE_POINTTOPOINT, oi);
|
ospf6_interface_state_change(OSPF6_INTERFACE_POINTTOPOINT, oi);
|
||||||
} else if (oi->priority == 0)
|
} else if (oi->priority == 0)
|
||||||
ospf6_interface_state_change(OSPF6_INTERFACE_DROTHER, oi);
|
ospf6_interface_state_change(OSPF6_INTERFACE_DROTHER, oi);
|
||||||
@ -880,6 +880,19 @@ int interface_down(struct thread *thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const char *ospf6_iftype_str(uint8_t iftype)
|
||||||
|
{
|
||||||
|
switch (iftype) {
|
||||||
|
case OSPF_IFTYPE_LOOPBACK:
|
||||||
|
return "LOOPBACK";
|
||||||
|
case OSPF_IFTYPE_BROADCAST:
|
||||||
|
return "BROADCAST";
|
||||||
|
case OSPF_IFTYPE_POINTOPOINT:
|
||||||
|
return "POINTOPOINT";
|
||||||
|
}
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
/* show specified interface structure */
|
/* show specified interface structure */
|
||||||
static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
|
static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
|
||||||
{
|
{
|
||||||
@ -888,23 +901,16 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
|
|||||||
struct prefix *p;
|
struct prefix *p;
|
||||||
struct listnode *i;
|
struct listnode *i;
|
||||||
char strbuf[PREFIX2STR_BUFFER], drouter[32], bdrouter[32];
|
char strbuf[PREFIX2STR_BUFFER], drouter[32], bdrouter[32];
|
||||||
const char *type;
|
uint8_t default_iftype;
|
||||||
struct timeval res, now;
|
struct timeval res, now;
|
||||||
char duration[32];
|
char duration[32];
|
||||||
struct ospf6_lsa *lsa;
|
struct ospf6_lsa *lsa;
|
||||||
|
|
||||||
/* check physical interface type */
|
default_iftype = ospf6_default_iftype(ifp);
|
||||||
if (if_is_loopback(ifp))
|
|
||||||
type = "LOOPBACK";
|
|
||||||
else if (if_is_broadcast(ifp))
|
|
||||||
type = "BROADCAST";
|
|
||||||
else if (if_is_pointopoint(ifp))
|
|
||||||
type = "POINTOPOINT";
|
|
||||||
else
|
|
||||||
type = "UNKNOWN";
|
|
||||||
|
|
||||||
vty_out(vty, "%s is %s, type %s\n", ifp->name,
|
vty_out(vty, "%s is %s, type %s\n", ifp->name,
|
||||||
(if_is_operative(ifp) ? "up" : "down"), type);
|
(if_is_operative(ifp) ? "up" : "down"),
|
||||||
|
ospf6_iftype_str(default_iftype));
|
||||||
vty_out(vty, " Interface ID: %d\n", ifp->ifindex);
|
vty_out(vty, " Interface ID: %d\n", ifp->ifindex);
|
||||||
|
|
||||||
if (ifp->info == NULL) {
|
if (ifp->info == NULL) {
|
||||||
@ -913,6 +919,10 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp)
|
|||||||
} else
|
} else
|
||||||
oi = (struct ospf6_interface *)ifp->info;
|
oi = (struct ospf6_interface *)ifp->info;
|
||||||
|
|
||||||
|
if (if_is_operative(ifp) && oi->type != default_iftype)
|
||||||
|
vty_out(vty, " Operating as type %s\n",
|
||||||
|
ospf6_iftype_str(oi->type));
|
||||||
|
|
||||||
vty_out(vty, " Internet Address:\n");
|
vty_out(vty, " Internet Address:\n");
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) {
|
for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) {
|
||||||
@ -1809,6 +1819,8 @@ DEFUN (ipv6_ospf6_network,
|
|||||||
}
|
}
|
||||||
assert(oi);
|
assert(oi);
|
||||||
|
|
||||||
|
oi->type_cfg = true;
|
||||||
|
|
||||||
if (strncmp(argv[idx_network]->arg, "b", 1) == 0) {
|
if (strncmp(argv[idx_network]->arg, "b", 1) == 0) {
|
||||||
if (oi->type == OSPF_IFTYPE_BROADCAST)
|
if (oi->type == OSPF_IFTYPE_BROADCAST)
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -1849,6 +1861,8 @@ DEFUN (no_ipv6_ospf6_network,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oi->type_cfg = false;
|
||||||
|
|
||||||
type = ospf6_default_iftype(ifp);
|
type = ospf6_default_iftype(ifp);
|
||||||
if (oi->type == type) {
|
if (oi->type == type) {
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -1916,13 +1930,10 @@ static int config_write_ospf6_interface(struct vty *vty)
|
|||||||
if (oi->mtu_ignore)
|
if (oi->mtu_ignore)
|
||||||
vty_out(vty, " ipv6 ospf6 mtu-ignore\n");
|
vty_out(vty, " ipv6 ospf6 mtu-ignore\n");
|
||||||
|
|
||||||
if (oi->type != ospf6_default_iftype(ifp)) {
|
if (oi->type_cfg && oi->type == OSPF_IFTYPE_POINTOPOINT)
|
||||||
if (oi->type == OSPF_IFTYPE_POINTOPOINT)
|
vty_out(vty, " ipv6 ospf6 network point-to-point\n");
|
||||||
vty_out(vty,
|
else if (oi->type_cfg && oi->type == OSPF_IFTYPE_BROADCAST)
|
||||||
" ipv6 ospf6 network point-to-point\n");
|
|
||||||
else if (oi->type == OSPF_IFTYPE_BROADCAST)
|
|
||||||
vty_out(vty, " ipv6 ospf6 network broadcast\n");
|
vty_out(vty, " ipv6 ospf6 network broadcast\n");
|
||||||
}
|
|
||||||
|
|
||||||
ospf6_bfd_write_config(vty, oi);
|
ospf6_bfd_write_config(vty, oi);
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ struct ospf6_interface {
|
|||||||
|
|
||||||
/* Network Type */
|
/* Network Type */
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
bool type_cfg;
|
||||||
|
|
||||||
/* Router Priority */
|
/* Router Priority */
|
||||||
uint8_t priority;
|
uint8_t priority;
|
||||||
|
@ -618,7 +618,7 @@ static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on)
|
|||||||
snprintf(deadtime, sizeof(deadtime), "%02ld:%02ld:%02ld", h, m, s);
|
snprintf(deadtime, sizeof(deadtime), "%02ld:%02ld:%02ld", h, m, s);
|
||||||
|
|
||||||
/* Neighbor State */
|
/* Neighbor State */
|
||||||
if (if_is_pointopoint(on->ospf6_if->interface))
|
if (on->ospf6_if->type == OSPF_IFTYPE_POINTOPOINT)
|
||||||
snprintf(nstate, sizeof(nstate), "PointToPoint");
|
snprintf(nstate, sizeof(nstate), "PointToPoint");
|
||||||
else {
|
else {
|
||||||
if (on->router_id == on->drouter)
|
if (on->router_id == on->drouter)
|
||||||
|
@ -1130,9 +1130,9 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
|
|||||||
return SNMP_INTEGER(ntohl(oi->area->area_id));
|
return SNMP_INTEGER(ntohl(oi->area->area_id));
|
||||||
break;
|
break;
|
||||||
case OSPFv3IFTYPE:
|
case OSPFv3IFTYPE:
|
||||||
if (if_is_broadcast(oi->interface))
|
if (oi->type == OSPF_IFTYPE_BROADCAST)
|
||||||
return SNMP_INTEGER(1);
|
return SNMP_INTEGER(1);
|
||||||
else if (if_is_pointopoint(oi->interface))
|
else if (oi->type == OSPF_IFTYPE_POINTOPOINT)
|
||||||
return SNMP_INTEGER(3);
|
return SNMP_INTEGER(3);
|
||||||
else
|
else
|
||||||
break; /* Unknown, don't put anything */
|
break; /* Unknown, don't put anything */
|
||||||
|
Loading…
Reference in New Issue
Block a user