/src/frr/zebra/rtadv_clippy.c
Line  | Count  | Source  | 
1  |  | #if defined(HAVE_RTADV)  | 
2  |  | /* show_ipv6_nd_ra_if => "show ipv6 nd ra-interfaces [vrf<NAME$vrf_name|all$vrf_all>]" */  | 
3  |  | DEFUN_CMD_FUNC_DECL(show_ipv6_nd_ra_if)  | 
4  |  | #define funcdecl_show_ipv6_nd_ra_if static int show_ipv6_nd_ra_if_magic(\  | 
5  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
6  |  |   struct vty *vty __attribute__ ((unused)),\  | 
7  |  |   int argc __attribute__ ((unused)),\  | 
8  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
9  |  |   const char * vrf_name,\  | 
10  |  |   const char * vrf_all)  | 
11  |  | funcdecl_show_ipv6_nd_ra_if;  | 
12  |  | DEFUN_CMD_FUNC_TEXT(show_ipv6_nd_ra_if)  | 
13  | 0  | { | 
14  | 0  | #if 2 /* anything to parse? */  | 
15  | 0  |   int _i;  | 
16  |  | #if 0 /* anything that can fail? */  | 
17  |  |   unsigned _fail = 0, _failcnt = 0;  | 
18  |  | #endif  | 
19  | 0  |   const char *vrf_name = NULL;  | 
20  | 0  |   const char *vrf_all = NULL;  | 
21  |  | 
  | 
22  | 0  |   for (_i = 0; _i < argc; _i++) { | 
23  | 0  |     if (!argv[_i]->varname)  | 
24  | 0  |       continue;  | 
25  |  | #if 0 /* anything that can fail? */  | 
26  |  |     _fail = 0;  | 
27  |  | #endif  | 
28  |  |  | 
29  | 0  |     if (!strcmp(argv[_i]->varname, "vrf_name")) { | 
30  | 0  |       vrf_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
31  | 0  |     }  | 
32  | 0  |     if (!strcmp(argv[_i]->varname, "vrf_all")) { | 
33  | 0  |       vrf_all = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;  | 
34  | 0  |     }  | 
35  |  | #if 0 /* anything that can fail? */  | 
36  |  |     if (_fail)  | 
37  |  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
38  |  |            argv[_i]->varname, argv[_i]->arg);  | 
39  |  |     _failcnt += _fail;  | 
40  |  | #endif  | 
41  | 0  |   }  | 
42  |  | #if 0 /* anything that can fail? */  | 
43  |  |   if (_failcnt)  | 
44  |  |     return CMD_WARNING;  | 
45  |  | #endif  | 
46  | 0  | #endif  | 
47  |  | 
  | 
48  | 0  |   return show_ipv6_nd_ra_if_magic(self, vty, argc, argv, vrf_name, vrf_all);  | 
49  | 0  | }  | 
50  |  | #endif  | 
51  |  |  | 
52  |  | #if defined(HAVE_RTADV)  | 
53  |  | /* ipv6_nd_ra_hop_limit => "ipv6 nd ra-hop-limit (0-255)$hopcount" */  | 
54  |  | DEFUN_CMD_FUNC_DECL(ipv6_nd_ra_hop_limit)  | 
55  |  | #define funcdecl_ipv6_nd_ra_hop_limit static int ipv6_nd_ra_hop_limit_magic(\  | 
56  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
57  |  |   struct vty *vty __attribute__ ((unused)),\  | 
58  |  |   int argc __attribute__ ((unused)),\  | 
59  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
60  |  |   long hopcount,\  | 
61  |  |   const char * hopcount_str __attribute__ ((unused)))  | 
62  |  | funcdecl_ipv6_nd_ra_hop_limit;  | 
63  |  | DEFUN_CMD_FUNC_TEXT(ipv6_nd_ra_hop_limit)  | 
64  | 0  | { | 
65  | 0  | #if 1 /* anything to parse? */  | 
66  | 0  |   int _i;  | 
67  | 0  | #if 1 /* anything that can fail? */  | 
68  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
69  | 0  | #endif  | 
70  | 0  |   long hopcount = 0;  | 
71  | 0  |   const char *hopcount_str = NULL;  | 
72  |  | 
  | 
73  | 0  |   for (_i = 0; _i < argc; _i++) { | 
74  | 0  |     if (!argv[_i]->varname)  | 
75  | 0  |       continue;  | 
76  | 0  | #if 1 /* anything that can fail? */  | 
77  | 0  |     _fail = 0;  | 
78  | 0  | #endif  | 
79  |  | 
  | 
80  | 0  |     if (!strcmp(argv[_i]->varname, "hopcount")) { | 
81  | 0  |       hopcount_str = argv[_i]->arg;  | 
82  | 0  |       char *_end;  | 
83  | 0  |       hopcount = strtol(argv[_i]->arg, &_end, 10);  | 
84  | 0  |       _fail = (_end == argv[_i]->arg) || (*_end != '\0');  | 
85  | 0  |     }  | 
86  | 0  | #if 1 /* anything that can fail? */  | 
87  | 0  |     if (_fail)  | 
88  | 0  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
89  | 0  |            argv[_i]->varname, argv[_i]->arg);  | 
90  | 0  |     _failcnt += _fail;  | 
91  | 0  | #endif  | 
92  | 0  |   }  | 
93  | 0  | #if 1 /* anything that can fail? */  | 
94  | 0  |   if (_failcnt)  | 
95  | 0  |     return CMD_WARNING;  | 
96  | 0  | #endif  | 
97  | 0  | #endif  | 
98  | 0  |   if (!hopcount_str) { | 
99  | 0  |     vty_out(vty, "Internal CLI error [%s]\n", "hopcount_str");  | 
100  | 0  |     return CMD_WARNING;  | 
101  | 0  |   }  | 
102  |  |  | 
103  | 0  |   return ipv6_nd_ra_hop_limit_magic(self, vty, argc, argv, hopcount, hopcount_str);  | 
104  | 0  | }  | 
105  |  | #endif  | 
106  |  |  | 
107  |  | #if defined(HAVE_RTADV)  | 
108  |  | /* no_ipv6_nd_ra_hop_limit => "no ipv6 nd ra-hop-limit [(0-255)]" */  | 
109  |  | DEFUN_CMD_FUNC_DECL(no_ipv6_nd_ra_hop_limit)  | 
110  |  | #define funcdecl_no_ipv6_nd_ra_hop_limit static int no_ipv6_nd_ra_hop_limit_magic(\  | 
111  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
112  |  |   struct vty *vty __attribute__ ((unused)),\  | 
113  |  |   int argc __attribute__ ((unused)),\  | 
114  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
115  |  |   long ra_hop_limit,\  | 
116  |  |   const char * ra_hop_limit_str __attribute__ ((unused)))  | 
117  |  | funcdecl_no_ipv6_nd_ra_hop_limit;  | 
118  |  | DEFUN_CMD_FUNC_TEXT(no_ipv6_nd_ra_hop_limit)  | 
119  | 0  | { | 
120  | 0  | #if 1 /* anything to parse? */  | 
121  | 0  |   int _i;  | 
122  | 0  | #if 1 /* anything that can fail? */  | 
123  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
124  | 0  | #endif  | 
125  | 0  |   long ra_hop_limit = 0;  | 
126  | 0  |   const char *ra_hop_limit_str = NULL;  | 
127  |  | 
  | 
128  | 0  |   for (_i = 0; _i < argc; _i++) { | 
129  | 0  |     if (!argv[_i]->varname)  | 
130  | 0  |       continue;  | 
131  | 0  | #if 1 /* anything that can fail? */  | 
132  | 0  |     _fail = 0;  | 
133  | 0  | #endif  | 
134  |  | 
  | 
135  | 0  |     if (!strcmp(argv[_i]->varname, "ra_hop_limit")) { | 
136  | 0  |       ra_hop_limit_str = argv[_i]->arg;  | 
137  | 0  |       char *_end;  | 
138  | 0  |       ra_hop_limit = strtol(argv[_i]->arg, &_end, 10);  | 
139  | 0  |       _fail = (_end == argv[_i]->arg) || (*_end != '\0');  | 
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 no_ipv6_nd_ra_hop_limit_magic(self, vty, argc, argv, ra_hop_limit, ra_hop_limit_str);  | 
155  | 0  | }  | 
156  |  | #endif  | 
157  |  |  | 
158  |  | #if defined(HAVE_RTADV)  | 
159  |  | /* ipv6_nd_ra_retrans_interval => "ipv6 nd ra-retrans-interval (0-4294967295)$interval" */  | 
160  |  | DEFUN_CMD_FUNC_DECL(ipv6_nd_ra_retrans_interval)  | 
161  |  | #define funcdecl_ipv6_nd_ra_retrans_interval static int ipv6_nd_ra_retrans_interval_magic(\  | 
162  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
163  |  |   struct vty *vty __attribute__ ((unused)),\  | 
164  |  |   int argc __attribute__ ((unused)),\  | 
165  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
166  |  |   long interval,\  | 
167  |  |   const char * interval_str __attribute__ ((unused)))  | 
168  |  | funcdecl_ipv6_nd_ra_retrans_interval;  | 
169  |  | DEFUN_CMD_FUNC_TEXT(ipv6_nd_ra_retrans_interval)  | 
170  | 0  | { | 
171  | 0  | #if 1 /* anything to parse? */  | 
172  | 0  |   int _i;  | 
173  | 0  | #if 1 /* anything that can fail? */  | 
174  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
175  | 0  | #endif  | 
176  | 0  |   long interval = 0;  | 
177  | 0  |   const char *interval_str = NULL;  | 
178  |  | 
  | 
179  | 0  |   for (_i = 0; _i < argc; _i++) { | 
180  | 0  |     if (!argv[_i]->varname)  | 
181  | 0  |       continue;  | 
182  | 0  | #if 1 /* anything that can fail? */  | 
183  | 0  |     _fail = 0;  | 
184  | 0  | #endif  | 
185  |  | 
  | 
186  | 0  |     if (!strcmp(argv[_i]->varname, "interval")) { | 
187  | 0  |       interval_str = argv[_i]->arg;  | 
188  | 0  |       char *_end;  | 
189  | 0  |       interval = strtol(argv[_i]->arg, &_end, 10);  | 
190  | 0  |       _fail = (_end == argv[_i]->arg) || (*_end != '\0');  | 
191  | 0  |     }  | 
192  | 0  | #if 1 /* anything that can fail? */  | 
193  | 0  |     if (_fail)  | 
194  | 0  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
195  | 0  |            argv[_i]->varname, argv[_i]->arg);  | 
196  | 0  |     _failcnt += _fail;  | 
197  | 0  | #endif  | 
198  | 0  |   }  | 
199  | 0  | #if 1 /* anything that can fail? */  | 
200  | 0  |   if (_failcnt)  | 
201  | 0  |     return CMD_WARNING;  | 
202  | 0  | #endif  | 
203  | 0  | #endif  | 
204  | 0  |   if (!interval_str) { | 
205  | 0  |     vty_out(vty, "Internal CLI error [%s]\n", "interval_str");  | 
206  | 0  |     return CMD_WARNING;  | 
207  | 0  |   }  | 
208  |  |  | 
209  | 0  |   return ipv6_nd_ra_retrans_interval_magic(self, vty, argc, argv, interval, interval_str);  | 
210  | 0  | }  | 
211  |  | #endif  | 
212  |  |  | 
213  |  | #if defined(HAVE_RTADV)  | 
214  |  | /* no_ipv6_nd_ra_retrans_interval => "no ipv6 nd ra-retrans-interval [(0-4294967295)]" */  | 
215  |  | DEFUN_CMD_FUNC_DECL(no_ipv6_nd_ra_retrans_interval)  | 
216  |  | #define funcdecl_no_ipv6_nd_ra_retrans_interval static int no_ipv6_nd_ra_retrans_interval_magic(\  | 
217  |  |   const struct cmd_element *self __attribute__ ((unused)),\  | 
218  |  |   struct vty *vty __attribute__ ((unused)),\  | 
219  |  |   int argc __attribute__ ((unused)),\  | 
220  |  |   struct cmd_token *argv[] __attribute__ ((unused)),\  | 
221  |  |   long ra_retrans_interval,\  | 
222  |  |   const char * ra_retrans_interval_str __attribute__ ((unused)))  | 
223  |  | funcdecl_no_ipv6_nd_ra_retrans_interval;  | 
224  |  | DEFUN_CMD_FUNC_TEXT(no_ipv6_nd_ra_retrans_interval)  | 
225  | 0  | { | 
226  | 0  | #if 1 /* anything to parse? */  | 
227  | 0  |   int _i;  | 
228  | 0  | #if 1 /* anything that can fail? */  | 
229  | 0  |   unsigned _fail = 0, _failcnt = 0;  | 
230  | 0  | #endif  | 
231  | 0  |   long ra_retrans_interval = 0;  | 
232  | 0  |   const char *ra_retrans_interval_str = NULL;  | 
233  |  | 
  | 
234  | 0  |   for (_i = 0; _i < argc; _i++) { | 
235  | 0  |     if (!argv[_i]->varname)  | 
236  | 0  |       continue;  | 
237  | 0  | #if 1 /* anything that can fail? */  | 
238  | 0  |     _fail = 0;  | 
239  | 0  | #endif  | 
240  |  | 
  | 
241  | 0  |     if (!strcmp(argv[_i]->varname, "ra_retrans_interval")) { | 
242  | 0  |       ra_retrans_interval_str = argv[_i]->arg;  | 
243  | 0  |       char *_end;  | 
244  | 0  |       ra_retrans_interval = strtol(argv[_i]->arg, &_end, 10);  | 
245  | 0  |       _fail = (_end == argv[_i]->arg) || (*_end != '\0');  | 
246  | 0  |     }  | 
247  | 0  | #if 1 /* anything that can fail? */  | 
248  | 0  |     if (_fail)  | 
249  | 0  |       vty_out (vty, "%% invalid input for %s: %s\n",  | 
250  | 0  |            argv[_i]->varname, argv[_i]->arg);  | 
251  | 0  |     _failcnt += _fail;  | 
252  | 0  | #endif  | 
253  | 0  |   }  | 
254  | 0  | #if 1 /* anything that can fail? */  | 
255  | 0  |   if (_failcnt)  | 
256  | 0  |     return CMD_WARNING;  | 
257  | 0  | #endif  | 
258  | 0  | #endif  | 
259  |  |  | 
260  | 0  |   return no_ipv6_nd_ra_retrans_interval_magic(self, vty, argc, argv, ra_retrans_interval, ra_retrans_interval_str);  | 
261  | 0  | }  | 
262  |  | #endif  | 
263  |  |  |