@@ -127,6 +127,70 @@ static const struct route_map_rule_cmd route_match_interface_cmd = {
127127 route_match_interface_free
128128};
129129
130+ /* match ipv6 address WORD */
131+
132+ static enum route_map_cmd_result_t
133+ route_match_ipv6_address (void * rule , const struct prefix * prefix , void * object )
134+ {
135+ struct access_list * alist ;
136+
137+ alist = access_list_lookup (AFI_IP6 , (char * )rule );
138+ if (access_list_apply (alist , prefix ) != FILTER_DENY )
139+ return RMAP_MATCH ;
140+
141+ return RMAP_NOMATCH ;
142+ }
143+
144+ static void * route_match_ipv6_address_compile (const char * arg )
145+ {
146+ return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED , arg );
147+ }
148+
149+ static void route_match_ipv6_address_free (void * rule )
150+ {
151+ XFREE (MTYPE_ROUTE_MAP_COMPILED , rule );
152+ }
153+
154+ static const struct route_map_rule_cmd route_match_ipv6_address_cmd = {
155+ "ipv6 address" ,
156+ route_match_ipv6_address ,
157+ route_match_ipv6_address_compile ,
158+ route_match_ipv6_address_free
159+ };
160+
161+ /* match ipv6 address prefix-list PREFIX_LIST */
162+
163+ static enum route_map_cmd_result_t
164+ route_match_ipv6_address_prefix_list (void * rule , const struct prefix * prefix ,
165+ void * object )
166+ {
167+ struct prefix_list * plist ;
168+
169+ plist = prefix_list_lookup (AFI_IP6 , (char * )rule );
170+ if (prefix_list_apply (plist , prefix ) != PREFIX_DENY )
171+ return RMAP_MATCH ;
172+
173+ return RMAP_NOMATCH ;
174+ }
175+
176+ static void * route_match_ipv6_address_prefix_list_compile (const char * arg )
177+ {
178+ return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED , arg );
179+ }
180+
181+ static void route_match_ipv6_address_prefix_list_free (void * rule )
182+ {
183+ XFREE (MTYPE_ROUTE_MAP_COMPILED , rule );
184+ }
185+
186+ static const struct route_map_rule_cmd
187+ route_match_ipv6_address_prefix_list_cmd = {
188+ "ipv6 address prefix-list" ,
189+ route_match_ipv6_address_prefix_list ,
190+ route_match_ipv6_address_prefix_list_compile ,
191+ route_match_ipv6_address_prefix_list_free
192+ };
193+
130194/* `match tag TAG' */
131195/* Match function return 1 if match is success else return zero. */
132196static enum route_map_cmd_result_t route_match_tag (void * rule ,
@@ -342,6 +406,12 @@ void ripng_route_map_init(void)
342406 route_map_match_interface_hook (generic_match_add );
343407 route_map_no_match_interface_hook (generic_match_delete );
344408
409+ route_map_match_ipv6_address_hook (generic_match_add );
410+ route_map_no_match_ipv6_address_hook (generic_match_delete );
411+
412+ route_map_match_ipv6_address_prefix_list_hook (generic_match_add );
413+ route_map_no_match_ipv6_address_prefix_list_hook (generic_match_delete );
414+
345415 route_map_match_metric_hook (generic_match_add );
346416 route_map_no_match_metric_hook (generic_match_delete );
347417
@@ -359,6 +429,8 @@ void ripng_route_map_init(void)
359429
360430 route_map_install_match (& route_match_metric_cmd );
361431 route_map_install_match (& route_match_interface_cmd );
432+ route_map_install_match (& route_match_ipv6_address_cmd );
433+ route_map_install_match (& route_match_ipv6_address_prefix_list_cmd );
362434 route_map_install_match (& route_match_tag_cmd );
363435 route_map_install_set (& route_set_metric_cmd );
364436 route_map_install_set (& route_set_ipv6_nexthop_local_cmd );
0 commit comments