diff options
| -rw-r--r-- | bgpd/bgp_routemap.c | 444 | ||||
| -rw-r--r-- | bgpd/bgp_rpki.c | 2 | ||||
| -rw-r--r-- | eigrpd/eigrp_routemap.c | 85 | ||||
| -rw-r--r-- | isisd/isis_routemap.c | 45 | ||||
| -rw-r--r-- | lib/routemap.c | 28 | ||||
| -rw-r--r-- | lib/routemap.h | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 46 | ||||
| -rw-r--r-- | ospfd/ospf_routemap.c | 78 | ||||
| -rw-r--r-- | ripd/rip_routemap.c | 93 | ||||
| -rw-r--r-- | ripngd/ripng_routemap.c | 48 | ||||
| -rw-r--r-- | zebra/zebra_routemap.c | 136 | 
11 files changed, 667 insertions, 342 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 4d73faa87c..ecd770a1d1 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -334,9 +334,12 @@ static void route_match_peer_free(void *rule)  }  /* Route map commands for ip address matching. */ -struct route_map_rule_cmd route_match_peer_cmd = {"peer", route_match_peer, -						  route_match_peer_compile, -						  route_match_peer_free}; +static const struct route_map_rule_cmd route_match_peer_cmd = { +	"peer", +	route_match_peer, +	route_match_peer_compile, +	route_match_peer_free +};  #if defined(HAVE_LUA)  static enum route_map_cmd_result_t @@ -425,7 +428,7 @@ route_match_command_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_command_cmd = { +static const struct route_map_rule_cmd route_match_command_cmd = {  	"command",  	route_match_command,  	route_match_command_compile, @@ -469,9 +472,12 @@ static void route_match_ip_address_free(void *rule)  }  /* Route map commands for ip address matching. */ -struct route_map_rule_cmd route_match_ip_address_cmd = { -	"ip address", route_match_ip_address, route_match_ip_address_compile, -	route_match_ip_address_free}; +static const struct route_map_rule_cmd route_match_ip_address_cmd = { +	"ip address", +	route_match_ip_address, +	route_match_ip_address_compile, +	route_match_ip_address_free +};  /* `match ip next-hop IP_ADDRESS' */ @@ -515,9 +521,12 @@ static void route_match_ip_next_hop_free(void *rule)  }  /* Route map commands for ip next-hop matching. */ -struct route_map_rule_cmd route_match_ip_next_hop_cmd = { -	"ip next-hop", route_match_ip_next_hop, route_match_ip_next_hop_compile, -	route_match_ip_next_hop_free}; +static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { +	"ip next-hop", +	route_match_ip_next_hop, +	route_match_ip_next_hop_compile, +	route_match_ip_next_hop_free +};  /* `match ip route-source ACCESS-LIST' */ @@ -567,9 +576,12 @@ static void route_match_ip_route_source_free(void *rule)  }  /* Route map commands for ip route-source matching. */ -struct route_map_rule_cmd route_match_ip_route_source_cmd = { -	"ip route-source", route_match_ip_route_source, -	route_match_ip_route_source_compile, route_match_ip_route_source_free}; +static const struct route_map_rule_cmd route_match_ip_route_source_cmd = { +	"ip route-source", +	route_match_ip_route_source, +	route_match_ip_route_source_compile, +	route_match_ip_route_source_free +};  static enum route_map_cmd_result_t  route_match_prefix_list_flowspec(afi_t afi, struct prefix_list *plist, @@ -643,10 +655,13 @@ static void route_match_ip_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { -	"ip address prefix-list", route_match_ip_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_list_cmd = { +	"ip address prefix-list", +	route_match_ip_address_prefix_list,  	route_match_ip_address_prefix_list_compile, -	route_match_ip_address_prefix_list_free}; +	route_match_ip_address_prefix_list_free +};  /* `match ip next-hop prefix-list PREFIX_LIST' */ @@ -685,10 +700,13 @@ static void route_match_ip_next_hop_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = { -	"ip next-hop prefix-list", route_match_ip_next_hop_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_prefix_list_cmd = { +	"ip next-hop prefix-list", +	route_match_ip_next_hop_prefix_list,  	route_match_ip_next_hop_prefix_list_compile, -	route_match_ip_next_hop_prefix_list_free}; +	route_match_ip_next_hop_prefix_list_free +};  /* `match ip next-hop type <blackhole>' */ @@ -724,10 +742,13 @@ static void route_match_ip_next_hop_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = { -	"ip next-hop type", route_match_ip_next_hop_type, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_type_cmd = { +	"ip next-hop type", +	route_match_ip_next_hop_type,  	route_match_ip_next_hop_type_compile, -	route_match_ip_next_hop_type_free}; +	route_match_ip_next_hop_type_free +};  /* `match ip route-source prefix-list PREFIX_LIST' */ @@ -773,10 +794,13 @@ static void route_match_ip_route_source_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ip_route_source_prefix_list_cmd = { -	"ip route-source prefix-list", route_match_ip_route_source_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_route_source_prefix_list_cmd = { +	"ip route-source prefix-list", +	route_match_ip_route_source_prefix_list,  	route_match_ip_route_source_prefix_list_compile, -	route_match_ip_route_source_prefix_list_free}; +	route_match_ip_route_source_prefix_list_free +};  /* `match evpn default-route' */ @@ -792,8 +816,13 @@ route_match_evpn_default_route(void *rule, const struct prefix *p,  }  /* Route map commands for default-route matching. */ -struct route_map_rule_cmd route_match_evpn_default_route_cmd = { -	"evpn default-route", route_match_evpn_default_route, NULL, NULL}; +static const struct route_map_rule_cmd +		route_match_evpn_default_route_cmd = { +	"evpn default-route", +	route_match_evpn_default_route, +	NULL, +	NULL +};  /* `match mac address MAC_ACCESS_LIST' */ @@ -840,9 +869,12 @@ static void route_match_mac_address_free(void *rule)  }  /* Route map commands for mac address matching. */ -struct route_map_rule_cmd route_match_mac_address_cmd = { -	"mac address", route_match_mac_address, route_match_mac_address_compile, -	route_match_mac_address_free}; +static const struct route_map_rule_cmd route_match_mac_address_cmd = { +	"mac address", +	route_match_mac_address, +	route_match_mac_address_compile, +	route_match_mac_address_free +};  /*   * Match function returns: @@ -917,9 +949,12 @@ static void route_match_vni_free(void *rule)  }  /* Route map commands for vni matching. */ -struct route_map_rule_cmd route_match_evpn_vni_cmd = { -	"evpn vni", route_match_vni, route_match_vni_compile, -	route_match_vni_free}; +static const struct route_map_rule_cmd route_match_evpn_vni_cmd = { +	"evpn vni", +	route_match_vni, +	route_match_vni_compile, +	route_match_vni_free +};  /* `match evpn route-type' */ @@ -965,9 +1000,12 @@ static void route_match_evpn_route_type_free(void *rule)  }  /* Route map commands for evpn route-type  matching. */ -struct route_map_rule_cmd route_match_evpn_route_type_cmd = { -	"evpn route-type", route_match_evpn_route_type, -	route_match_evpn_route_type_compile, route_match_evpn_route_type_free}; +static const struct route_map_rule_cmd route_match_evpn_route_type_cmd = { +	"evpn route-type", +	route_match_evpn_route_type, +	route_match_evpn_route_type_compile, +	route_match_evpn_route_type_free +};  /* `match rd' */ @@ -1022,9 +1060,12 @@ static void route_match_rd_free(void *rule)  }  /* Route map commands for rd matching. */ -struct route_map_rule_cmd route_match_evpn_rd_cmd = { -	"evpn rd", route_match_rd, route_match_rd_compile, -	route_match_rd_free}; +static const struct route_map_rule_cmd route_match_evpn_rd_cmd = { +	"evpn rd", +	route_match_rd, +	route_match_rd_compile, +	route_match_rd_free +};  /* Route map commands for VRF route leak with source vrf matching */  static enum route_map_cmd_result_t @@ -1068,10 +1109,12 @@ static void route_match_vrl_source_vrf_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_vrl_source_vrf_cmd = { -	"source-vrf", route_match_vrl_source_vrf, +static const struct route_map_rule_cmd route_match_vrl_source_vrf_cmd = { +	"source-vrf", +	route_match_vrl_source_vrf,  	route_match_vrl_source_vrf_compile, -	route_match_vrl_source_vrf_free}; +	route_match_vrl_source_vrf_free +};  /* `match local-preference LOCAL-PREF' */ @@ -1127,9 +1170,12 @@ static void route_match_local_pref_free(void *rule)  }  /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_local_pref_cmd = { -	"local-preference", route_match_local_pref, -	route_match_local_pref_compile, route_match_local_pref_free}; +static const struct route_map_rule_cmd route_match_local_pref_cmd = { +	"local-preference", +	route_match_local_pref, +	route_match_local_pref_compile, +	route_match_local_pref_free +};  /* `match metric METRIC' */ @@ -1150,8 +1196,11 @@ route_match_metric(void *rule, const struct prefix *prefix,  }  /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_metric_cmd = { -	"metric", route_match_metric, route_value_compile, route_value_free, +static const struct route_map_rule_cmd route_match_metric_cmd = { +	"metric", +	route_match_metric, +	route_value_compile, +	route_value_free,  };  /* `match as-path ASPATH' */ @@ -1194,9 +1243,12 @@ static void route_match_aspath_free(void *rule)  }  /* Route map commands for aspath matching. */ -struct route_map_rule_cmd route_match_aspath_cmd = { -	"as-path", route_match_aspath, route_match_aspath_compile, -	route_match_aspath_free}; +static const struct route_map_rule_cmd route_match_aspath_cmd = { +	"as-path", +	route_match_aspath, +	route_match_aspath_compile, +	route_match_aspath_free +};  /* `match community COMMUNIY' */  struct rmap_community { @@ -1286,9 +1338,13 @@ static void *route_match_get_community_key(void *rule)  /* Route map commands for community matching. */ -struct route_map_rule_cmd route_match_community_cmd = { -	"community", route_match_community, route_match_community_compile, -	route_match_community_free, route_match_get_community_key}; +static const struct route_map_rule_cmd route_match_community_cmd = { +	"community", +	route_match_community, +	route_match_community_compile, +	route_match_community_free, +	route_match_get_community_key +};  /* Match function for lcommunity match. */  static enum route_map_cmd_result_t @@ -1357,10 +1413,13 @@ static void route_match_lcommunity_free(void *rule)  }  /* Route map commands for community matching. */ -struct route_map_rule_cmd route_match_lcommunity_cmd = { -	"large-community", route_match_lcommunity, -	route_match_lcommunity_compile, route_match_lcommunity_free, -	route_match_get_community_key}; +static const struct route_map_rule_cmd route_match_lcommunity_cmd = { +	"large-community", +	route_match_lcommunity, +	route_match_lcommunity_compile, +	route_match_lcommunity_free, +	route_match_get_community_key +};  /* Match function for extcommunity match. */ @@ -1409,9 +1468,12 @@ static void route_match_ecommunity_free(void *rule)  }  /* Route map commands for community matching. */ -struct route_map_rule_cmd route_match_ecommunity_cmd = { -	"extcommunity", route_match_ecommunity, route_match_ecommunity_compile, -	route_match_ecommunity_free}; +static const struct route_map_rule_cmd route_match_ecommunity_cmd = { +	"extcommunity", +	route_match_ecommunity, +	route_match_ecommunity_compile, +	route_match_ecommunity_free +};  /* `match nlri` and `set nlri` are replaced by `address-family ipv4`     and `address-family vpnv4'.  */ @@ -1458,9 +1520,12 @@ static void route_match_origin_free(void *rule)  }  /* Route map commands for origin matching. */ -struct route_map_rule_cmd route_match_origin_cmd = { -	"origin", route_match_origin, route_match_origin_compile, -	route_match_origin_free}; +static const struct route_map_rule_cmd route_match_origin_cmd = { +	"origin", +	route_match_origin, +	route_match_origin_compile, +	route_match_origin_free +};  /* match probability  { */ @@ -1511,9 +1576,12 @@ static void route_match_probability_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_probability_cmd = { -	"probability", route_match_probability, route_match_probability_compile, -	route_match_probability_free}; +static const struct route_map_rule_cmd route_match_probability_cmd = { +	"probability", +	route_match_probability, +	route_match_probability_compile, +	route_match_probability_free +};  /* `match interface IFNAME' */  /* Match function should return 1 if match is success else return @@ -1555,9 +1623,12 @@ static void route_match_interface_free(void *rule)  }  /* Route map commands for ip address matching. */ -struct route_map_rule_cmd route_match_interface_cmd = { -	"interface", route_match_interface, route_match_interface_compile, -	route_match_interface_free}; +static const struct route_map_rule_cmd route_match_interface_cmd = { +	"interface", +	route_match_interface, +	route_match_interface_compile, +	route_match_interface_free +};  /* } */ @@ -1583,8 +1654,10 @@ route_match_tag(void *rule, const struct prefix *prefix,  /* Route map commands for tag matching. */ -static struct route_map_rule_cmd route_match_tag_cmd = { -	"tag", route_match_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_match_tag_cmd = { +	"tag", +	route_match_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -1694,9 +1767,12 @@ static void route_set_ip_nexthop_free(void *rule)  }  /* Route map commands for ip nexthop set. */ -struct route_map_rule_cmd route_set_ip_nexthop_cmd = { -	"ip next-hop", route_set_ip_nexthop, route_set_ip_nexthop_compile, -	route_set_ip_nexthop_free}; +static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = { +	"ip next-hop", +	route_set_ip_nexthop, +	route_set_ip_nexthop_compile, +	route_set_ip_nexthop_free +};  /* `set local-preference LOCAL_PREF' */ @@ -1727,8 +1803,10 @@ route_set_local_pref(void *rule, const struct prefix *prefix,  }  /* Set local preference rule structure. */ -struct route_map_rule_cmd route_set_local_pref_cmd = { -	"local-preference", route_set_local_pref, route_value_compile, +static const struct route_map_rule_cmd route_set_local_pref_cmd = { +	"local-preference", +	route_set_local_pref, +	route_value_compile,  	route_value_free,  }; @@ -1755,8 +1833,11 @@ route_set_weight(void *rule, const struct prefix *prefix,  }  /* Set local preference rule structure. */ -struct route_map_rule_cmd route_set_weight_cmd = { -	"weight", route_set_weight, route_value_compile, route_value_free, +static const struct route_map_rule_cmd route_set_weight_cmd = { +	"weight", +	route_set_weight, +	route_value_compile, +	route_value_free,  };  /* `set distance DISTANCE */ @@ -1776,7 +1857,7 @@ route_set_distance(void *rule, const struct prefix *prefix,  }  /* set distance rule structure */ -struct route_map_rule_cmd route_set_distance_cmd = { +static const struct route_map_rule_cmd route_set_distance_cmd = {  	"distance",  	route_set_distance,  	route_value_compile, @@ -1809,8 +1890,11 @@ route_set_metric(void *rule, const struct prefix *prefix,  }  /* Set metric rule structure. */ -struct route_map_rule_cmd route_set_metric_cmd = { -	"metric", route_set_metric, route_value_compile, route_value_free, +static const struct route_map_rule_cmd route_set_metric_cmd = { +	"metric", +	route_set_metric, +	route_value_compile, +	route_value_free,  };  /* `set table (1-4294967295)' */ @@ -1834,9 +1918,11 @@ static enum route_map_cmd_result_t route_set_table_id(void *rule,  }  /* Set table_id rule structure. */ -static struct route_map_rule_cmd route_set_table_id_cmd = { -	"table", route_set_table_id, -	route_value_compile, route_value_free +static const struct route_map_rule_cmd route_set_table_id_cmd = { +	"table", +	route_set_table_id, +	route_value_compile, +	route_value_free  };  /* `set as-path prepend ASPATH' */ @@ -1892,9 +1978,11 @@ static void route_set_aspath_prepend_free(void *rule)  /* Set as-path prepend rule structure. */ -struct route_map_rule_cmd route_set_aspath_prepend_cmd = { -	"as-path prepend", route_set_aspath_prepend, -	route_set_aspath_prepend_compile, route_set_aspath_prepend_free, +static const struct route_map_rule_cmd route_set_aspath_prepend_cmd = { +	"as-path prepend", +	route_set_aspath_prepend, +	route_set_aspath_prepend_compile, +	route_set_aspath_prepend_free,  };  /* `set as-path exclude ASn' */ @@ -1925,8 +2013,10 @@ route_set_aspath_exclude(void *rule, const struct prefix *dummy,  }  /* Set ASn exlude rule structure. */ -struct route_map_rule_cmd route_set_aspath_exclude_cmd = { -	"as-path exclude", route_set_aspath_exclude, route_aspath_compile, +static const struct route_map_rule_cmd route_set_aspath_exclude_cmd = { +	"as-path exclude", +	route_set_aspath_exclude, +	route_aspath_compile,  	route_aspath_free,  }; @@ -2039,8 +2129,10 @@ static void route_set_community_free(void *rule)  }  /* Set community rule structure. */ -struct route_map_rule_cmd route_set_community_cmd = { -	"community", route_set_community, route_set_community_compile, +static const struct route_map_rule_cmd route_set_community_cmd = { +	"community", +	route_set_community, +	route_set_community_compile,  	route_set_community_free,  }; @@ -2157,8 +2249,10 @@ static void route_set_lcommunity_free(void *rule)  }  /* Set community rule structure. */ -struct route_map_rule_cmd route_set_lcommunity_cmd = { -	"large-community", route_set_lcommunity, route_set_lcommunity_compile, +static const struct route_map_rule_cmd route_set_lcommunity_cmd = { +	"large-community", +	route_set_lcommunity, +	route_set_lcommunity_compile,  	route_set_lcommunity_free,  }; @@ -2246,9 +2340,11 @@ static void route_set_lcommunity_delete_free(void *rule)  }  /* Set lcommunity rule structure. */ -struct route_map_rule_cmd route_set_lcommunity_delete_cmd = { -	"large-comm-list", route_set_lcommunity_delete, -	route_set_lcommunity_delete_compile, route_set_lcommunity_delete_free, +static const struct route_map_rule_cmd route_set_lcommunity_delete_cmd = { +	"large-comm-list", +	route_set_lcommunity_delete, +	route_set_lcommunity_delete_compile, +	route_set_lcommunity_delete_free,  }; @@ -2336,9 +2432,11 @@ static void route_set_community_delete_free(void *rule)  }  /* Set community rule structure. */ -struct route_map_rule_cmd route_set_community_delete_cmd = { -	"comm-list", route_set_community_delete, -	route_set_community_delete_compile, route_set_community_delete_free, +static const struct route_map_rule_cmd route_set_community_delete_cmd = { +	"comm-list", +	route_set_community_delete, +	route_set_community_delete_compile, +	route_set_community_delete_free,  };  /* `set extcommunity rt COMMUNITY' */ @@ -2403,9 +2501,11 @@ static void route_set_ecommunity_free(void *rule)  }  /* Set community rule structure. */ -struct route_map_rule_cmd route_set_ecommunity_rt_cmd = { -	"extcommunity rt", route_set_ecommunity, -	route_set_ecommunity_rt_compile, route_set_ecommunity_free, +static const struct route_map_rule_cmd route_set_ecommunity_rt_cmd = { +	"extcommunity rt", +	route_set_ecommunity, +	route_set_ecommunity_rt_compile, +	route_set_ecommunity_free,  };  /* `set extcommunity soo COMMUNITY' */ @@ -2423,9 +2523,11 @@ static void *route_set_ecommunity_soo_compile(const char *arg)  }  /* Set community rule structure. */ -struct route_map_rule_cmd route_set_ecommunity_soo_cmd = { -	"extcommunity soo", route_set_ecommunity, -	route_set_ecommunity_soo_compile, route_set_ecommunity_free, +static const struct route_map_rule_cmd route_set_ecommunity_soo_cmd = { +	"extcommunity soo", +	route_set_ecommunity, +	route_set_ecommunity_soo_compile, +	route_set_ecommunity_free,  };  /* `set origin ORIGIN' */ @@ -2472,8 +2574,10 @@ static void route_set_origin_free(void *rule)  }  /* Set origin rule structure. */ -struct route_map_rule_cmd route_set_origin_cmd = { -	"origin", route_set_origin, route_set_origin_compile, +static const struct route_map_rule_cmd route_set_origin_cmd = { +	"origin", +	route_set_origin, +	route_set_origin_compile,  	route_set_origin_free,  }; @@ -2507,9 +2611,11 @@ static void route_set_atomic_aggregate_free(void *rule)  }  /* Set atomic aggregate rule structure. */ -struct route_map_rule_cmd route_set_atomic_aggregate_cmd = { -	"atomic-aggregate", route_set_atomic_aggregate, -	route_set_atomic_aggregate_compile, route_set_atomic_aggregate_free, +static const struct route_map_rule_cmd route_set_atomic_aggregate_cmd = { +	"atomic-aggregate", +	route_set_atomic_aggregate, +	route_set_atomic_aggregate_compile, +	route_set_atomic_aggregate_free,  };  /* `set aggregator as AS A.B.C.D' */ @@ -2565,9 +2671,11 @@ static void route_set_aggregator_as_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_set_aggregator_as_cmd = { -	"aggregator as", route_set_aggregator_as, -	route_set_aggregator_as_compile, route_set_aggregator_as_free, +static const struct route_map_rule_cmd route_set_aggregator_as_cmd = { +	"aggregator as", +	route_set_aggregator_as, +	route_set_aggregator_as_compile, +	route_set_aggregator_as_free,  };  /* Set tag to object. object must be pointer to struct bgp_path_info */ @@ -2590,8 +2698,10 @@ route_set_tag(void *rule, const struct prefix *prefix,  }  /* Route map commands for tag set. */ -static struct route_map_rule_cmd route_set_tag_cmd = { -	"tag", route_set_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_set_tag_cmd = { +	"tag", +	route_set_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -2621,8 +2731,10 @@ route_set_label_index(void *rule, const struct prefix *prefix,  }  /* Route map commands for label-index set. */ -static struct route_map_rule_cmd route_set_label_index_cmd = { -	"label-index", route_set_label_index, route_value_compile, +static const struct route_map_rule_cmd route_set_label_index_cmd = { +	"label-index", +	route_set_label_index, +	route_value_compile,  	route_value_free,  }; @@ -2657,9 +2769,12 @@ static void route_match_ipv6_address_free(void *rule)  }  /* Route map commands for ip address matching. */ -struct route_map_rule_cmd route_match_ipv6_address_cmd = { -	"ipv6 address", route_match_ipv6_address, -	route_match_ipv6_address_compile, route_match_ipv6_address_free}; +static const struct route_map_rule_cmd route_match_ipv6_address_cmd = { +	"ipv6 address", +	route_match_ipv6_address, +	route_match_ipv6_address_compile, +	route_match_ipv6_address_free +};  /* `match ipv6 next-hop IP_ADDRESS' */ @@ -2708,9 +2823,12 @@ static void route_match_ipv6_next_hop_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ipv6_next_hop_cmd = { -	"ipv6 next-hop", route_match_ipv6_next_hop, -	route_match_ipv6_next_hop_compile, route_match_ipv6_next_hop_free}; +static const struct route_map_rule_cmd route_match_ipv6_next_hop_cmd = { +	"ipv6 next-hop", +	route_match_ipv6_next_hop, +	route_match_ipv6_next_hop_compile, +	route_match_ipv6_next_hop_free +};  /* `match ipv6 address prefix-list PREFIX_LIST' */ @@ -2732,10 +2850,13 @@ static void route_match_ipv6_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ipv6_address_prefix_list_cmd = { -	"ipv6 address prefix-list", route_match_ipv6_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ipv6_address_prefix_list_cmd = { +	"ipv6 address prefix-list", +	route_match_ipv6_address_prefix_list,  	route_match_ipv6_address_prefix_list_compile, -	route_match_ipv6_address_prefix_list_free}; +	route_match_ipv6_address_prefix_list_free +};  /* `match ipv6 next-hop type <TYPE>' */ @@ -2779,10 +2900,13 @@ static void route_match_ipv6_next_hop_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ipv6_next_hop_type_cmd = { -	"ipv6 next-hop type", route_match_ipv6_next_hop_type, +static const struct route_map_rule_cmd +		route_match_ipv6_next_hop_type_cmd = { +	"ipv6 next-hop type", +	route_match_ipv6_next_hop_type,  	route_match_ipv6_next_hop_type_compile, -	route_match_ipv6_next_hop_type_free}; +	route_match_ipv6_next_hop_type_free +};  /* `set ipv6 nexthop global IP_ADDRESS' */ @@ -2839,10 +2963,13 @@ static void route_set_ipv6_nexthop_global_free(void *rule)  }  /* Route map commands for ip nexthop set. */ -struct route_map_rule_cmd route_set_ipv6_nexthop_global_cmd = { -	"ipv6 next-hop global", route_set_ipv6_nexthop_global, +static const struct route_map_rule_cmd +		route_set_ipv6_nexthop_global_cmd = { +	"ipv6 next-hop global", +	route_set_ipv6_nexthop_global,  	route_set_ipv6_nexthop_global_compile, -	route_set_ipv6_nexthop_global_free}; +	route_set_ipv6_nexthop_global_free +};  /* Set next-hop preference value. */  static enum route_map_cmd_result_t @@ -2889,10 +3016,13 @@ static void route_set_ipv6_nexthop_prefer_global_free(void *rule)  }  /* Route map commands for ip nexthop set preferred. */ -struct route_map_rule_cmd route_set_ipv6_nexthop_prefer_global_cmd = { -	"ipv6 next-hop prefer-global", route_set_ipv6_nexthop_prefer_global, +static const struct route_map_rule_cmd +		route_set_ipv6_nexthop_prefer_global_cmd = { +	"ipv6 next-hop prefer-global", +	route_set_ipv6_nexthop_prefer_global,  	route_set_ipv6_nexthop_prefer_global_compile, -	route_set_ipv6_nexthop_prefer_global_free}; +	route_set_ipv6_nexthop_prefer_global_free +};  /* `set ipv6 nexthop local IP_ADDRESS' */ @@ -2951,10 +3081,13 @@ static void route_set_ipv6_nexthop_local_free(void *rule)  }  /* Route map commands for ip nexthop set. */ -struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = { -	"ipv6 next-hop local", route_set_ipv6_nexthop_local, +static const struct route_map_rule_cmd +		route_set_ipv6_nexthop_local_cmd = { +	"ipv6 next-hop local", +	route_set_ipv6_nexthop_local,  	route_set_ipv6_nexthop_local_compile, -	route_set_ipv6_nexthop_local_free}; +	route_set_ipv6_nexthop_local_free +};  /* `set ipv6 nexthop peer-address' */ @@ -3033,9 +3166,12 @@ static void route_set_ipv6_nexthop_peer_free(void *rule)  }  /* Route map commands for ip nexthop set. */ -struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd = { -	"ipv6 next-hop peer-address", route_set_ipv6_nexthop_peer, -	route_set_ipv6_nexthop_peer_compile, route_set_ipv6_nexthop_peer_free}; +static const struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd = { +	"ipv6 next-hop peer-address", +	route_set_ipv6_nexthop_peer, +	route_set_ipv6_nexthop_peer_compile, +	route_set_ipv6_nexthop_peer_free +};  /* `set ipv4 vpn next-hop A.B.C.D' */ @@ -3121,14 +3257,20 @@ static void route_set_vpn_nexthop_free(void *rule)  }  /* Route map commands for ipv4 next-hop set. */ -struct route_map_rule_cmd route_set_vpnv4_nexthop_cmd = { -	"ipv4 vpn next-hop", route_set_vpnv4_nexthop, -	route_set_vpnv4_nexthop_compile, route_set_vpn_nexthop_free}; +static const struct route_map_rule_cmd route_set_vpnv4_nexthop_cmd = { +	"ipv4 vpn next-hop", +	route_set_vpnv4_nexthop, +	route_set_vpnv4_nexthop_compile, +	route_set_vpn_nexthop_free +};  /* Route map commands for ipv6 next-hop set. */ -struct route_map_rule_cmd route_set_vpnv6_nexthop_cmd = { -	"ipv6 vpn next-hop", route_set_vpnv6_nexthop, -	route_set_vpnv6_nexthop_compile, route_set_vpn_nexthop_free}; +static const struct route_map_rule_cmd route_set_vpnv6_nexthop_cmd = { +	"ipv6 vpn next-hop", +	route_set_vpnv6_nexthop, +	route_set_vpnv6_nexthop_compile, +	route_set_vpn_nexthop_free +};  /* `set originator-id' */ @@ -3176,9 +3318,11 @@ static void route_set_originator_id_free(void *rule)  }  /* Set originator-id rule structure. */ -struct route_map_rule_cmd route_set_originator_id_cmd = { -	"originator-id", route_set_originator_id, -	route_set_originator_id_compile, route_set_originator_id_free, +static const struct route_map_rule_cmd route_set_originator_id_cmd = { +	"originator-id", +	route_set_originator_id, +	route_set_originator_id_compile, +	route_set_originator_id_free,  };  /* Add bgp route map rule. */ diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 3b89e50ce4..7247210c93 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -143,7 +143,7 @@ static int rpki_sync_socket_rtr;  static int rpki_sync_socket_bgpd;  static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1}; -static struct route_map_rule_cmd route_match_rpki_cmd = { +static const struct route_map_rule_cmd route_match_rpki_cmd = {  	"rpki", route_match, route_match_compile, route_match_free};  static void *malloc_wrapper(size_t size) diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c index e7a7cc56aa..df7b9c94ee 100644 --- a/eigrpd/eigrp_routemap.c +++ b/eigrpd/eigrp_routemap.c @@ -319,9 +319,12 @@ static void route_match_metric_free(void *rule)  }  /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_metric_cmd = { -	"metric", route_match_metric, route_match_metric_compile, -	route_match_metric_free}; +static const struct route_map_rule_cmd route_match_metric_cmd = { +	"metric", +	route_match_metric, +	route_match_metric_compile, +	route_match_metric_free +};  /* `match interface IFNAME' */  /* Match function return 1 if match is success else return zero. */ @@ -366,9 +369,12 @@ static void route_match_interface_free(void *rule)  }  /* Route map commands for interface matching. */ -struct route_map_rule_cmd route_match_interface_cmd = { -	"interface", route_match_interface, route_match_interface_compile, -	route_match_interface_free}; +static const struct route_map_rule_cmd route_match_interface_cmd = { +	"interface", +	route_match_interface, +	route_match_interface_compile, +	route_match_interface_free +};  /* `match ip next-hop IP_ACCESS_LIST' */ @@ -413,9 +419,12 @@ static void route_match_ip_next_hop_free(void *rule)  }  /* Route map commands for ip next-hop matching. */ -static struct route_map_rule_cmd route_match_ip_next_hop_cmd = { -	"ip next-hop", route_match_ip_next_hop, route_match_ip_next_hop_compile, -	route_match_ip_next_hop_free}; +static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { +	"ip next-hop", +	route_match_ip_next_hop, +	route_match_ip_next_hop_compile, +	route_match_ip_next_hop_free +};  /* `match ip next-hop prefix-list PREFIX_LIST' */ @@ -455,10 +464,13 @@ static void route_match_ip_next_hop_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = { -	"ip next-hop prefix-list", route_match_ip_next_hop_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_prefix_list_cmd = { +	"ip next-hop prefix-list", +	route_match_ip_next_hop_prefix_list,  	route_match_ip_next_hop_prefix_list_compile, -	route_match_ip_next_hop_prefix_list_free}; +	route_match_ip_next_hop_prefix_list_free +};  /* `match ip address IP_ACCESS_LIST' */ @@ -496,9 +508,12 @@ static void route_match_ip_address_free(void *rule)  }  /* Route map commands for ip address matching. */ -static struct route_map_rule_cmd route_match_ip_address_cmd = { -	"ip address", route_match_ip_address, route_match_ip_address_compile, -	route_match_ip_address_free}; +static const struct route_map_rule_cmd route_match_ip_address_cmd = { +	"ip address", +	route_match_ip_address, +	route_match_ip_address_compile, +	route_match_ip_address_free +};  /* `match ip address prefix-list PREFIX_LIST' */ @@ -530,10 +545,13 @@ static void route_match_ip_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { -	"ip address prefix-list", route_match_ip_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_list_cmd = { +	"ip address prefix-list", +	route_match_ip_address_prefix_list,  	route_match_ip_address_prefix_list_compile, -	route_match_ip_address_prefix_list_free}; +	route_match_ip_address_prefix_list_free +};  /* `match tag TAG' */  /* Match function return 1 if match is success else return zero. */ @@ -576,8 +594,12 @@ static void route_match_tag_free(void *rule)  }  /* Route map commands for tag matching. */ -struct route_map_rule_cmd route_match_tag_cmd = { -	"tag", route_match_tag, route_match_tag_compile, route_match_tag_free}; +static const struct route_map_rule_cmd route_match_tag_cmd = { +	"tag", +	route_match_tag, +	route_match_tag_compile, +	route_match_tag_free +};  /* Set metric to attribute. */  static enum route_map_cmd_result_t @@ -666,8 +688,10 @@ static void route_set_metric_free(void *rule)  }  /* Set metric rule structure. */ -static struct route_map_rule_cmd route_set_metric_cmd = { -	"metric", route_set_metric, route_set_metric_compile, +static const struct route_map_rule_cmd route_set_metric_cmd = { +	"metric", +	route_set_metric, +	route_set_metric_compile,  	route_set_metric_free,  }; @@ -722,9 +746,12 @@ static void route_set_ip_nexthop_free(void *rule)  }  /* Route map commands for ip nexthop set. */ -static struct route_map_rule_cmd route_set_ip_nexthop_cmd = { -	"ip next-hop", route_set_ip_nexthop, route_set_ip_nexthop_compile, -	route_set_ip_nexthop_free}; +static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = { +	"ip next-hop", +	route_set_ip_nexthop, +	route_set_ip_nexthop_compile, +	route_set_ip_nexthop_free +};  /* `set tag TAG' */ @@ -768,8 +795,12 @@ static void route_set_tag_free(void *rule)  }  /* Route map commands for tag set. */ -static struct route_map_rule_cmd route_set_tag_cmd = { -	"tag", route_set_tag, route_set_tag_compile, route_set_tag_free}; +static const struct route_map_rule_cmd route_set_tag_cmd = { +	"tag", +	route_set_tag, +	route_set_tag_compile, +	route_set_tag_free +};  #define MATCH_STR "Match values from routing table\n"  #define SET_STR "Set values in destination routing protocol\n" diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index eb9b661d37..902528e1bb 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -74,9 +74,12 @@ static void route_match_ip_address_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_address_cmd = { -	"ip address", route_match_ip_address, route_match_ip_address_compile, -	route_match_ip_address_free}; +static const struct route_map_rule_cmd route_match_ip_address_cmd = { +	"ip address", +	route_match_ip_address, +	route_match_ip_address_compile, +	route_match_ip_address_free +};  /* ------------------------------------------------------------*/ @@ -106,10 +109,13 @@ static void route_match_ip_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { -	"ip address prefix-list", route_match_ip_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_list_cmd = { +	"ip address prefix-list", +	route_match_ip_address_prefix_list,  	route_match_ip_address_prefix_list_compile, -	route_match_ip_address_prefix_list_free}; +	route_match_ip_address_prefix_list_free +};  /* ------------------------------------------------------------*/ @@ -139,9 +145,12 @@ static void route_match_ipv6_address_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ipv6_address_cmd = { -	"ipv6 address", route_match_ipv6_address, -	route_match_ipv6_address_compile, route_match_ipv6_address_free}; +static const struct route_map_rule_cmd route_match_ipv6_address_cmd = { +	"ipv6 address", +	route_match_ipv6_address, +	route_match_ipv6_address_compile, +	route_match_ipv6_address_free +};  /* ------------------------------------------------------------*/ @@ -171,10 +180,13 @@ static void route_match_ipv6_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ipv6_address_prefix_list_cmd = { -	"ipv6 address prefix-list", route_match_ipv6_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ipv6_address_prefix_list_cmd = { +	"ipv6 address prefix-list", +	route_match_ipv6_address_prefix_list,  	route_match_ipv6_address_prefix_list_compile, -	route_match_ipv6_address_prefix_list_free}; +	route_match_ipv6_address_prefix_list_free +};  /* ------------------------------------------------------------*/ @@ -215,9 +227,12 @@ static void route_set_metric_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_set_metric_cmd = { -	"metric", route_set_metric, route_set_metric_compile, -	route_set_metric_free}; +static const struct route_map_rule_cmd route_set_metric_cmd = { +	"metric", +	route_set_metric, +	route_set_metric_compile, +	route_set_metric_free +};  void isis_route_map_init(void)  { diff --git a/lib/routemap.c b/lib/routemap.c index 580d898448..c0e01488b2 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -598,7 +598,7 @@ int generic_set_delete(struct vty *vty, struct route_map_index *index,  /* Route map rule. This rule has both `match' rule and `set' rule. */  struct route_map_rule {  	/* Rule type. */ -	struct route_map_rule_cmd *cmd; +	const struct route_map_rule_cmd *cmd;  	/* For pretty printing. */  	char *rule_str; @@ -1228,22 +1228,22 @@ static struct route_map_rule *route_map_rule_new(void)  }  /* Install rule command to the match list. */ -void route_map_install_match(struct route_map_rule_cmd *cmd) +void route_map_install_match(const struct route_map_rule_cmd *cmd)  { -	vector_set(route_match_vec, cmd); +	vector_set(route_match_vec, (void *)cmd);  }  /* Install rule command to the set list. */ -void route_map_install_set(struct route_map_rule_cmd *cmd) +void route_map_install_set(const struct route_map_rule_cmd *cmd)  { -	vector_set(route_set_vec, cmd); +	vector_set(route_set_vec, (void *)cmd);  }  /* Lookup rule command from match list. */ -static struct route_map_rule_cmd *route_map_lookup_match(const char *name) +static const struct route_map_rule_cmd *route_map_lookup_match(const char *name)  {  	unsigned int i; -	struct route_map_rule_cmd *rule; +	const struct route_map_rule_cmd *rule;  	for (i = 0; i < vector_active(route_match_vec); i++)  		if ((rule = vector_slot(route_match_vec, i)) != NULL) @@ -1253,10 +1253,10 @@ static struct route_map_rule_cmd *route_map_lookup_match(const char *name)  }  /* Lookup rule command from set list. */ -static struct route_map_rule_cmd *route_map_lookup_set(const char *name) +static const struct route_map_rule_cmd *route_map_lookup_set(const char *name)  {  	unsigned int i; -	struct route_map_rule_cmd *rule; +	const struct route_map_rule_cmd *rule;  	for (i = 0; i < vector_active(route_set_vec); i++)  		if ((rule = vector_slot(route_set_vec, i)) != NULL) @@ -1324,7 +1324,7 @@ const char *route_map_get_match_arg(struct route_map_index *index,  				    const char *match_name)  {  	struct route_map_rule *rule; -	struct route_map_rule_cmd *cmd; +	const struct route_map_rule_cmd *cmd;  	/* First lookup rule for add match statement. */  	cmd = route_map_lookup_match(match_name); @@ -1396,7 +1396,7 @@ enum rmap_compile_rets route_map_add_match(struct route_map_index *index,  {  	struct route_map_rule *rule;  	struct route_map_rule *next; -	struct route_map_rule_cmd *cmd; +	const struct route_map_rule_cmd *cmd;  	void *compile;  	int8_t delete_rmap_event_type = 0;  	const char *rule_key; @@ -1482,7 +1482,7 @@ enum rmap_compile_rets route_map_delete_match(struct route_map_index *index,  					      route_map_event_t type)  {  	struct route_map_rule *rule; -	struct route_map_rule_cmd *cmd; +	const struct route_map_rule_cmd *cmd;  	const char *rule_key;  	cmd = route_map_lookup_match(match_name); @@ -1523,7 +1523,7 @@ enum rmap_compile_rets route_map_add_set(struct route_map_index *index,  {  	struct route_map_rule *rule;  	struct route_map_rule *next; -	struct route_map_rule_cmd *cmd; +	const struct route_map_rule_cmd *cmd;  	void *compile;  	cmd = route_map_lookup_set(set_name); @@ -1574,7 +1574,7 @@ enum rmap_compile_rets route_map_delete_set(struct route_map_index *index,  					    const char *set_arg)  {  	struct route_map_rule *rule; -	struct route_map_rule_cmd *cmd; +	const struct route_map_rule_cmd *cmd;  	cmd = route_map_lookup_set(set_name);  	if (cmd == NULL) diff --git a/lib/routemap.h b/lib/routemap.h index e6eccd4b29..1ffd0525ae 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -246,7 +246,7 @@ route_map_delete_set(struct route_map_index *index,  		     const char *set_name, const char *set_arg);  /* Install rule command to the match list. */ -extern void route_map_install_match(struct route_map_rule_cmd *cmd); +extern void route_map_install_match(const struct route_map_rule_cmd *cmd);  /*   * Install rule command to the set list. @@ -257,7 +257,7 @@ extern void route_map_install_match(struct route_map_rule_cmd *cmd);   * in the apply command).  See 'set metric' command   * as it is handled in ripd/ripngd and ospfd.   */ -extern void route_map_install_set(struct route_map_rule_cmd *cmd); +extern void route_map_install_set(const struct route_map_rule_cmd *cmd);  /* Lookup route map by name. */  extern struct route_map *route_map_lookup_by_name(const char *name); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 7914412e87..facb6aa63f 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1385,7 +1385,8 @@ static void ospf6_routemap_rule_match_address_prefixlist_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd ospf6_routemap_rule_match_address_prefixlist_cmd = { +static const struct route_map_rule_cmd +		ospf6_routemap_rule_match_address_prefixlist_cmd = {  	"ipv6 address prefix-list",  	ospf6_routemap_rule_match_address_prefixlist,  	ospf6_routemap_rule_match_address_prefixlist_compile, @@ -1427,10 +1428,13 @@ static void ospf6_routemap_rule_match_interface_free(void *rule)  }  /* Route map commands for interface matching. */ -struct route_map_rule_cmd ospf6_routemap_rule_match_interface_cmd = { -	"interface", ospf6_routemap_rule_match_interface, +static const struct route_map_rule_cmd +		ospf6_routemap_rule_match_interface_cmd = { +	"interface", +	ospf6_routemap_rule_match_interface,  	ospf6_routemap_rule_match_interface_compile, -	ospf6_routemap_rule_match_interface_free}; +	ospf6_routemap_rule_match_interface_free +};  /* Match function for matching route tags */  static enum route_map_cmd_result_t @@ -1447,8 +1451,11 @@ ospf6_routemap_rule_match_tag(void *rule, const struct prefix *p,  	return RMAP_NOMATCH;  } -static struct route_map_rule_cmd ospf6_routemap_rule_match_tag_cmd = { -	"tag", ospf6_routemap_rule_match_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd +		ospf6_routemap_rule_match_tag_cmd = { +	"tag", +	ospf6_routemap_rule_match_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -1482,8 +1489,10 @@ static void ospf6_routemap_rule_set_metric_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd ospf6_routemap_rule_set_metric_type_cmd = { -	"metric-type", ospf6_routemap_rule_set_metric_type, +static const struct route_map_rule_cmd +		ospf6_routemap_rule_set_metric_type_cmd = { +	"metric-type", +	ospf6_routemap_rule_set_metric_type,  	ospf6_routemap_rule_set_metric_type_compile,  	ospf6_routemap_rule_set_metric_type_free,  }; @@ -1517,8 +1526,10 @@ static void ospf6_routemap_rule_set_metric_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd ospf6_routemap_rule_set_metric_cmd = { -	"metric", ospf6_routemap_rule_set_metric, +static const struct route_map_rule_cmd +		ospf6_routemap_rule_set_metric_cmd = { +	"metric", +	ospf6_routemap_rule_set_metric,  	ospf6_routemap_rule_set_metric_compile,  	ospf6_routemap_rule_set_metric_free,  }; @@ -1555,8 +1566,10 @@ static void ospf6_routemap_rule_set_forwarding_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd ospf6_routemap_rule_set_forwarding_cmd = { -	"forwarding-address", ospf6_routemap_rule_set_forwarding, +static const struct route_map_rule_cmd +		ospf6_routemap_rule_set_forwarding_cmd = { +	"forwarding-address", +	ospf6_routemap_rule_set_forwarding,  	ospf6_routemap_rule_set_forwarding_compile,  	ospf6_routemap_rule_set_forwarding_free,  }; @@ -1576,8 +1589,11 @@ ospf6_routemap_rule_set_tag(void *rule, const struct prefix *p,  	return RMAP_OKAY;  } -static struct route_map_rule_cmd ospf6_routemap_rule_set_tag_cmd = { -	"tag", ospf6_routemap_rule_set_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd +		ospf6_routemap_rule_set_tag_cmd = { +	"tag", +	ospf6_routemap_rule_set_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -1842,7 +1858,7 @@ DEFUN (show_ipv6_ospf6_redistribute,  	return CMD_SUCCESS;  } -struct ospf6_lsa_handler as_external_handler = { +static const struct ospf6_lsa_handler as_external_handler = {  	.lh_type = OSPF6_LSTYPE_AS_EXTERNAL,  	.lh_name = "AS-External",  	.lh_short_name = "ASE", diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 1669c817e6..c89fd3597f 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -164,9 +164,12 @@ static void route_match_ip_nexthop_free(void *rule)  }  /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_ip_nexthop_cmd = { -	"ip next-hop", route_match_ip_nexthop, route_match_ip_nexthop_compile, -	route_match_ip_nexthop_free}; +static const struct route_map_rule_cmd route_match_ip_nexthop_cmd = { +	"ip next-hop", +	route_match_ip_nexthop, +	route_match_ip_nexthop_compile, +	route_match_ip_nexthop_free +};  /* `match ip next-hop prefix-list PREFIX_LIST' */ @@ -204,10 +207,13 @@ static void route_match_ip_next_hop_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = { -	"ip next-hop prefix-list", route_match_ip_next_hop_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_prefix_list_cmd = { +	"ip next-hop prefix-list", +	route_match_ip_next_hop_prefix_list,  	route_match_ip_next_hop_prefix_list_compile, -	route_match_ip_next_hop_prefix_list_free}; +	route_match_ip_next_hop_prefix_list_free +};  /* `match ip next-hop type <blackhole>' */ @@ -238,10 +244,13 @@ static void route_match_ip_next_hop_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = { -	"ip next-hop type", route_match_ip_next_hop_type, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_type_cmd = { +	"ip next-hop type", +	route_match_ip_next_hop_type,  	route_match_ip_next_hop_type_compile, -	route_match_ip_next_hop_type_free}; +	route_match_ip_next_hop_type_free +};  /* `match ip address IP_ACCESS_LIST' */  /* Match function should return 1 if match is success else return @@ -279,9 +288,12 @@ static void route_match_ip_address_free(void *rule)  }  /* Route map commands for ip address matching. */ -struct route_map_rule_cmd route_match_ip_address_cmd = { -	"ip address", route_match_ip_address, route_match_ip_address_compile, -	route_match_ip_address_free}; +static const struct route_map_rule_cmd route_match_ip_address_cmd = { +	"ip address", +	route_match_ip_address, +	route_match_ip_address_compile, +	route_match_ip_address_free +};  /* `match ip address prefix-list PREFIX_LIST' */  static enum route_map_cmd_result_t @@ -312,10 +324,13 @@ static void route_match_ip_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { -	"ip address prefix-list", route_match_ip_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_list_cmd = { +	"ip address prefix-list", +	route_match_ip_address_prefix_list,  	route_match_ip_address_prefix_list_compile, -	route_match_ip_address_prefix_list_free}; +	route_match_ip_address_prefix_list_free +};  /* `match interface IFNAME' */  /* Match function should return 1 if match is success else return @@ -353,9 +368,12 @@ static void route_match_interface_free(void *rule)  }  /* Route map commands for ip address matching. */ -struct route_map_rule_cmd route_match_interface_cmd = { -	"interface", route_match_interface, route_match_interface_compile, -	route_match_interface_free}; +static const struct route_map_rule_cmd route_match_interface_cmd = { +	"interface", +	route_match_interface, +	route_match_interface_compile, +	route_match_interface_free +};  /* Match function return 1 if match is success else return zero. */  static enum route_map_cmd_result_t @@ -376,8 +394,10 @@ route_match_tag(void *rule, const struct prefix *prefix,  }  /* Route map commands for tag matching. */ -static struct route_map_rule_cmd route_match_tag_cmd = { -	"tag", route_match_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_match_tag_cmd = { +	"tag", +	route_match_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -462,8 +482,10 @@ static void route_set_metric_free(void *rule)  }  /* Set metric rule structure. */ -struct route_map_rule_cmd route_set_metric_cmd = { -	"metric", route_set_metric, route_set_metric_compile, +static const struct route_map_rule_cmd route_set_metric_cmd = { +	"metric", +	route_set_metric, +	route_set_metric_compile,  	route_set_metric_free,  }; @@ -513,8 +535,10 @@ static void route_set_metric_type_free(void *rule)  }  /* Set metric rule structure. */ -struct route_map_rule_cmd route_set_metric_type_cmd = { -	"metric-type", route_set_metric_type, route_set_metric_type_compile, +static const struct route_map_rule_cmd route_set_metric_type_cmd = { +	"metric-type", +	route_set_metric_type, +	route_set_metric_type_compile,  	route_set_metric_type_free,  }; @@ -537,8 +561,10 @@ route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,  }  /* Route map commands for tag set. */ -static struct route_map_rule_cmd route_set_tag_cmd = { -	"tag", route_set_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_set_tag_cmd = { +	"tag", +	route_set_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index 459188fefd..4e848766d6 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -88,9 +88,12 @@ static void route_match_metric_free(void *rule)  }  /* Route map commands for metric matching. */ -struct route_map_rule_cmd route_match_metric_cmd = { -	"metric", route_match_metric, route_match_metric_compile, -	route_match_metric_free}; +static const struct route_map_rule_cmd route_match_metric_cmd = { +	"metric", +	route_match_metric, +	route_match_metric_compile, +	route_match_metric_free +};  /* `match interface IFNAME' */  /* Match function return 1 if match is success else return zero. */ @@ -134,9 +137,12 @@ static void route_match_interface_free(void *rule)  }  /* Route map commands for interface matching. */ -struct route_map_rule_cmd route_match_interface_cmd = { -	"interface", route_match_interface, route_match_interface_compile, -	route_match_interface_free}; +static const struct route_map_rule_cmd route_match_interface_cmd = { +	"interface", +	route_match_interface, +	route_match_interface_compile, +	route_match_interface_free +};  /* `match ip next-hop IP_ACCESS_LIST' */ @@ -181,9 +187,12 @@ static void route_match_ip_next_hop_free(void *rule)  }  /* Route map commands for ip next-hop matching. */ -static struct route_map_rule_cmd route_match_ip_next_hop_cmd = { -	"ip next-hop", route_match_ip_next_hop, route_match_ip_next_hop_compile, -	route_match_ip_next_hop_free}; +static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { +	"ip next-hop", +	route_match_ip_next_hop, +	route_match_ip_next_hop_compile, +	route_match_ip_next_hop_free +};  /* `match ip next-hop prefix-list PREFIX_LIST' */ @@ -223,10 +232,13 @@ static void route_match_ip_next_hop_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = { -	"ip next-hop prefix-list", route_match_ip_next_hop_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_prefix_list_cmd = { +	"ip next-hop prefix-list", +	route_match_ip_next_hop_prefix_list,  	route_match_ip_next_hop_prefix_list_compile, -	route_match_ip_next_hop_prefix_list_free}; +	route_match_ip_next_hop_prefix_list_free +};  /* `match ip next-hop type <blackhole>' */ @@ -257,10 +269,13 @@ static void route_match_ip_next_hop_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = { -	"ip next-hop type", route_match_ip_next_hop_type, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_type_cmd = { +	"ip next-hop type", +	route_match_ip_next_hop_type,  	route_match_ip_next_hop_type_compile, -	route_match_ip_next_hop_type_free}; +	route_match_ip_next_hop_type_free +};  /* `match ip address IP_ACCESS_LIST' */ @@ -298,9 +313,12 @@ static void route_match_ip_address_free(void *rule)  }  /* Route map commands for ip address matching. */ -static struct route_map_rule_cmd route_match_ip_address_cmd = { -	"ip address", route_match_ip_address, route_match_ip_address_compile, -	route_match_ip_address_free}; +static const struct route_map_rule_cmd route_match_ip_address_cmd = { +	"ip address", +	route_match_ip_address, +	route_match_ip_address_compile, +	route_match_ip_address_free +};  /* `match ip address prefix-list PREFIX_LIST' */ @@ -332,10 +350,13 @@ static void route_match_ip_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { -	"ip address prefix-list", route_match_ip_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_list_cmd = { +	"ip address prefix-list", +	route_match_ip_address_prefix_list,  	route_match_ip_address_prefix_list_compile, -	route_match_ip_address_prefix_list_free}; +	route_match_ip_address_prefix_list_free +};  /* `match tag TAG' */  /* Match function return 1 if match is success else return zero. */ @@ -362,8 +383,10 @@ route_match_tag(void *rule, const struct prefix *p, route_map_object_t type,  }  /* Route map commands for tag matching. */ -static struct route_map_rule_cmd route_match_tag_cmd = { -	"tag", route_match_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_match_tag_cmd = { +	"tag", +	route_match_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -460,8 +483,10 @@ static void route_set_metric_free(void *rule)  }  /* Set metric rule structure. */ -static struct route_map_rule_cmd route_set_metric_cmd = { -	"metric", route_set_metric, route_set_metric_compile, +static const struct route_map_rule_cmd route_set_metric_cmd = { +	"metric", +	route_set_metric, +	route_set_metric_compile,  	route_set_metric_free,  }; @@ -514,9 +539,12 @@ static void route_set_ip_nexthop_free(void *rule)  }  /* Route map commands for ip nexthop set. */ -static struct route_map_rule_cmd route_set_ip_nexthop_cmd = { -	"ip next-hop", route_set_ip_nexthop, route_set_ip_nexthop_compile, -	route_set_ip_nexthop_free}; +static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = { +	"ip next-hop", +	route_set_ip_nexthop, +	route_set_ip_nexthop_compile, +	route_set_ip_nexthop_free +};  /* `set tag TAG' */ @@ -541,9 +569,12 @@ route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,  }  /* Route map commands for tag set. */ -static struct route_map_rule_cmd route_set_tag_cmd = { -	"tag", route_set_tag, route_map_rule_tag_compile, -	route_map_rule_tag_free}; +static const struct route_map_rule_cmd route_set_tag_cmd = { +	"tag", +	route_set_tag, +	route_map_rule_tag_compile, +	route_map_rule_tag_free +};  #define MATCH_STR "Match values from routing table\n"  #define SET_STR "Set values in destination routing protocol\n" diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index d27ec76a56..6123591429 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -79,9 +79,12 @@ static void route_match_metric_free(void *rule)  }  /* Route map commands for metric matching. */ -static struct route_map_rule_cmd route_match_metric_cmd = { -	"metric", route_match_metric, route_match_metric_compile, -	route_match_metric_free}; +static const struct route_map_rule_cmd route_match_metric_cmd = { +	"metric", +	route_match_metric, +	route_match_metric_compile, +	route_match_metric_free +};  /* `match interface IFNAME' */  /* Match function return 1 if match is success else return zero. */ @@ -121,9 +124,12 @@ static void route_match_interface_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_interface_cmd = { -	"interface", route_match_interface, route_match_interface_compile, -	route_match_interface_free}; +static const struct route_map_rule_cmd route_match_interface_cmd = { +	"interface", +	route_match_interface, +	route_match_interface_compile, +	route_match_interface_free +};  /* `match tag TAG' */  /* Match function return 1 if match is success else return zero. */ @@ -150,8 +156,10 @@ static enum route_map_cmd_result_t route_match_tag(void *rule,  	return RMAP_NOMATCH;  } -static struct route_map_rule_cmd route_match_tag_cmd = { -	"tag", route_match_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_match_tag_cmd = { +	"tag", +	route_match_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -246,8 +254,10 @@ static void route_set_metric_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_set_metric_cmd = { -	"metric", route_set_metric, route_set_metric_compile, +static const struct route_map_rule_cmd route_set_metric_cmd = { +	"metric", +	route_set_metric, +	route_set_metric_compile,  	route_set_metric_free,  }; @@ -299,10 +309,13 @@ static void route_set_ipv6_nexthop_local_free(void *rule)  }  /* Route map commands for ipv6 nexthop local set. */ -static struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd = { -	"ipv6 next-hop local", route_set_ipv6_nexthop_local, +static const struct route_map_rule_cmd +		route_set_ipv6_nexthop_local_cmd = { +	"ipv6 next-hop local", +	route_set_ipv6_nexthop_local,  	route_set_ipv6_nexthop_local_compile, -	route_set_ipv6_nexthop_local_free}; +	route_set_ipv6_nexthop_local_free +};  /* `set tag TAG' */ @@ -327,9 +340,12 @@ route_set_tag(void *rule, const struct prefix *prefix, route_map_object_t type,  }  /* Route map commands for tag set. */ -static struct route_map_rule_cmd route_set_tag_cmd = { -	"tag", route_set_tag, route_map_rule_tag_compile, -	route_map_rule_tag_free}; +static const struct route_map_rule_cmd route_set_tag_cmd = { +	"tag", +	route_set_tag, +	route_map_rule_tag_compile, +	route_map_rule_tag_free +};  #define MATCH_STR "Match values from routing table\n"  #define SET_STR "Set values in destination routing protocol\n" diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 091f66f9eb..641fc8799c 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -155,8 +155,10 @@ route_match_tag(void *rule, const struct prefix *prefix,  }  /* Route map commands for tag matching */ -static struct route_map_rule_cmd route_match_tag_cmd = { -	"tag", route_match_tag, route_map_rule_tag_compile, +static const struct route_map_rule_cmd route_match_tag_cmd = { +	"tag", +	route_match_tag, +	route_map_rule_tag_compile,  	route_map_rule_tag_free,  }; @@ -310,9 +312,12 @@ static int show_nht_rm(struct vty *vty, int af_type, const char *vrf_all,  }  /* Route map commands for interface matching */ -struct route_map_rule_cmd route_match_interface_cmd = { -	"interface", route_match_interface, route_match_interface_compile, -	route_match_interface_free}; +static const struct route_map_rule_cmd route_match_interface_cmd = { +	"interface", +	route_match_interface, +	route_match_interface_compile, +	route_match_interface_free +};  static int ip_protocol_rm_add(struct zebra_vrf *zvrf, const char *rmap,  			      int rtype, afi_t afi, safi_t safi) @@ -1076,9 +1081,12 @@ static void route_match_ip_next_hop_free(void *rule)  }  /* Route map commands for ip next-hop matching. */ -static struct route_map_rule_cmd route_match_ip_next_hop_cmd = { -	"ip next-hop", route_match_ip_next_hop, route_match_ip_next_hop_compile, -	route_match_ip_next_hop_free}; +static const struct route_map_rule_cmd route_match_ip_next_hop_cmd = { +	"ip next-hop", +	route_match_ip_next_hop, +	route_match_ip_next_hop_compile, +	route_match_ip_next_hop_free +};  /* `match ip next-hop prefix-list PREFIX_LIST' */ @@ -1129,10 +1137,13 @@ static void route_match_ip_next_hop_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = { -	"ip next-hop prefix-list", route_match_ip_next_hop_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_prefix_list_cmd = { +	"ip next-hop prefix-list", +	route_match_ip_next_hop_prefix_list,  	route_match_ip_next_hop_prefix_list_compile, -	route_match_ip_next_hop_prefix_list_free}; +	route_match_ip_next_hop_prefix_list_free +};  /* `match ip address IP_ACCESS_LIST' */ @@ -1184,14 +1195,20 @@ static void route_match_address_free(void *rule)  }  /* Route map commands for ip address matching. */ -static struct route_map_rule_cmd route_match_ip_address_cmd = { -	"ip address", route_match_ip_address, route_match_address_compile, -	route_match_address_free}; +static const struct route_map_rule_cmd route_match_ip_address_cmd = { +	"ip address", +	route_match_ip_address, +	route_match_address_compile, +	route_match_address_free +};  /* Route map commands for ipv6 address matching. */ -static struct route_map_rule_cmd route_match_ipv6_address_cmd = { -	"ipv6 address", route_match_ipv6_address, route_match_address_compile, -	route_match_address_free}; +static const struct route_map_rule_cmd route_match_ipv6_address_cmd = { +	"ipv6 address", +	route_match_ipv6_address, +	route_match_address_compile, +	route_match_address_free +};  /* `match ip address prefix-list PREFIX_LIST' */ @@ -1231,10 +1248,13 @@ static void route_match_address_prefix_list_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_address_prefix_list_cmd = { -	"ip address prefix-list", route_match_ip_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_list_cmd = { +	"ip address prefix-list", +	route_match_ip_address_prefix_list,  	route_match_address_prefix_list_compile, -	route_match_address_prefix_list_free}; +	route_match_address_prefix_list_free +};  static enum route_map_cmd_result_t  route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix, @@ -1244,10 +1264,13 @@ route_match_ipv6_address_prefix_list(void *rule, const struct prefix *prefix,  						AFI_IP6));  } -static struct route_map_rule_cmd route_match_ipv6_address_prefix_list_cmd = { -	"ipv6 address prefix-list", route_match_ipv6_address_prefix_list, +static const struct route_map_rule_cmd +		route_match_ipv6_address_prefix_list_cmd = { +	"ipv6 address prefix-list", +	route_match_ipv6_address_prefix_list,  	route_match_address_prefix_list_compile, -	route_match_address_prefix_list_free}; +	route_match_address_prefix_list_free +};  /* `match ipv6 next-hop type <TYPE>' */ @@ -1278,10 +1301,13 @@ static void route_match_ipv6_next_hop_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -struct route_map_rule_cmd route_match_ipv6_next_hop_type_cmd = { -	"ipv6 next-hop type", route_match_ipv6_next_hop_type, +static const struct route_map_rule_cmd +		route_match_ipv6_next_hop_type_cmd = { +	"ipv6 next-hop type", +	route_match_ipv6_next_hop_type,  	route_match_ipv6_next_hop_type_compile, -	route_match_ipv6_next_hop_type_free}; +	route_match_ipv6_next_hop_type_free +};  /* `match ip address prefix-len PREFIXLEN' */ @@ -1324,15 +1350,21 @@ static void route_match_address_prefix_len_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_address_prefix_len_cmd = { -	"ip address prefix-len", route_match_address_prefix_len, +static const struct route_map_rule_cmd +		route_match_ip_address_prefix_len_cmd = { +	"ip address prefix-len", +	route_match_address_prefix_len,  	route_match_address_prefix_len_compile, -	route_match_address_prefix_len_free}; +	route_match_address_prefix_len_free +}; -static struct route_map_rule_cmd route_match_ipv6_address_prefix_len_cmd = { -	"ipv6 address prefix-len", route_match_address_prefix_len, +static const struct route_map_rule_cmd +		route_match_ipv6_address_prefix_len_cmd = { +	"ipv6 address prefix-len", +	route_match_address_prefix_len,  	route_match_address_prefix_len_compile, -	route_match_address_prefix_len_free}; +	route_match_address_prefix_len_free +};  /* `match ip nexthop prefix-len PREFIXLEN' */ @@ -1368,8 +1400,10 @@ route_match_ip_nexthop_prefix_len(void *rule, const struct prefix *prefix,  	return RMAP_NOMATCH;  } -static struct route_map_rule_cmd route_match_ip_nexthop_prefix_len_cmd = { -	"ip next-hop prefix-len", route_match_ip_nexthop_prefix_len, +static const struct route_map_rule_cmd +		route_match_ip_nexthop_prefix_len_cmd = { +	"ip next-hop prefix-len", +	route_match_ip_nexthop_prefix_len,  	route_match_address_prefix_len_compile, /* reuse */  	route_match_address_prefix_len_free     /* reuse */  }; @@ -1403,10 +1437,13 @@ static void route_match_ip_next_hop_type_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = { -	"ip next-hop type", route_match_ip_next_hop_type, +static const struct route_map_rule_cmd +		route_match_ip_next_hop_type_cmd = { +	"ip next-hop type", +	route_match_ip_next_hop_type,  	route_match_ip_next_hop_type_compile, -	route_match_ip_next_hop_type_free}; +	route_match_ip_next_hop_type_free +};  /* `match source-protocol PROTOCOL' */ @@ -1446,9 +1483,12 @@ static void route_match_source_protocol_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_source_protocol_cmd = { -	"source-protocol", route_match_source_protocol, -	route_match_source_protocol_compile, route_match_source_protocol_free}; +static const struct route_map_rule_cmd route_match_source_protocol_cmd = { +	"source-protocol", +	route_match_source_protocol, +	route_match_source_protocol_compile, +	route_match_source_protocol_free +};  /* `source-instance` */  static enum route_map_cmd_result_t @@ -1486,9 +1526,12 @@ static void route_match_source_instance_free(void *rule)  	XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);  } -static struct route_map_rule_cmd route_match_source_instance_cmd = { -	"source-instance", route_match_source_instance, -	route_match_source_instance_compile, route_match_source_instance_free}; +static const struct route_map_rule_cmd route_match_source_instance_cmd = { +	"source-instance", +	route_match_source_instance, +	route_match_source_instance_compile, +	route_match_source_instance_free +};  /* `set src A.B.C.D' */ @@ -1527,8 +1570,11 @@ static void route_set_src_free(void *rule)  }  /* Set src rule structure. */ -static struct route_map_rule_cmd route_set_src_cmd = { -	"src", route_set_src, route_set_src_compile, route_set_src_free, +static const struct route_map_rule_cmd route_set_src_cmd = { +	"src", +	route_set_src, +	route_set_src_compile, +	route_set_src_free,  };  /* The function checks if the changed routemap specified by parameter rmap  | 
