/src/frr/bgpd/bgp_routemap_clippy.c
Line | Count | Source |
1 | | /* match_vrl_source_vrf => "match source-vrf NAME$vrf_name" */ |
2 | | DEFUN_CMD_FUNC_DECL(match_vrl_source_vrf) |
3 | | #define funcdecl_match_vrl_source_vrf static int match_vrl_source_vrf_magic(\ |
4 | | const struct cmd_element *self __attribute__ ((unused)),\ |
5 | | struct vty *vty __attribute__ ((unused)),\ |
6 | | int argc __attribute__ ((unused)),\ |
7 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
8 | | const char * vrf_name) |
9 | | funcdecl_match_vrl_source_vrf; |
10 | | DEFUN_CMD_FUNC_TEXT(match_vrl_source_vrf) |
11 | 0 | { |
12 | 0 | #if 1 /* anything to parse? */ |
13 | 0 | int _i; |
14 | | #if 0 /* anything that can fail? */ |
15 | | unsigned _fail = 0, _failcnt = 0; |
16 | | #endif |
17 | 0 | const char *vrf_name = NULL; |
18 | |
|
19 | 0 | for (_i = 0; _i < argc; _i++) { |
20 | 0 | if (!argv[_i]->varname) |
21 | 0 | continue; |
22 | | #if 0 /* anything that can fail? */ |
23 | | _fail = 0; |
24 | | #endif |
25 | | |
26 | 0 | if (!strcmp(argv[_i]->varname, "vrf_name")) { |
27 | 0 | vrf_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
28 | 0 | } |
29 | | #if 0 /* anything that can fail? */ |
30 | | if (_fail) |
31 | | vty_out (vty, "%% invalid input for %s: %s\n", |
32 | | argv[_i]->varname, argv[_i]->arg); |
33 | | _failcnt += _fail; |
34 | | #endif |
35 | 0 | } |
36 | | #if 0 /* anything that can fail? */ |
37 | | if (_failcnt) |
38 | | return CMD_WARNING; |
39 | | #endif |
40 | 0 | #endif |
41 | 0 | if (!vrf_name) { |
42 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "vrf_name"); |
43 | 0 | return CMD_WARNING; |
44 | 0 | } |
45 | | |
46 | 0 | return match_vrl_source_vrf_magic(self, vty, argc, argv, vrf_name); |
47 | 0 | } |
48 | | |
49 | | /* no_match_vrl_source_vrf => "no match source-vrf NAME$vrf_name" */ |
50 | | DEFUN_CMD_FUNC_DECL(no_match_vrl_source_vrf) |
51 | | #define funcdecl_no_match_vrl_source_vrf static int no_match_vrl_source_vrf_magic(\ |
52 | | const struct cmd_element *self __attribute__ ((unused)),\ |
53 | | struct vty *vty __attribute__ ((unused)),\ |
54 | | int argc __attribute__ ((unused)),\ |
55 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
56 | | const char * vrf_name) |
57 | | funcdecl_no_match_vrl_source_vrf; |
58 | | DEFUN_CMD_FUNC_TEXT(no_match_vrl_source_vrf) |
59 | 0 | { |
60 | 0 | #if 1 /* anything to parse? */ |
61 | 0 | int _i; |
62 | | #if 0 /* anything that can fail? */ |
63 | | unsigned _fail = 0, _failcnt = 0; |
64 | | #endif |
65 | 0 | const char *vrf_name = NULL; |
66 | |
|
67 | 0 | for (_i = 0; _i < argc; _i++) { |
68 | 0 | if (!argv[_i]->varname) |
69 | 0 | continue; |
70 | | #if 0 /* anything that can fail? */ |
71 | | _fail = 0; |
72 | | #endif |
73 | | |
74 | 0 | if (!strcmp(argv[_i]->varname, "vrf_name")) { |
75 | 0 | vrf_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
76 | 0 | } |
77 | | #if 0 /* anything that can fail? */ |
78 | | if (_fail) |
79 | | vty_out (vty, "%% invalid input for %s: %s\n", |
80 | | argv[_i]->varname, argv[_i]->arg); |
81 | | _failcnt += _fail; |
82 | | #endif |
83 | 0 | } |
84 | | #if 0 /* anything that can fail? */ |
85 | | if (_failcnt) |
86 | | return CMD_WARNING; |
87 | | #endif |
88 | 0 | #endif |
89 | 0 | if (!vrf_name) { |
90 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "vrf_name"); |
91 | 0 | return CMD_WARNING; |
92 | 0 | } |
93 | | |
94 | 0 | return no_match_vrl_source_vrf_magic(self, vty, argc, argv, vrf_name); |
95 | 0 | } |
96 | | |
97 | | /* match_peer => "match peer <A.B.C.D$addrv4|X:X::X:X$addrv6|WORD$intf>" */ |
98 | | DEFUN_CMD_FUNC_DECL(match_peer) |
99 | | #define funcdecl_match_peer static int match_peer_magic(\ |
100 | | const struct cmd_element *self __attribute__ ((unused)),\ |
101 | | struct vty *vty __attribute__ ((unused)),\ |
102 | | int argc __attribute__ ((unused)),\ |
103 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
104 | | struct in_addr addrv4,\ |
105 | | const char * addrv4_str __attribute__ ((unused)),\ |
106 | | struct in6_addr addrv6,\ |
107 | | const char * addrv6_str __attribute__ ((unused)),\ |
108 | | const char * intf) |
109 | | funcdecl_match_peer; |
110 | | DEFUN_CMD_FUNC_TEXT(match_peer) |
111 | 0 | { |
112 | 0 | #if 3 /* anything to parse? */ |
113 | 0 | int _i; |
114 | 0 | #if 1 /* anything that can fail? */ |
115 | 0 | unsigned _fail = 0, _failcnt = 0; |
116 | 0 | #endif |
117 | 0 | struct in_addr addrv4 = { INADDR_ANY }; |
118 | 0 | const char *addrv4_str = NULL; |
119 | 0 | struct in6_addr addrv6 = {}; |
120 | 0 | const char *addrv6_str = NULL; |
121 | 0 | const char *intf = NULL; |
122 | |
|
123 | 0 | for (_i = 0; _i < argc; _i++) { |
124 | 0 | if (!argv[_i]->varname) |
125 | 0 | continue; |
126 | 0 | #if 1 /* anything that can fail? */ |
127 | 0 | _fail = 0; |
128 | 0 | #endif |
129 | |
|
130 | 0 | if (!strcmp(argv[_i]->varname, "addrv4")) { |
131 | 0 | addrv4_str = argv[_i]->arg; |
132 | 0 | _fail = !inet_aton(argv[_i]->arg, &addrv4); |
133 | 0 | } |
134 | 0 | if (!strcmp(argv[_i]->varname, "addrv6")) { |
135 | 0 | addrv6_str = argv[_i]->arg; |
136 | 0 | _fail = !inet_pton(AF_INET6, argv[_i]->arg, &addrv6); |
137 | 0 | } |
138 | 0 | if (!strcmp(argv[_i]->varname, "intf")) { |
139 | 0 | intf = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
140 | 0 | } |
141 | 0 | #if 1 /* anything that can fail? */ |
142 | 0 | if (_fail) |
143 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
144 | 0 | argv[_i]->varname, argv[_i]->arg); |
145 | 0 | _failcnt += _fail; |
146 | 0 | #endif |
147 | 0 | } |
148 | 0 | #if 1 /* anything that can fail? */ |
149 | 0 | if (_failcnt) |
150 | 0 | return CMD_WARNING; |
151 | 0 | #endif |
152 | 0 | #endif |
153 | | |
154 | 0 | return match_peer_magic(self, vty, argc, argv, addrv4, addrv4_str, addrv6, addrv6_str, intf); |
155 | 0 | } |
156 | | |
157 | | /* match_ip_route_source => "match ip route-source ACCESSLIST4_NAME" */ |
158 | | DEFUN_CMD_FUNC_DECL(match_ip_route_source) |
159 | | #define funcdecl_match_ip_route_source static int match_ip_route_source_magic(\ |
160 | | const struct cmd_element *self __attribute__ ((unused)),\ |
161 | | struct vty *vty __attribute__ ((unused)),\ |
162 | | int argc __attribute__ ((unused)),\ |
163 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
164 | | const char * accesslist4_name) |
165 | | funcdecl_match_ip_route_source; |
166 | | DEFUN_CMD_FUNC_TEXT(match_ip_route_source) |
167 | 0 | { |
168 | 0 | #if 1 /* anything to parse? */ |
169 | 0 | int _i; |
170 | | #if 0 /* anything that can fail? */ |
171 | | unsigned _fail = 0, _failcnt = 0; |
172 | | #endif |
173 | 0 | const char *accesslist4_name = NULL; |
174 | |
|
175 | 0 | for (_i = 0; _i < argc; _i++) { |
176 | 0 | if (!argv[_i]->varname) |
177 | 0 | continue; |
178 | | #if 0 /* anything that can fail? */ |
179 | | _fail = 0; |
180 | | #endif |
181 | | |
182 | 0 | if (!strcmp(argv[_i]->varname, "accesslist4_name")) { |
183 | 0 | accesslist4_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
184 | 0 | } |
185 | | #if 0 /* anything that can fail? */ |
186 | | if (_fail) |
187 | | vty_out (vty, "%% invalid input for %s: %s\n", |
188 | | argv[_i]->varname, argv[_i]->arg); |
189 | | _failcnt += _fail; |
190 | | #endif |
191 | 0 | } |
192 | | #if 0 /* anything that can fail? */ |
193 | | if (_failcnt) |
194 | | return CMD_WARNING; |
195 | | #endif |
196 | 0 | #endif |
197 | 0 | if (!accesslist4_name) { |
198 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "accesslist4_name"); |
199 | 0 | return CMD_WARNING; |
200 | 0 | } |
201 | | |
202 | 0 | return match_ip_route_source_magic(self, vty, argc, argv, accesslist4_name); |
203 | 0 | } |
204 | | |
205 | | /* match_community => "match community <(1-99)|(100-500)|COMMUNITY_LIST_NAME> [exact-match]" */ |
206 | | DEFUN_CMD_FUNC_DECL(match_community) |
207 | | #define funcdecl_match_community static int match_community_magic(\ |
208 | | const struct cmd_element *self __attribute__ ((unused)),\ |
209 | | struct vty *vty __attribute__ ((unused)),\ |
210 | | int argc __attribute__ ((unused)),\ |
211 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
212 | | long community,\ |
213 | | const char * community_str __attribute__ ((unused)),\ |
214 | | const char * community_list_name) |
215 | | funcdecl_match_community; |
216 | | DEFUN_CMD_FUNC_TEXT(match_community) |
217 | 0 | { |
218 | 0 | #if 2 /* anything to parse? */ |
219 | 0 | int _i; |
220 | 0 | #if 1 /* anything that can fail? */ |
221 | 0 | unsigned _fail = 0, _failcnt = 0; |
222 | 0 | #endif |
223 | 0 | long community = 0; |
224 | 0 | const char *community_str = NULL; |
225 | 0 | const char *community_list_name = NULL; |
226 | |
|
227 | 0 | for (_i = 0; _i < argc; _i++) { |
228 | 0 | if (!argv[_i]->varname) |
229 | 0 | continue; |
230 | 0 | #if 1 /* anything that can fail? */ |
231 | 0 | _fail = 0; |
232 | 0 | #endif |
233 | |
|
234 | 0 | if (!strcmp(argv[_i]->varname, "community")) { |
235 | 0 | community_str = argv[_i]->arg; |
236 | 0 | char *_end; |
237 | 0 | community = strtol(argv[_i]->arg, &_end, 10); |
238 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
239 | 0 | } |
240 | 0 | if (!strcmp(argv[_i]->varname, "community_list_name")) { |
241 | 0 | community_list_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
242 | 0 | } |
243 | 0 | #if 1 /* anything that can fail? */ |
244 | 0 | if (_fail) |
245 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
246 | 0 | argv[_i]->varname, argv[_i]->arg); |
247 | 0 | _failcnt += _fail; |
248 | 0 | #endif |
249 | 0 | } |
250 | 0 | #if 1 /* anything that can fail? */ |
251 | 0 | if (_failcnt) |
252 | 0 | return CMD_WARNING; |
253 | 0 | #endif |
254 | 0 | #endif |
255 | | |
256 | 0 | return match_community_magic(self, vty, argc, argv, community, community_str, community_list_name); |
257 | 0 | } |
258 | | |
259 | | /* match_lcommunity => "match large-community <(1-99)|(100-500)|LCOMMUNITY_LIST_NAME> [exact-match]" */ |
260 | | DEFUN_CMD_FUNC_DECL(match_lcommunity) |
261 | | #define funcdecl_match_lcommunity static int match_lcommunity_magic(\ |
262 | | const struct cmd_element *self __attribute__ ((unused)),\ |
263 | | struct vty *vty __attribute__ ((unused)),\ |
264 | | int argc __attribute__ ((unused)),\ |
265 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
266 | | long large_community,\ |
267 | | const char * large_community_str __attribute__ ((unused)),\ |
268 | | const char * lcommunity_list_name) |
269 | | funcdecl_match_lcommunity; |
270 | | DEFUN_CMD_FUNC_TEXT(match_lcommunity) |
271 | 0 | { |
272 | 0 | #if 2 /* anything to parse? */ |
273 | 0 | int _i; |
274 | 0 | #if 1 /* anything that can fail? */ |
275 | 0 | unsigned _fail = 0, _failcnt = 0; |
276 | 0 | #endif |
277 | 0 | long large_community = 0; |
278 | 0 | const char *large_community_str = NULL; |
279 | 0 | const char *lcommunity_list_name = NULL; |
280 | |
|
281 | 0 | for (_i = 0; _i < argc; _i++) { |
282 | 0 | if (!argv[_i]->varname) |
283 | 0 | continue; |
284 | 0 | #if 1 /* anything that can fail? */ |
285 | 0 | _fail = 0; |
286 | 0 | #endif |
287 | |
|
288 | 0 | if (!strcmp(argv[_i]->varname, "large_community")) { |
289 | 0 | large_community_str = argv[_i]->arg; |
290 | 0 | char *_end; |
291 | 0 | large_community = strtol(argv[_i]->arg, &_end, 10); |
292 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
293 | 0 | } |
294 | 0 | if (!strcmp(argv[_i]->varname, "lcommunity_list_name")) { |
295 | 0 | lcommunity_list_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
296 | 0 | } |
297 | 0 | #if 1 /* anything that can fail? */ |
298 | 0 | if (_fail) |
299 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
300 | 0 | argv[_i]->varname, argv[_i]->arg); |
301 | 0 | _failcnt += _fail; |
302 | 0 | #endif |
303 | 0 | } |
304 | 0 | #if 1 /* anything that can fail? */ |
305 | 0 | if (_failcnt) |
306 | 0 | return CMD_WARNING; |
307 | 0 | #endif |
308 | 0 | #endif |
309 | | |
310 | 0 | return match_lcommunity_magic(self, vty, argc, argv, large_community, large_community_str, lcommunity_list_name); |
311 | 0 | } |
312 | | |
313 | | /* match_ecommunity => "match extcommunity <(1-99)|(100-500)|EXTCOMMUNITY_LIST_NAME>" */ |
314 | | DEFUN_CMD_FUNC_DECL(match_ecommunity) |
315 | | #define funcdecl_match_ecommunity static int match_ecommunity_magic(\ |
316 | | const struct cmd_element *self __attribute__ ((unused)),\ |
317 | | struct vty *vty __attribute__ ((unused)),\ |
318 | | int argc __attribute__ ((unused)),\ |
319 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
320 | | long extcommunity,\ |
321 | | const char * extcommunity_str __attribute__ ((unused)),\ |
322 | | const char * extcommunity_list_name) |
323 | | funcdecl_match_ecommunity; |
324 | | DEFUN_CMD_FUNC_TEXT(match_ecommunity) |
325 | 0 | { |
326 | 0 | #if 2 /* anything to parse? */ |
327 | 0 | int _i; |
328 | 0 | #if 1 /* anything that can fail? */ |
329 | 0 | unsigned _fail = 0, _failcnt = 0; |
330 | 0 | #endif |
331 | 0 | long extcommunity = 0; |
332 | 0 | const char *extcommunity_str = NULL; |
333 | 0 | const char *extcommunity_list_name = NULL; |
334 | |
|
335 | 0 | for (_i = 0; _i < argc; _i++) { |
336 | 0 | if (!argv[_i]->varname) |
337 | 0 | continue; |
338 | 0 | #if 1 /* anything that can fail? */ |
339 | 0 | _fail = 0; |
340 | 0 | #endif |
341 | |
|
342 | 0 | if (!strcmp(argv[_i]->varname, "extcommunity")) { |
343 | 0 | extcommunity_str = argv[_i]->arg; |
344 | 0 | char *_end; |
345 | 0 | extcommunity = strtol(argv[_i]->arg, &_end, 10); |
346 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
347 | 0 | } |
348 | 0 | if (!strcmp(argv[_i]->varname, "extcommunity_list_name")) { |
349 | 0 | extcommunity_list_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
350 | 0 | } |
351 | 0 | #if 1 /* anything that can fail? */ |
352 | 0 | if (_fail) |
353 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
354 | 0 | argv[_i]->varname, argv[_i]->arg); |
355 | 0 | _failcnt += _fail; |
356 | 0 | #endif |
357 | 0 | } |
358 | 0 | #if 1 /* anything that can fail? */ |
359 | 0 | if (_failcnt) |
360 | 0 | return CMD_WARNING; |
361 | 0 | #endif |
362 | 0 | #endif |
363 | | |
364 | 0 | return match_ecommunity_magic(self, vty, argc, argv, extcommunity, extcommunity_str, extcommunity_list_name); |
365 | 0 | } |
366 | | |
367 | | /* set_l3vpn_nexthop_encapsulation => "[no] set l3vpn next-hop encapsulation gre" */ |
368 | | DEFUN_CMD_FUNC_DECL(set_l3vpn_nexthop_encapsulation) |
369 | | #define funcdecl_set_l3vpn_nexthop_encapsulation static int set_l3vpn_nexthop_encapsulation_magic(\ |
370 | | const struct cmd_element *self __attribute__ ((unused)),\ |
371 | | struct vty *vty __attribute__ ((unused)),\ |
372 | | int argc __attribute__ ((unused)),\ |
373 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
374 | | const char * no) |
375 | | funcdecl_set_l3vpn_nexthop_encapsulation; |
376 | | DEFUN_CMD_FUNC_TEXT(set_l3vpn_nexthop_encapsulation) |
377 | 0 | { |
378 | 0 | #if 1 /* anything to parse? */ |
379 | 0 | int _i; |
380 | | #if 0 /* anything that can fail? */ |
381 | | unsigned _fail = 0, _failcnt = 0; |
382 | | #endif |
383 | 0 | const char *no = NULL; |
384 | |
|
385 | 0 | for (_i = 0; _i < argc; _i++) { |
386 | 0 | if (!argv[_i]->varname) |
387 | 0 | continue; |
388 | | #if 0 /* anything that can fail? */ |
389 | | _fail = 0; |
390 | | #endif |
391 | | |
392 | 0 | if (!strcmp(argv[_i]->varname, "no")) { |
393 | 0 | no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
394 | 0 | } |
395 | | #if 0 /* anything that can fail? */ |
396 | | if (_fail) |
397 | | vty_out (vty, "%% invalid input for %s: %s\n", |
398 | | argv[_i]->varname, argv[_i]->arg); |
399 | | _failcnt += _fail; |
400 | | #endif |
401 | 0 | } |
402 | | #if 0 /* anything that can fail? */ |
403 | | if (_failcnt) |
404 | | return CMD_WARNING; |
405 | | #endif |
406 | 0 | #endif |
407 | |
|
408 | 0 | return set_l3vpn_nexthop_encapsulation_magic(self, vty, argc, argv, no); |
409 | 0 | } |
410 | | |
411 | | /* set_aspath_replace_asn => "set as-path replace <any|ASNUM>$replace" */ |
412 | | DEFUN_CMD_FUNC_DECL(set_aspath_replace_asn) |
413 | | #define funcdecl_set_aspath_replace_asn static int set_aspath_replace_asn_magic(\ |
414 | | const struct cmd_element *self __attribute__ ((unused)),\ |
415 | | struct vty *vty __attribute__ ((unused)),\ |
416 | | int argc __attribute__ ((unused)),\ |
417 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
418 | | const char * replace) |
419 | | funcdecl_set_aspath_replace_asn; |
420 | | DEFUN_CMD_FUNC_TEXT(set_aspath_replace_asn) |
421 | 0 | { |
422 | 0 | #if 1 /* anything to parse? */ |
423 | 0 | int _i; |
424 | | #if 0 /* anything that can fail? */ |
425 | | unsigned _fail = 0, _failcnt = 0; |
426 | | #endif |
427 | 0 | const char *replace = NULL; |
428 | |
|
429 | 0 | for (_i = 0; _i < argc; _i++) { |
430 | 0 | if (!argv[_i]->varname) |
431 | 0 | continue; |
432 | | #if 0 /* anything that can fail? */ |
433 | | _fail = 0; |
434 | | #endif |
435 | | |
436 | 0 | if (!strcmp(argv[_i]->varname, "replace")) { |
437 | 0 | replace = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
438 | 0 | } |
439 | | #if 0 /* anything that can fail? */ |
440 | | if (_fail) |
441 | | vty_out (vty, "%% invalid input for %s: %s\n", |
442 | | argv[_i]->varname, argv[_i]->arg); |
443 | | _failcnt += _fail; |
444 | | #endif |
445 | 0 | } |
446 | | #if 0 /* anything that can fail? */ |
447 | | if (_failcnt) |
448 | | return CMD_WARNING; |
449 | | #endif |
450 | 0 | #endif |
451 | 0 | if (!replace) { |
452 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "replace"); |
453 | 0 | return CMD_WARNING; |
454 | 0 | } |
455 | | |
456 | 0 | return set_aspath_replace_asn_magic(self, vty, argc, argv, replace); |
457 | 0 | } |
458 | | |
459 | | /* no_set_aspath_replace_asn => "no set as-path replace [<any|ASNUM>]" */ |
460 | | DEFUN_CMD_FUNC_DECL(no_set_aspath_replace_asn) |
461 | | #define funcdecl_no_set_aspath_replace_asn static int no_set_aspath_replace_asn_magic(\ |
462 | | const struct cmd_element *self __attribute__ ((unused)),\ |
463 | | struct vty *vty __attribute__ ((unused)),\ |
464 | | int argc __attribute__ ((unused)),\ |
465 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
466 | | as_t replace,\ |
467 | | const char * replace_str __attribute__ ((unused))) |
468 | | funcdecl_no_set_aspath_replace_asn; |
469 | | DEFUN_CMD_FUNC_TEXT(no_set_aspath_replace_asn) |
470 | 0 | { |
471 | 0 | #if 1 /* anything to parse? */ |
472 | 0 | int _i; |
473 | 0 | #if 1 /* anything that can fail? */ |
474 | 0 | unsigned _fail = 0, _failcnt = 0; |
475 | 0 | #endif |
476 | 0 | as_t replace = 0; |
477 | 0 | const char *replace_str = NULL; |
478 | |
|
479 | 0 | for (_i = 0; _i < argc; _i++) { |
480 | 0 | if (!argv[_i]->varname) |
481 | 0 | continue; |
482 | 0 | #if 1 /* anything that can fail? */ |
483 | 0 | _fail = 0; |
484 | 0 | #endif |
485 | |
|
486 | 0 | if (!strcmp(argv[_i]->varname, "replace")) { |
487 | 0 | replace_str = argv[_i]->arg; |
488 | 0 | _fail = !asn_str2asn(argv[_i]->arg, &replace); |
489 | 0 | } |
490 | 0 | #if 1 /* anything that can fail? */ |
491 | 0 | if (_fail) |
492 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
493 | 0 | argv[_i]->varname, argv[_i]->arg); |
494 | 0 | _failcnt += _fail; |
495 | 0 | #endif |
496 | 0 | } |
497 | 0 | #if 1 /* anything that can fail? */ |
498 | 0 | if (_failcnt) |
499 | 0 | return CMD_WARNING; |
500 | 0 | #endif |
501 | 0 | #endif |
502 | | |
503 | 0 | return no_set_aspath_replace_asn_magic(self, vty, argc, argv, replace, replace_str); |
504 | 0 | } |
505 | | |
506 | | /* set_community_delete => "set comm-list <(1-99)|(100-500)|COMMUNITY_LIST_NAME> delete" */ |
507 | | DEFUN_CMD_FUNC_DECL(set_community_delete) |
508 | | #define funcdecl_set_community_delete static int set_community_delete_magic(\ |
509 | | const struct cmd_element *self __attribute__ ((unused)),\ |
510 | | struct vty *vty __attribute__ ((unused)),\ |
511 | | int argc __attribute__ ((unused)),\ |
512 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
513 | | long comm_list,\ |
514 | | const char * comm_list_str __attribute__ ((unused)),\ |
515 | | const char * community_list_name) |
516 | | funcdecl_set_community_delete; |
517 | | DEFUN_CMD_FUNC_TEXT(set_community_delete) |
518 | 0 | { |
519 | 0 | #if 2 /* anything to parse? */ |
520 | 0 | int _i; |
521 | 0 | #if 1 /* anything that can fail? */ |
522 | 0 | unsigned _fail = 0, _failcnt = 0; |
523 | 0 | #endif |
524 | 0 | long comm_list = 0; |
525 | 0 | const char *comm_list_str = NULL; |
526 | 0 | const char *community_list_name = NULL; |
527 | |
|
528 | 0 | for (_i = 0; _i < argc; _i++) { |
529 | 0 | if (!argv[_i]->varname) |
530 | 0 | continue; |
531 | 0 | #if 1 /* anything that can fail? */ |
532 | 0 | _fail = 0; |
533 | 0 | #endif |
534 | |
|
535 | 0 | if (!strcmp(argv[_i]->varname, "comm_list")) { |
536 | 0 | comm_list_str = argv[_i]->arg; |
537 | 0 | char *_end; |
538 | 0 | comm_list = strtol(argv[_i]->arg, &_end, 10); |
539 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
540 | 0 | } |
541 | 0 | if (!strcmp(argv[_i]->varname, "community_list_name")) { |
542 | 0 | community_list_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
543 | 0 | } |
544 | 0 | #if 1 /* anything that can fail? */ |
545 | 0 | if (_fail) |
546 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
547 | 0 | argv[_i]->varname, argv[_i]->arg); |
548 | 0 | _failcnt += _fail; |
549 | 0 | #endif |
550 | 0 | } |
551 | 0 | #if 1 /* anything that can fail? */ |
552 | 0 | if (_failcnt) |
553 | 0 | return CMD_WARNING; |
554 | 0 | #endif |
555 | 0 | #endif |
556 | | |
557 | 0 | return set_community_delete_magic(self, vty, argc, argv, comm_list, comm_list_str, community_list_name); |
558 | 0 | } |
559 | | |
560 | | /* set_lcommunity_delete => "set large-comm-list <(1-99)|(100-500)|LCOMMUNITY_LIST_NAME> delete" */ |
561 | | DEFUN_CMD_FUNC_DECL(set_lcommunity_delete) |
562 | | #define funcdecl_set_lcommunity_delete static int set_lcommunity_delete_magic(\ |
563 | | const struct cmd_element *self __attribute__ ((unused)),\ |
564 | | struct vty *vty __attribute__ ((unused)),\ |
565 | | int argc __attribute__ ((unused)),\ |
566 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
567 | | long large_comm_list,\ |
568 | | const char * large_comm_list_str __attribute__ ((unused)),\ |
569 | | const char * lcommunity_list_name) |
570 | | funcdecl_set_lcommunity_delete; |
571 | | DEFUN_CMD_FUNC_TEXT(set_lcommunity_delete) |
572 | 0 | { |
573 | 0 | #if 2 /* anything to parse? */ |
574 | 0 | int _i; |
575 | 0 | #if 1 /* anything that can fail? */ |
576 | 0 | unsigned _fail = 0, _failcnt = 0; |
577 | 0 | #endif |
578 | 0 | long large_comm_list = 0; |
579 | 0 | const char *large_comm_list_str = NULL; |
580 | 0 | const char *lcommunity_list_name = NULL; |
581 | |
|
582 | 0 | for (_i = 0; _i < argc; _i++) { |
583 | 0 | if (!argv[_i]->varname) |
584 | 0 | continue; |
585 | 0 | #if 1 /* anything that can fail? */ |
586 | 0 | _fail = 0; |
587 | 0 | #endif |
588 | |
|
589 | 0 | if (!strcmp(argv[_i]->varname, "large_comm_list")) { |
590 | 0 | large_comm_list_str = argv[_i]->arg; |
591 | 0 | char *_end; |
592 | 0 | large_comm_list = strtol(argv[_i]->arg, &_end, 10); |
593 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
594 | 0 | } |
595 | 0 | if (!strcmp(argv[_i]->varname, "lcommunity_list_name")) { |
596 | 0 | lcommunity_list_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
597 | 0 | } |
598 | 0 | #if 1 /* anything that can fail? */ |
599 | 0 | if (_fail) |
600 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
601 | 0 | argv[_i]->varname, argv[_i]->arg); |
602 | 0 | _failcnt += _fail; |
603 | 0 | #endif |
604 | 0 | } |
605 | 0 | #if 1 /* anything that can fail? */ |
606 | 0 | if (_failcnt) |
607 | 0 | return CMD_WARNING; |
608 | 0 | #endif |
609 | 0 | #endif |
610 | | |
611 | 0 | return set_lcommunity_delete_magic(self, vty, argc, argv, large_comm_list, large_comm_list_str, lcommunity_list_name); |
612 | 0 | } |
613 | | |
614 | | /* set_ecommunity_nt => "set extcommunity nt RTLIST..." */ |
615 | | DEFUN_CMD_FUNC_DECL(set_ecommunity_nt) |
616 | | #define funcdecl_set_ecommunity_nt static int set_ecommunity_nt_magic(\ |
617 | | const struct cmd_element *self __attribute__ ((unused)),\ |
618 | | struct vty *vty __attribute__ ((unused)),\ |
619 | | int argc __attribute__ ((unused)),\ |
620 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
621 | | const char * rtlist) |
622 | | funcdecl_set_ecommunity_nt; |
623 | | DEFUN_CMD_FUNC_TEXT(set_ecommunity_nt) |
624 | 0 | { |
625 | 0 | #if 1 /* anything to parse? */ |
626 | 0 | int _i; |
627 | | #if 0 /* anything that can fail? */ |
628 | | unsigned _fail = 0, _failcnt = 0; |
629 | | #endif |
630 | 0 | const char *rtlist = NULL; |
631 | |
|
632 | 0 | for (_i = 0; _i < argc; _i++) { |
633 | 0 | if (!argv[_i]->varname) |
634 | 0 | continue; |
635 | | #if 0 /* anything that can fail? */ |
636 | | _fail = 0; |
637 | | #endif |
638 | | |
639 | 0 | if (!strcmp(argv[_i]->varname, "rtlist")) { |
640 | 0 | rtlist = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
641 | 0 | } |
642 | | #if 0 /* anything that can fail? */ |
643 | | if (_fail) |
644 | | vty_out (vty, "%% invalid input for %s: %s\n", |
645 | | argv[_i]->varname, argv[_i]->arg); |
646 | | _failcnt += _fail; |
647 | | #endif |
648 | 0 | } |
649 | | #if 0 /* anything that can fail? */ |
650 | | if (_failcnt) |
651 | | return CMD_WARNING; |
652 | | #endif |
653 | 0 | #endif |
654 | 0 | if (!rtlist) { |
655 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "rtlist"); |
656 | 0 | return CMD_WARNING; |
657 | 0 | } |
658 | | |
659 | 0 | return set_ecommunity_nt_magic(self, vty, argc, argv, rtlist); |
660 | 0 | } |
661 | | |
662 | | /* no_set_ecommunity_nt => "no set extcommunity nt RTLIST..." */ |
663 | | DEFUN_CMD_FUNC_DECL(no_set_ecommunity_nt) |
664 | | #define funcdecl_no_set_ecommunity_nt static int no_set_ecommunity_nt_magic(\ |
665 | | const struct cmd_element *self __attribute__ ((unused)),\ |
666 | | struct vty *vty __attribute__ ((unused)),\ |
667 | | int argc __attribute__ ((unused)),\ |
668 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
669 | | const char * rtlist) |
670 | | funcdecl_no_set_ecommunity_nt; |
671 | | DEFUN_CMD_FUNC_TEXT(no_set_ecommunity_nt) |
672 | 0 | { |
673 | 0 | #if 1 /* anything to parse? */ |
674 | 0 | int _i; |
675 | | #if 0 /* anything that can fail? */ |
676 | | unsigned _fail = 0, _failcnt = 0; |
677 | | #endif |
678 | 0 | const char *rtlist = NULL; |
679 | |
|
680 | 0 | for (_i = 0; _i < argc; _i++) { |
681 | 0 | if (!argv[_i]->varname) |
682 | 0 | continue; |
683 | | #if 0 /* anything that can fail? */ |
684 | | _fail = 0; |
685 | | #endif |
686 | | |
687 | 0 | if (!strcmp(argv[_i]->varname, "rtlist")) { |
688 | 0 | rtlist = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
689 | 0 | } |
690 | | #if 0 /* anything that can fail? */ |
691 | | if (_fail) |
692 | | vty_out (vty, "%% invalid input for %s: %s\n", |
693 | | argv[_i]->varname, argv[_i]->arg); |
694 | | _failcnt += _fail; |
695 | | #endif |
696 | 0 | } |
697 | | #if 0 /* anything that can fail? */ |
698 | | if (_failcnt) |
699 | | return CMD_WARNING; |
700 | | #endif |
701 | 0 | #endif |
702 | 0 | if (!rtlist) { |
703 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "rtlist"); |
704 | 0 | return CMD_WARNING; |
705 | 0 | } |
706 | | |
707 | 0 | return no_set_ecommunity_nt_magic(self, vty, argc, argv, rtlist); |
708 | 0 | } |
709 | | |
710 | | /* set_aigp_metric => "set aigp-metric <igp-metric|(1-4294967295)>$aigp_metric" */ |
711 | | DEFUN_CMD_FUNC_DECL(set_aigp_metric) |
712 | | #define funcdecl_set_aigp_metric static int set_aigp_metric_magic(\ |
713 | | const struct cmd_element *self __attribute__ ((unused)),\ |
714 | | struct vty *vty __attribute__ ((unused)),\ |
715 | | int argc __attribute__ ((unused)),\ |
716 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
717 | | const char * aigp_metric) |
718 | | funcdecl_set_aigp_metric; |
719 | | DEFUN_CMD_FUNC_TEXT(set_aigp_metric) |
720 | 0 | { |
721 | 0 | #if 1 /* anything to parse? */ |
722 | 0 | int _i; |
723 | | #if 0 /* anything that can fail? */ |
724 | | unsigned _fail = 0, _failcnt = 0; |
725 | | #endif |
726 | 0 | const char *aigp_metric = NULL; |
727 | |
|
728 | 0 | for (_i = 0; _i < argc; _i++) { |
729 | 0 | if (!argv[_i]->varname) |
730 | 0 | continue; |
731 | | #if 0 /* anything that can fail? */ |
732 | | _fail = 0; |
733 | | #endif |
734 | | |
735 | 0 | if (!strcmp(argv[_i]->varname, "aigp_metric")) { |
736 | 0 | aigp_metric = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
737 | 0 | } |
738 | | #if 0 /* anything that can fail? */ |
739 | | if (_fail) |
740 | | vty_out (vty, "%% invalid input for %s: %s\n", |
741 | | argv[_i]->varname, argv[_i]->arg); |
742 | | _failcnt += _fail; |
743 | | #endif |
744 | 0 | } |
745 | | #if 0 /* anything that can fail? */ |
746 | | if (_failcnt) |
747 | | return CMD_WARNING; |
748 | | #endif |
749 | 0 | #endif |
750 | 0 | if (!aigp_metric) { |
751 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "aigp_metric"); |
752 | 0 | return CMD_WARNING; |
753 | 0 | } |
754 | | |
755 | 0 | return set_aigp_metric_magic(self, vty, argc, argv, aigp_metric); |
756 | 0 | } |
757 | | |
758 | | /* no_set_aigp_metric => "no set aigp-metric [<igp-metric|(1-4294967295)>]" */ |
759 | | DEFUN_CMD_FUNC_DECL(no_set_aigp_metric) |
760 | | #define funcdecl_no_set_aigp_metric static int no_set_aigp_metric_magic(\ |
761 | | const struct cmd_element *self __attribute__ ((unused)),\ |
762 | | struct vty *vty __attribute__ ((unused)),\ |
763 | | int argc __attribute__ ((unused)),\ |
764 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
765 | | long aigp_metric,\ |
766 | | const char * aigp_metric_str __attribute__ ((unused))) |
767 | | funcdecl_no_set_aigp_metric; |
768 | | DEFUN_CMD_FUNC_TEXT(no_set_aigp_metric) |
769 | 0 | { |
770 | 0 | #if 1 /* anything to parse? */ |
771 | 0 | int _i; |
772 | 0 | #if 1 /* anything that can fail? */ |
773 | 0 | unsigned _fail = 0, _failcnt = 0; |
774 | 0 | #endif |
775 | 0 | long aigp_metric = 0; |
776 | 0 | const char *aigp_metric_str = NULL; |
777 | |
|
778 | 0 | for (_i = 0; _i < argc; _i++) { |
779 | 0 | if (!argv[_i]->varname) |
780 | 0 | continue; |
781 | 0 | #if 1 /* anything that can fail? */ |
782 | 0 | _fail = 0; |
783 | 0 | #endif |
784 | |
|
785 | 0 | if (!strcmp(argv[_i]->varname, "aigp_metric")) { |
786 | 0 | aigp_metric_str = argv[_i]->arg; |
787 | 0 | char *_end; |
788 | 0 | aigp_metric = strtol(argv[_i]->arg, &_end, 10); |
789 | 0 | _fail = (_end == argv[_i]->arg) || (*_end != '\0'); |
790 | 0 | } |
791 | 0 | #if 1 /* anything that can fail? */ |
792 | 0 | if (_fail) |
793 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
794 | 0 | argv[_i]->varname, argv[_i]->arg); |
795 | 0 | _failcnt += _fail; |
796 | 0 | #endif |
797 | 0 | } |
798 | 0 | #if 1 /* anything that can fail? */ |
799 | 0 | if (_failcnt) |
800 | 0 | return CMD_WARNING; |
801 | 0 | #endif |
802 | 0 | #endif |
803 | | |
804 | 0 | return no_set_aigp_metric_magic(self, vty, argc, argv, aigp_metric, aigp_metric_str); |
805 | 0 | } |
806 | | |
807 | | /* match_ipv4_next_hop => "match ip next-hop address A.B.C.D" */ |
808 | | DEFUN_CMD_FUNC_DECL(match_ipv4_next_hop) |
809 | | #define funcdecl_match_ipv4_next_hop static int match_ipv4_next_hop_magic(\ |
810 | | const struct cmd_element *self __attribute__ ((unused)),\ |
811 | | struct vty *vty __attribute__ ((unused)),\ |
812 | | int argc __attribute__ ((unused)),\ |
813 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
814 | | struct in_addr address,\ |
815 | | const char * address_str __attribute__ ((unused))) |
816 | | funcdecl_match_ipv4_next_hop; |
817 | | DEFUN_CMD_FUNC_TEXT(match_ipv4_next_hop) |
818 | 0 | { |
819 | 0 | #if 1 /* anything to parse? */ |
820 | 0 | int _i; |
821 | 0 | #if 1 /* anything that can fail? */ |
822 | 0 | unsigned _fail = 0, _failcnt = 0; |
823 | 0 | #endif |
824 | 0 | struct in_addr address = { INADDR_ANY }; |
825 | 0 | const char *address_str = NULL; |
826 | |
|
827 | 0 | for (_i = 0; _i < argc; _i++) { |
828 | 0 | if (!argv[_i]->varname) |
829 | 0 | continue; |
830 | 0 | #if 1 /* anything that can fail? */ |
831 | 0 | _fail = 0; |
832 | 0 | #endif |
833 | |
|
834 | 0 | if (!strcmp(argv[_i]->varname, "address")) { |
835 | 0 | address_str = argv[_i]->arg; |
836 | 0 | _fail = !inet_aton(argv[_i]->arg, &address); |
837 | 0 | } |
838 | 0 | #if 1 /* anything that can fail? */ |
839 | 0 | if (_fail) |
840 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
841 | 0 | argv[_i]->varname, argv[_i]->arg); |
842 | 0 | _failcnt += _fail; |
843 | 0 | #endif |
844 | 0 | } |
845 | 0 | #if 1 /* anything that can fail? */ |
846 | 0 | if (_failcnt) |
847 | 0 | return CMD_WARNING; |
848 | 0 | #endif |
849 | 0 | #endif |
850 | 0 | if (!address_str) { |
851 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "address_str"); |
852 | 0 | return CMD_WARNING; |
853 | 0 | } |
854 | | |
855 | 0 | return match_ipv4_next_hop_magic(self, vty, argc, argv, address, address_str); |
856 | 0 | } |
857 | | |
858 | | /* no_match_ipv4_next_hop => "no match ip next-hop address [A.B.C.D]" */ |
859 | | DEFUN_CMD_FUNC_DECL(no_match_ipv4_next_hop) |
860 | | #define funcdecl_no_match_ipv4_next_hop static int no_match_ipv4_next_hop_magic(\ |
861 | | const struct cmd_element *self __attribute__ ((unused)),\ |
862 | | struct vty *vty __attribute__ ((unused)),\ |
863 | | int argc __attribute__ ((unused)),\ |
864 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
865 | | struct in_addr address,\ |
866 | | const char * address_str __attribute__ ((unused))) |
867 | | funcdecl_no_match_ipv4_next_hop; |
868 | | DEFUN_CMD_FUNC_TEXT(no_match_ipv4_next_hop) |
869 | 0 | { |
870 | 0 | #if 1 /* anything to parse? */ |
871 | 0 | int _i; |
872 | 0 | #if 1 /* anything that can fail? */ |
873 | 0 | unsigned _fail = 0, _failcnt = 0; |
874 | 0 | #endif |
875 | 0 | struct in_addr address = { INADDR_ANY }; |
876 | 0 | const char *address_str = NULL; |
877 | |
|
878 | 0 | for (_i = 0; _i < argc; _i++) { |
879 | 0 | if (!argv[_i]->varname) |
880 | 0 | continue; |
881 | 0 | #if 1 /* anything that can fail? */ |
882 | 0 | _fail = 0; |
883 | 0 | #endif |
884 | |
|
885 | 0 | if (!strcmp(argv[_i]->varname, "address")) { |
886 | 0 | address_str = argv[_i]->arg; |
887 | 0 | _fail = !inet_aton(argv[_i]->arg, &address); |
888 | 0 | } |
889 | 0 | #if 1 /* anything that can fail? */ |
890 | 0 | if (_fail) |
891 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
892 | 0 | argv[_i]->varname, argv[_i]->arg); |
893 | 0 | _failcnt += _fail; |
894 | 0 | #endif |
895 | 0 | } |
896 | 0 | #if 1 /* anything that can fail? */ |
897 | 0 | if (_failcnt) |
898 | 0 | return CMD_WARNING; |
899 | 0 | #endif |
900 | 0 | #endif |
901 | | |
902 | 0 | return no_match_ipv4_next_hop_magic(self, vty, argc, argv, address, address_str); |
903 | 0 | } |
904 | | |
905 | | /* set_ipx_vpn_nexthop => "set <ipv4|ipv6> vpn next-hop <A.B.C.D$addrv4|X:X::X:X$addrv6>" */ |
906 | | DEFUN_CMD_FUNC_DECL(set_ipx_vpn_nexthop) |
907 | | #define funcdecl_set_ipx_vpn_nexthop static int set_ipx_vpn_nexthop_magic(\ |
908 | | const struct cmd_element *self __attribute__ ((unused)),\ |
909 | | struct vty *vty __attribute__ ((unused)),\ |
910 | | int argc __attribute__ ((unused)),\ |
911 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
912 | | struct in_addr addrv4,\ |
913 | | const char * addrv4_str __attribute__ ((unused)),\ |
914 | | struct in6_addr addrv6,\ |
915 | | const char * addrv6_str __attribute__ ((unused))) |
916 | | funcdecl_set_ipx_vpn_nexthop; |
917 | | DEFUN_CMD_FUNC_TEXT(set_ipx_vpn_nexthop) |
918 | 0 | { |
919 | 0 | #if 2 /* anything to parse? */ |
920 | 0 | int _i; |
921 | 0 | #if 1 /* anything that can fail? */ |
922 | 0 | unsigned _fail = 0, _failcnt = 0; |
923 | 0 | #endif |
924 | 0 | struct in_addr addrv4 = { INADDR_ANY }; |
925 | 0 | const char *addrv4_str = NULL; |
926 | 0 | struct in6_addr addrv6 = {}; |
927 | 0 | const char *addrv6_str = NULL; |
928 | |
|
929 | 0 | for (_i = 0; _i < argc; _i++) { |
930 | 0 | if (!argv[_i]->varname) |
931 | 0 | continue; |
932 | 0 | #if 1 /* anything that can fail? */ |
933 | 0 | _fail = 0; |
934 | 0 | #endif |
935 | |
|
936 | 0 | if (!strcmp(argv[_i]->varname, "addrv4")) { |
937 | 0 | addrv4_str = argv[_i]->arg; |
938 | 0 | _fail = !inet_aton(argv[_i]->arg, &addrv4); |
939 | 0 | } |
940 | 0 | if (!strcmp(argv[_i]->varname, "addrv6")) { |
941 | 0 | addrv6_str = argv[_i]->arg; |
942 | 0 | _fail = !inet_pton(AF_INET6, argv[_i]->arg, &addrv6); |
943 | 0 | } |
944 | 0 | #if 1 /* anything that can fail? */ |
945 | 0 | if (_fail) |
946 | 0 | vty_out (vty, "%% invalid input for %s: %s\n", |
947 | 0 | argv[_i]->varname, argv[_i]->arg); |
948 | 0 | _failcnt += _fail; |
949 | 0 | #endif |
950 | 0 | } |
951 | 0 | #if 1 /* anything that can fail? */ |
952 | 0 | if (_failcnt) |
953 | 0 | return CMD_WARNING; |
954 | 0 | #endif |
955 | 0 | #endif |
956 | | |
957 | 0 | return set_ipx_vpn_nexthop_magic(self, vty, argc, argv, addrv4, addrv4_str, addrv6, addrv6_str); |
958 | 0 | } |
959 | | |
960 | | /* match_rpki_extcommunity => "[no$no] match rpki-extcommunity <valid|invalid|notfound>" */ |
961 | | DEFUN_CMD_FUNC_DECL(match_rpki_extcommunity) |
962 | | #define funcdecl_match_rpki_extcommunity static int match_rpki_extcommunity_magic(\ |
963 | | const struct cmd_element *self __attribute__ ((unused)),\ |
964 | | struct vty *vty __attribute__ ((unused)),\ |
965 | | int argc __attribute__ ((unused)),\ |
966 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
967 | | const char * no) |
968 | | funcdecl_match_rpki_extcommunity; |
969 | | DEFUN_CMD_FUNC_TEXT(match_rpki_extcommunity) |
970 | 0 | { |
971 | 0 | #if 1 /* anything to parse? */ |
972 | 0 | int _i; |
973 | | #if 0 /* anything that can fail? */ |
974 | | unsigned _fail = 0, _failcnt = 0; |
975 | | #endif |
976 | 0 | const char *no = NULL; |
977 | |
|
978 | 0 | for (_i = 0; _i < argc; _i++) { |
979 | 0 | if (!argv[_i]->varname) |
980 | 0 | continue; |
981 | | #if 0 /* anything that can fail? */ |
982 | | _fail = 0; |
983 | | #endif |
984 | | |
985 | 0 | if (!strcmp(argv[_i]->varname, "no")) { |
986 | 0 | no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
987 | 0 | } |
988 | | #if 0 /* anything that can fail? */ |
989 | | if (_fail) |
990 | | vty_out (vty, "%% invalid input for %s: %s\n", |
991 | | argv[_i]->varname, argv[_i]->arg); |
992 | | _failcnt += _fail; |
993 | | #endif |
994 | 0 | } |
995 | | #if 0 /* anything that can fail? */ |
996 | | if (_failcnt) |
997 | | return CMD_WARNING; |
998 | | #endif |
999 | 0 | #endif |
1000 | |
|
1001 | 0 | return match_rpki_extcommunity_magic(self, vty, argc, argv, no); |
1002 | 0 | } |
1003 | | |
1004 | | /* match_source_protocol => "match source-protocol <kernel|connected|static|rip|ripng|ospf|ospf6|isis|bgp|eigrp|nhrp|table|vnc|babel|openfabric>$proto" */ |
1005 | | DEFUN_CMD_FUNC_DECL(match_source_protocol) |
1006 | | #define funcdecl_match_source_protocol static int match_source_protocol_magic(\ |
1007 | | const struct cmd_element *self __attribute__ ((unused)),\ |
1008 | | struct vty *vty __attribute__ ((unused)),\ |
1009 | | int argc __attribute__ ((unused)),\ |
1010 | | struct cmd_token *argv[] __attribute__ ((unused)),\ |
1011 | | const char * proto) |
1012 | | funcdecl_match_source_protocol; |
1013 | | DEFUN_CMD_FUNC_TEXT(match_source_protocol) |
1014 | 0 | { |
1015 | 0 | #if 1 /* anything to parse? */ |
1016 | 0 | int _i; |
1017 | | #if 0 /* anything that can fail? */ |
1018 | | unsigned _fail = 0, _failcnt = 0; |
1019 | | #endif |
1020 | 0 | const char *proto = NULL; |
1021 | |
|
1022 | 0 | for (_i = 0; _i < argc; _i++) { |
1023 | 0 | if (!argv[_i]->varname) |
1024 | 0 | continue; |
1025 | | #if 0 /* anything that can fail? */ |
1026 | | _fail = 0; |
1027 | | #endif |
1028 | | |
1029 | 0 | if (!strcmp(argv[_i]->varname, "proto")) { |
1030 | 0 | proto = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg; |
1031 | 0 | } |
1032 | | #if 0 /* anything that can fail? */ |
1033 | | if (_fail) |
1034 | | vty_out (vty, "%% invalid input for %s: %s\n", |
1035 | | argv[_i]->varname, argv[_i]->arg); |
1036 | | _failcnt += _fail; |
1037 | | #endif |
1038 | 0 | } |
1039 | | #if 0 /* anything that can fail? */ |
1040 | | if (_failcnt) |
1041 | | return CMD_WARNING; |
1042 | | #endif |
1043 | 0 | #endif |
1044 | 0 | if (!proto) { |
1045 | 0 | vty_out(vty, "Internal CLI error [%s]\n", "proto"); |
1046 | 0 | return CMD_WARNING; |
1047 | 0 | } |
1048 | | |
1049 | 0 | return match_source_protocol_magic(self, vty, argc, argv, proto); |
1050 | 0 | } |
1051 | | |
1052 | | /* no_match_source_protocol => "no match source-protocol [<kernel|connected|static|rip|ripng|ospf|ospf6|isis|bgp|eigrp|nhrp|table|vnc|babel|openfabric>]" */ |
1053 | | DEFUN_CMD_FUNC_DECL(no_match_source_protocol) |
1054 | | #define funcdecl_no_match_source_protocol static int no_match_source_protocol_magic(\ |
1055 | | const struct cmd_element *self __attribute__ ((unused)),\ |
1056 | | struct vty *vty __attribute__ ((unused)),\ |
1057 | | int argc __attribute__ ((unused)),\ |
1058 | | struct cmd_token *argv[] __attribute__ ((unused))) |
1059 | | funcdecl_no_match_source_protocol; |
1060 | | DEFUN_CMD_FUNC_TEXT(no_match_source_protocol) |
1061 | 0 | { |
1062 | | #if 0 /* anything to parse? */ |
1063 | | int _i; |
1064 | | #if 0 /* anything that can fail? */ |
1065 | | unsigned _fail = 0, _failcnt = 0; |
1066 | | #endif |
1067 | | |
1068 | | for (_i = 0; _i < argc; _i++) { |
1069 | | if (!argv[_i]->varname) |
1070 | | continue; |
1071 | | #if 0 /* anything that can fail? */ |
1072 | | _fail = 0; |
1073 | | #endif |
1074 | | |
1075 | | #if 0 /* anything that can fail? */ |
1076 | | if (_fail) |
1077 | | vty_out (vty, "%% invalid input for %s: %s\n", |
1078 | | argv[_i]->varname, argv[_i]->arg); |
1079 | | _failcnt += _fail; |
1080 | | #endif |
1081 | | } |
1082 | | #if 0 /* anything that can fail? */ |
1083 | | if (_failcnt) |
1084 | | return CMD_WARNING; |
1085 | | #endif |
1086 | | #endif |
1087 | |
|
1088 | 0 | return no_match_source_protocol_magic(self, vty, argc, argv); |
1089 | 0 | } |
1090 | | |