summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_gr_helper.c16
-rw-r--r--ospfd/ospf_opaque.c2
-rw-r--r--ospfd/ospf_opaque.h2
-rw-r--r--ospfd/ospf_routemap.c176
-rw-r--r--ospfd/ospf_te.c12
-rw-r--r--ospfd/ospf_zebra.c6
6 files changed, 96 insertions, 118 deletions
diff --git a/ospfd/ospf_gr_helper.c b/ospfd/ospf_gr_helper.c
index 9c029a49ba..a86e1b8401 100644
--- a/ospfd/ospf_gr_helper.c
+++ b/ospfd/ospf_gr_helper.c
@@ -251,7 +251,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa,
/* Check TLV len against overall LSA */
if (sum + TLV_SIZE(tlvh) > length) {
if (IS_DEBUG_OSPF_GR_HELPER)
- zlog_debug("%s: Malformed packet: Invalid TLV len:%zu",
+ zlog_debug("%s: Malformed packet: Invalid TLV len:%u",
__func__, TLV_SIZE(tlvh));
return OSPF_GR_FAILURE;
}
@@ -260,7 +260,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa,
case GRACE_PERIOD_TYPE:
if (TLV_SIZE(tlvh) <
sizeof(struct grace_tlv_graceperiod)) {
- zlog_debug("%s: Malformed packet: Invalid grace TLV len:%zu",
+ zlog_debug("%s: Malformed packet: Invalid grace TLV len:%u",
__func__, TLV_SIZE(tlvh));
return OSPF_GR_FAILURE;
}
@@ -277,7 +277,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa,
case RESTART_REASON_TYPE:
if (TLV_SIZE(tlvh) <
sizeof(struct grace_tlv_restart_reason)) {
- zlog_debug("%s: Malformed packet: Invalid reason TLV len:%zu",
+ zlog_debug("%s: Malformed packet: Invalid reason TLV len:%u",
__func__, TLV_SIZE(tlvh));
return OSPF_GR_FAILURE;
}
@@ -292,7 +292,7 @@ static int ospf_extract_grace_lsa_fields(struct ospf_lsa *lsa,
case RESTARTER_IP_ADDR_TYPE:
if (TLV_SIZE(tlvh) <
sizeof(struct grace_tlv_restart_addr)) {
- zlog_debug("%s: Malformed packet: Invalid addr TLV len:%zu",
+ zlog_debug("%s: Malformed packet: Invalid addr TLV len:%u",
__func__, TLV_SIZE(tlvh));
return OSPF_GR_FAILURE;
}
@@ -1018,7 +1018,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa)
tlvh = TLV_HDR_NEXT(tlvh)) {
/* Check TLV len */
if (sum + TLV_SIZE(tlvh) > length) {
- vty_out(vty, "%% Invalid TLV length: %zu\n",
+ vty_out(vty, "%% Invalid TLV length: %u\n",
TLV_SIZE(tlvh));
return;
}
@@ -1028,7 +1028,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa)
if (TLV_SIZE(tlvh) <
sizeof(struct grace_tlv_graceperiod)) {
vty_out(vty,
- "%% Invalid grace TLV length %zu\n",
+ "%% Invalid grace TLV length %u\n",
TLV_SIZE(tlvh));
return;
}
@@ -1043,7 +1043,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa)
if (TLV_SIZE(tlvh) <
sizeof(struct grace_tlv_restart_reason)) {
vty_out(vty,
- "%% Invalid reason TLV length %zu\n",
+ "%% Invalid reason TLV length %u\n",
TLV_SIZE(tlvh));
return;
}
@@ -1058,7 +1058,7 @@ static void show_ospf_grace_lsa_info(struct vty *vty, struct ospf_lsa *lsa)
if (TLV_SIZE(tlvh) <
sizeof(struct grace_tlv_restart_addr)) {
vty_out(vty,
- "%% Invalid addr TLV length %zu\n",
+ "%% Invalid addr TLV length %u\n",
TLV_SIZE(tlvh));
return;
}
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index eb0c4a949a..3939b5479f 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -126,6 +126,8 @@ void ospf_opaque_term(void)
void ospf_opaque_finish(void)
{
+ ospf_mpls_te_finish();
+
ospf_router_info_finish();
ospf_ext_finish();
diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h
index f02f34c9af..c63b8ebdaf 100644
--- a/ospfd/ospf_opaque.h
+++ b/ospfd/ospf_opaque.h
@@ -94,7 +94,7 @@ struct tlv_header {
#define TLV_BODY_SIZE(tlvh) (ROUNDUP(ntohs((tlvh)->length), sizeof(uint32_t)))
-#define TLV_SIZE(tlvh) (TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh))
+#define TLV_SIZE(tlvh) (uint32_t)(TLV_HDR_SIZE + TLV_BODY_SIZE(tlvh))
#define TLV_HDR_TOP(lsah) \
(struct tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE)
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index c89fd3597f..f9e11541fc 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -127,27 +127,22 @@ static void ospf_route_map_event(const char *name)
/* `match ip netxthop ' */
/* Match function return 1 if match is success else return zero. */
static enum route_map_cmd_result_t
-route_match_ip_nexthop(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+route_match_ip_nexthop(void *rule, const struct prefix *prefix, void *object)
{
struct access_list *alist;
struct external_info *ei = object;
struct prefix_ipv4 p;
- if (type == RMAP_OSPF) {
- p.family = AF_INET;
- p.prefix = ei->nexthop;
- p.prefixlen = IPV4_MAX_BITLEN;
+ p.family = AF_INET;
+ p.prefix = ei->nexthop;
+ p.prefixlen = IPV4_MAX_BITLEN;
- alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
- return RMAP_NOMATCH;
+ alist = access_list_lookup(AFI_IP, (char *)rule);
+ if (alist == NULL)
+ return RMAP_NOMATCH;
- return (access_list_apply(alist, &p) == FILTER_DENY
- ? RMAP_NOMATCH
- : RMAP_MATCH);
- }
- return RMAP_NOMATCH;
+ return (access_list_apply(alist, &p) == FILTER_DENY ? RMAP_NOMATCH
+ : RMAP_MATCH);
}
/* Route map `ip next-hop' match statement. `arg' should be
@@ -175,26 +170,22 @@ static const struct route_map_rule_cmd route_match_ip_nexthop_cmd = {
static enum route_map_cmd_result_t
route_match_ip_next_hop_prefix_list(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+ void *object)
{
struct prefix_list *plist;
struct external_info *ei = object;
struct prefix_ipv4 p;
- if (type == RMAP_OSPF) {
- p.family = AF_INET;
- p.prefix = ei->nexthop;
- p.prefixlen = IPV4_MAX_BITLEN;
+ p.family = AF_INET;
+ p.prefix = ei->nexthop;
+ p.prefixlen = IPV4_MAX_BITLEN;
- plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
- return RMAP_NOMATCH;
+ plist = prefix_list_lookup(AFI_IP, (char *)rule);
+ if (plist == NULL)
+ return RMAP_NOMATCH;
- return (prefix_list_apply(plist, &p) == PREFIX_DENY
- ? RMAP_NOMATCH
- : RMAP_MATCH);
- }
- return RMAP_NOMATCH;
+ return (prefix_list_apply(plist, &p) == PREFIX_DENY ? RMAP_NOMATCH
+ : RMAP_MATCH);
}
static void *route_match_ip_next_hop_prefix_list_compile(const char *arg)
@@ -219,11 +210,11 @@ static const struct route_map_rule_cmd
static enum route_map_cmd_result_t
route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+ void *object)
{
struct external_info *ei = object;
- if (type == RMAP_OSPF && prefix->family == AF_INET) {
+ if (prefix->family == AF_INET) {
ei = (struct external_info *)object;
if (!ei)
return RMAP_NOMATCH;
@@ -256,22 +247,17 @@ static const struct route_map_rule_cmd
/* Match function should return 1 if match is success else return
zero. */
static enum route_map_cmd_result_t
-route_match_ip_address(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+route_match_ip_address(void *rule, const struct prefix *prefix, void *object)
{
struct access_list *alist;
/* struct prefix_ipv4 match; */
- if (type == RMAP_OSPF) {
- alist = access_list_lookup(AFI_IP, (char *)rule);
- if (alist == NULL)
- return RMAP_NOMATCH;
+ alist = access_list_lookup(AFI_IP, (char *)rule);
+ if (alist == NULL)
+ return RMAP_NOMATCH;
- return (access_list_apply(alist, prefix) == FILTER_DENY
- ? RMAP_NOMATCH
- : RMAP_MATCH);
- }
- return RMAP_NOMATCH;
+ return (access_list_apply(alist, prefix) == FILTER_DENY ? RMAP_NOMATCH
+ : RMAP_MATCH);
}
/* Route map `ip address' match statement. `arg' should be
@@ -298,20 +284,16 @@ static const struct route_map_rule_cmd route_match_ip_address_cmd = {
/* `match ip address prefix-list PREFIX_LIST' */
static enum route_map_cmd_result_t
route_match_ip_address_prefix_list(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+ void *object)
{
struct prefix_list *plist;
- if (type == RMAP_OSPF) {
- plist = prefix_list_lookup(AFI_IP, (char *)rule);
- if (plist == NULL)
- return RMAP_NOMATCH;
+ plist = prefix_list_lookup(AFI_IP, (char *)rule);
+ if (plist == NULL)
+ return RMAP_NOMATCH;
- return (prefix_list_apply(plist, prefix) == PREFIX_DENY
- ? RMAP_NOMATCH
- : RMAP_MATCH);
- }
- return RMAP_NOMATCH;
+ return (prefix_list_apply(plist, prefix) == PREFIX_DENY ? RMAP_NOMATCH
+ : RMAP_MATCH);
}
static void *route_match_ip_address_prefix_list_compile(const char *arg)
@@ -336,22 +318,18 @@ static const struct route_map_rule_cmd
/* Match function should return 1 if match is success else return
zero. */
static enum route_map_cmd_result_t
-route_match_interface(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+route_match_interface(void *rule, const struct prefix *prefix, void *object)
{
struct interface *ifp;
struct external_info *ei;
- if (type == RMAP_OSPF) {
- ei = object;
- ifp = if_lookup_by_name_all_vrf((char *)rule);
+ ei = object;
+ ifp = if_lookup_by_name_all_vrf((char *)rule);
- if (ifp == NULL || ifp->ifindex != ei->ifindex)
- return RMAP_NOMATCH;
+ if (ifp == NULL || ifp->ifindex != ei->ifindex)
+ return RMAP_NOMATCH;
- return RMAP_MATCH;
- }
- return RMAP_NOMATCH;
+ return RMAP_MATCH;
}
/* Route map `interface' match statement. `arg' should be
@@ -377,20 +355,15 @@ static const struct route_map_rule_cmd route_match_interface_cmd = {
/* Match function return 1 if match is success else return zero. */
static enum route_map_cmd_result_t
-route_match_tag(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+route_match_tag(void *rule, const struct prefix *prefix, void *object)
{
route_tag_t *tag;
struct external_info *ei;
- if (type == RMAP_OSPF) {
- tag = rule;
- ei = object;
+ tag = rule;
+ ei = object;
- return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH);
- }
-
- return RMAP_NOMATCH;
+ return ((ei->tag == *tag) ? RMAP_MATCH : RMAP_NOMATCH);
}
/* Route map commands for tag matching. */
@@ -410,33 +383,31 @@ struct ospf_metric {
/* `set metric METRIC' */
/* Set metric to attribute. */
static enum route_map_cmd_result_t
-route_set_metric(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+route_set_metric(void *rule, const struct prefix *prefix, void *object)
{
struct ospf_metric *metric;
struct external_info *ei;
- if (type == RMAP_OSPF) {
- /* Fetch routemap's rule information. */
- metric = rule;
- ei = object;
+ /* Fetch routemap's rule information. */
+ metric = rule;
+ ei = object;
- /* Set metric out value. */
- if (!metric->used)
- return RMAP_OKAY;
+ /* Set metric out value. */
+ if (!metric->used)
+ return RMAP_OKAY;
- ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC;
+ ei->route_map_set.metric = DEFAULT_DEFAULT_METRIC;
- if (metric->type == metric_increment)
- ei->route_map_set.metric += metric->metric;
- else if (metric->type == metric_decrement)
- ei->route_map_set.metric -= metric->metric;
- else if (metric->type == metric_absolute)
- ei->route_map_set.metric = metric->metric;
+ if (metric->type == metric_increment)
+ ei->route_map_set.metric += metric->metric;
+ else if (metric->type == metric_decrement)
+ ei->route_map_set.metric -= metric->metric;
+ else if (metric->type == metric_absolute)
+ ei->route_map_set.metric = metric->metric;
+
+ if (ei->route_map_set.metric > OSPF_LS_INFINITY)
+ ei->route_map_set.metric = OSPF_LS_INFINITY;
- if (ei->route_map_set.metric > OSPF_LS_INFINITY)
- ei->route_map_set.metric = OSPF_LS_INFINITY;
- }
return RMAP_OKAY;
}
@@ -492,20 +463,18 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
/* `set metric-type TYPE' */
/* Set metric-type to attribute. */
static enum route_map_cmd_result_t
-route_set_metric_type(void *rule, const struct prefix *prefix,
- route_map_object_t type, void *object)
+route_set_metric_type(void *rule, const struct prefix *prefix, void *object)
{
uint32_t *metric_type;
struct external_info *ei;
- if (type == RMAP_OSPF) {
- /* Fetch routemap's rule information. */
- metric_type = rule;
- ei = object;
+ /* Fetch routemap's rule information. */
+ metric_type = rule;
+ ei = object;
+
+ /* Set metric out value. */
+ ei->route_map_set.metric_type = *metric_type;
- /* Set metric out value. */
- ei->route_map_set.metric_type = *metric_type;
- }
return RMAP_OKAY;
}
@@ -543,19 +512,16 @@ static const struct route_map_rule_cmd route_set_metric_type_cmd = {
};
static enum route_map_cmd_result_t
-route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,
- void *object)
+route_set_tag(void *rule, const struct prefix *prefix, void *object)
{
route_tag_t *tag;
struct external_info *ei;
- if (type == RMAP_OSPF) {
- tag = rule;
- ei = object;
+ tag = rule;
+ ei = object;
- /* Set tag value */
- ei->tag = *tag;
- }
+ /* Set tag value */
+ ei->tag = *tag;
return RMAP_OKAY;
}
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index e3c554c530..17ff9a1a46 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -187,6 +187,7 @@ void ospf_mpls_te_finish(void)
// list_delete_all_node(OspfMplsTE.iflist);
OspfMplsTE.enabled = false;
+ ospf_mpls_te_unregister();
OspfMplsTE.inter_as = Off;
}
@@ -2229,6 +2230,17 @@ DEFUN (no_ospf_mpls_te,
if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED))
ospf_mpls_te_lsa_schedule(lp, FLUSH_THIS_LSA);
+ /*
+ * This resets the OspfMplsTE.inter_as to its initial state.
+ * This is to avoid having an inter-as value different from
+ * Off when mpls-te gets restarted (after being removed)
+ */
+ if (OspfMplsTE.inter_as != Off) {
+ /* Deregister the Callbacks for Inter-AS support */
+ ospf_mpls_te_unregister();
+ OspfMplsTE.inter_as = Off;
+ }
+
return CMD_SUCCESS;
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index fd965e8f21..d449f9d2fa 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -902,8 +902,7 @@ int ospf_external_info_apply_default_routemap(struct ospf *ospf,
if (red && ROUTEMAP_NAME(red)) {
route_map_result_t ret;
- ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p,
- RMAP_OSPF, ei);
+ ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, ei);
if (ret == RMAP_DENYMATCH) {
ei->route_map_set = save_values;
@@ -1056,8 +1055,7 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei,
if (red && ROUTEMAP_NAME(red)) {
route_map_result_t ret;
- ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p,
- RMAP_OSPF, ei);
+ ret = route_map_apply(ROUTEMAP(red), (struct prefix *)p, ei);
if (ret == RMAP_DENYMATCH) {
ei->route_map_set = save_values;