summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ospf_interface.c8
-rw-r--r--ospfd/ospf_vty.c5
-rw-r--r--ospfd/ospf_zebra.c12
-rw-r--r--zebra/irdp_interface.c33
-rw-r--r--zebra/irdp_main.c2
-rw-r--r--zebra/zebra_vty.c6
6 files changed, 29 insertions, 37 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 137df16a05..0075506ccd 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -59,7 +59,13 @@ ospf_if_get_output_cost (struct ospf_interface *oi)
u_int32_t cost;
u_int32_t bw, refbw;
- bw = oi->ifp->bandwidth ? oi->ifp->bandwidth : OSPF_DEFAULT_BANDWIDTH;
+ /* ifp speed and bw can be 0 in some platforms, use ospf default bw
+ if bw is configured under interface it would be used.
+ */
+ if (!oi->ifp->bandwidth && oi->ifp->speed)
+ bw = oi->ifp->speed;
+ else
+ bw = oi->ifp->bandwidth ? oi->ifp->bandwidth : OSPF_DEFAULT_BANDWIDTH;
refbw = oi->ospf->ref_bandwidth;
/* A specifed ip ospf cost overrides a calculated one. */
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 0eb3aa6a8a..7e8c5ce2ce 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -3252,6 +3252,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface
int is_up;
struct ospf_neighbor *nbr;
struct route_node *rn;
+ uint32_t bandwidth = ifp->bandwidth ? ifp->bandwidth : ifp->speed;
/* Is interface up? */
if (use_json)
@@ -3264,7 +3265,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface
json_object_int_add(json_interface_sub, "ifIndex", ifp->ifindex);
json_object_int_add(json_interface_sub, "mtuBytes", ifp->mtu);
- json_object_int_add(json_interface_sub, "bandwidthMbit", ifp->bandwidth);
+ json_object_int_add(json_interface_sub, "bandwidthMbit", bandwidth);
json_object_string_add(json_interface_sub, "ifFlags", if_flag_dump(ifp->flags));
}
else
@@ -3272,7 +3273,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, struct interface
vty_out (vty, "%s is %s%s", ifp->name,
((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE);
vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Mbit %s%s",
- ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags),
+ ifp->ifindex, ifp->mtu, bandwidth, if_flag_dump(ifp->flags),
VTY_NEWLINE);
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index abb6db0347..d2dd0cf367 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -188,16 +188,10 @@ ospf_interface_state_up (int command, struct zclient *zclient,
zebra_interface_if_set_value (zclient->ibuf, ifp);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- zlog_debug ("Zebra: Interface[%s] state update.", ifp->name);
+ zlog_debug ("Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
+ ifp->name, if_tmp.speed, ifp->speed, if_tmp.bandwidth, ifp->bandwidth);
- if (if_tmp.bandwidth != ifp->bandwidth)
- {
- if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.",
- ifp->name, if_tmp.bandwidth, ifp->bandwidth);
-
- ospf_if_recalculate_output_cost (ifp);
- }
+ ospf_if_recalculate_output_cost (ifp);
if (if_tmp.mtu != ifp->mtu)
{
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index 5cabe7e62f..407738d80f 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -476,18 +476,15 @@ DEFUN (ip_irdp_minadvertinterval,
zi=ifp->info;
irdp=&zi->irdp;
- if( (unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
+ if((unsigned) atoi(argv[idx_number]->arg) <= irdp->MaxAdvertInterval) {
irdp->MinAdvertInterval = atoi(argv[idx_number]->arg);
-
return CMD_SUCCESS;
}
-
- vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
- VTY_NEWLINE);
-
- vty_out (vty, "Please correct!%s",
- VTY_NEWLINE);
- return CMD_WARNING;
+ else {
+ vty_out (vty, "%% MinAdvertInterval must be less than or equal to "
+ "MaxAdvertInterval%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
DEFUN (ip_irdp_maxadvertinterval,
@@ -506,19 +503,15 @@ DEFUN (ip_irdp_maxadvertinterval,
zi=ifp->info;
irdp=&zi->irdp;
-
- if( irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg) ) {
- irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
-
+ if(irdp->MinAdvertInterval <= (unsigned) atoi(argv[idx_number]->arg)) {
+ irdp->MaxAdvertInterval = atoi(argv[idx_number]->arg);
return CMD_SUCCESS;
}
-
- vty_out (vty, "ICMP warning maxadvertinterval is greater or equal than minadvertinterval%s",
- VTY_NEWLINE);
-
- vty_out (vty, "Please correct!%s",
- VTY_NEWLINE);
- return CMD_WARNING;
+ else {
+ vty_out (vty, "%% MaxAdvertInterval must be greater than or equal to "
+ "MinAdvertInterval%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
/* DEFUN needs to be fixed for negative ranages...
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 7fa4ad4cbe..6965dca3e4 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -234,7 +234,7 @@ int irdp_send_thread(struct thread *t_advert)
}
tmp = irdp->MaxAdvertInterval-irdp->MinAdvertInterval;
- timer = (random () % tmp ) + 1;
+ timer = random () % (tmp + 1);
timer = irdp->MinAdvertInterval + timer;
if(irdp->irdp_sent < MAX_INITIAL_ADVERTISEMENTS &&
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 1708138d83..a8bee3cf50 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -2423,10 +2423,10 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, ifname,
+ static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, NULL, NULL, ifindex, tag,
+ static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, tag,
distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -2510,7 +2510,6 @@ DEFUN (ipv6_route,
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Null interface\n"
- "Null interface\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
@@ -2559,7 +2558,6 @@ DEFUN (ipv6_route_flags,
"IPv6 gateway interface name\n"
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n"
- "Silently discard pkts when matched\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"