Coverage Report

Created: 2025-07-14 06:48

/src/frr/lib/nexthop_group_clippy.c
Line
Count
Source (jump to first uncovered line)
1
/* nexthop_group_backup => "backup-group WORD$name" */
2
DEFUN_CMD_FUNC_DECL(nexthop_group_backup)
3
#define funcdecl_nexthop_group_backup static int nexthop_group_backup_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 * name)
9
funcdecl_nexthop_group_backup;
10
DEFUN_CMD_FUNC_TEXT(nexthop_group_backup)
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 *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, "name")) {
27
0
      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 (!name) {
42
0
    vty_out(vty, "Internal CLI error [%s]\n", "name");
43
0
    return CMD_WARNING;
44
0
  }
45
46
0
  return nexthop_group_backup_magic(self, vty, argc, argv, name);
47
0
}
48
49
/* no_nexthop_group_backup => "no backup-group [WORD$name]" */
50
DEFUN_CMD_FUNC_DECL(no_nexthop_group_backup)
51
#define funcdecl_no_nexthop_group_backup static int no_nexthop_group_backup_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 * name)
57
funcdecl_no_nexthop_group_backup;
58
DEFUN_CMD_FUNC_TEXT(no_nexthop_group_backup)
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 *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, "name")) {
75
0
      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
90
0
  return no_nexthop_group_backup_magic(self, vty, argc, argv, name);
91
0
}
92
93
/* nexthop_group_resilience => "resilient buckets (1-256) idle-timer (1-4294967295) unbalanced-timer (1-4294967295)" */
94
DEFUN_CMD_FUNC_DECL(nexthop_group_resilience)
95
#define funcdecl_nexthop_group_resilience static int nexthop_group_resilience_magic(\
96
  const struct cmd_element *self __attribute__ ((unused)),\
97
  struct vty *vty __attribute__ ((unused)),\
98
  int argc __attribute__ ((unused)),\
99
  struct cmd_token *argv[] __attribute__ ((unused)),\
100
  long buckets,\
101
  const char * buckets_str __attribute__ ((unused)),\
102
  long idle_timer,\
103
  const char * idle_timer_str __attribute__ ((unused)),\
104
  long unbalanced_timer,\
105
  const char * unbalanced_timer_str __attribute__ ((unused)))
106
funcdecl_nexthop_group_resilience;
107
DEFUN_CMD_FUNC_TEXT(nexthop_group_resilience)
108
0
{
109
0
#if 3 /* anything to parse? */
110
0
  int _i;
111
0
#if 1 /* anything that can fail? */
112
0
  unsigned _fail = 0, _failcnt = 0;
113
0
#endif
114
0
  long buckets = 0;
115
0
  const char *buckets_str = NULL;
116
0
  long idle_timer = 0;
117
0
  const char *idle_timer_str = NULL;
118
0
  long unbalanced_timer = 0;
119
0
  const char *unbalanced_timer_str = NULL;
120
121
0
  for (_i = 0; _i < argc; _i++) {
122
0
    if (!argv[_i]->varname)
123
0
      continue;
124
0
#if 1 /* anything that can fail? */
125
0
    _fail = 0;
126
0
#endif
127
128
0
    if (!strcmp(argv[_i]->varname, "buckets")) {
129
0
      buckets_str = argv[_i]->arg;
130
0
      char *_end;
131
0
      buckets = strtol(argv[_i]->arg, &_end, 10);
132
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
133
0
    }
134
0
    if (!strcmp(argv[_i]->varname, "idle_timer")) {
135
0
      idle_timer_str = argv[_i]->arg;
136
0
      char *_end;
137
0
      idle_timer = strtol(argv[_i]->arg, &_end, 10);
138
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
139
0
    }
140
0
    if (!strcmp(argv[_i]->varname, "unbalanced_timer")) {
141
0
      unbalanced_timer_str = argv[_i]->arg;
142
0
      char *_end;
143
0
      unbalanced_timer = strtol(argv[_i]->arg, &_end, 10);
144
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
145
0
    }
146
0
#if 1 /* anything that can fail? */
147
0
    if (_fail)
148
0
      vty_out (vty, "%% invalid input for %s: %s\n",
149
0
           argv[_i]->varname, argv[_i]->arg);
150
0
    _failcnt += _fail;
151
0
#endif
152
0
  }
153
0
#if 1 /* anything that can fail? */
154
0
  if (_failcnt)
155
0
    return CMD_WARNING;
156
0
#endif
157
0
#endif
158
0
  if (!buckets_str) {
159
0
    vty_out(vty, "Internal CLI error [%s]\n", "buckets_str");
160
0
    return CMD_WARNING;
161
0
  }
162
0
  if (!idle_timer_str) {
163
0
    vty_out(vty, "Internal CLI error [%s]\n", "idle_timer_str");
164
0
    return CMD_WARNING;
165
0
  }
166
0
  if (!unbalanced_timer_str) {
167
0
    vty_out(vty, "Internal CLI error [%s]\n", "unbalanced_timer_str");
168
0
    return CMD_WARNING;
169
0
  }
170
171
0
  return nexthop_group_resilience_magic(self, vty, argc, argv, buckets, buckets_str, idle_timer, idle_timer_str, unbalanced_timer, unbalanced_timer_str);
172
0
}
173
174
/* no_nexthop_group_resilience => "no resilient [buckets (1-256) idle-timer (1-4294967295) unbalanced-timer (1-4294967295)]" */
175
DEFUN_CMD_FUNC_DECL(no_nexthop_group_resilience)
176
#define funcdecl_no_nexthop_group_resilience static int no_nexthop_group_resilience_magic(\
177
  const struct cmd_element *self __attribute__ ((unused)),\
178
  struct vty *vty __attribute__ ((unused)),\
179
  int argc __attribute__ ((unused)),\
180
  struct cmd_token *argv[] __attribute__ ((unused)),\
181
  long buckets,\
182
  const char * buckets_str __attribute__ ((unused)),\
183
  long idle_timer,\
184
  const char * idle_timer_str __attribute__ ((unused)),\
185
  long unbalanced_timer,\
186
  const char * unbalanced_timer_str __attribute__ ((unused)))
187
funcdecl_no_nexthop_group_resilience;
188
DEFUN_CMD_FUNC_TEXT(no_nexthop_group_resilience)
189
0
{
190
0
#if 3 /* anything to parse? */
191
0
  int _i;
192
0
#if 1 /* anything that can fail? */
193
0
  unsigned _fail = 0, _failcnt = 0;
194
0
#endif
195
0
  long buckets = 0;
196
0
  const char *buckets_str = NULL;
197
0
  long idle_timer = 0;
198
0
  const char *idle_timer_str = NULL;
199
0
  long unbalanced_timer = 0;
200
0
  const char *unbalanced_timer_str = NULL;
201
202
0
  for (_i = 0; _i < argc; _i++) {
203
0
    if (!argv[_i]->varname)
204
0
      continue;
205
0
#if 1 /* anything that can fail? */
206
0
    _fail = 0;
207
0
#endif
208
209
0
    if (!strcmp(argv[_i]->varname, "buckets")) {
210
0
      buckets_str = argv[_i]->arg;
211
0
      char *_end;
212
0
      buckets = strtol(argv[_i]->arg, &_end, 10);
213
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
214
0
    }
215
0
    if (!strcmp(argv[_i]->varname, "idle_timer")) {
216
0
      idle_timer_str = argv[_i]->arg;
217
0
      char *_end;
218
0
      idle_timer = strtol(argv[_i]->arg, &_end, 10);
219
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
220
0
    }
221
0
    if (!strcmp(argv[_i]->varname, "unbalanced_timer")) {
222
0
      unbalanced_timer_str = argv[_i]->arg;
223
0
      char *_end;
224
0
      unbalanced_timer = strtol(argv[_i]->arg, &_end, 10);
225
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
226
0
    }
227
0
#if 1 /* anything that can fail? */
228
0
    if (_fail)
229
0
      vty_out (vty, "%% invalid input for %s: %s\n",
230
0
           argv[_i]->varname, argv[_i]->arg);
231
0
    _failcnt += _fail;
232
0
#endif
233
0
  }
234
0
#if 1 /* anything that can fail? */
235
0
  if (_failcnt)
236
0
    return CMD_WARNING;
237
0
#endif
238
0
#endif
239
240
0
  return no_nexthop_group_resilience_magic(self, vty, argc, argv, buckets, buckets_str, idle_timer, idle_timer_str, unbalanced_timer, unbalanced_timer_str);
241
0
}
242
243
/* ecmp_nexthops => "[no] nexthop        <    <A.B.C.D|X:X::X:X>$addr [INTERFACE$intf [onlink$onlink]]    |INTERFACE$intf > [{     nexthop-vrf NAME$vrf_name     |label WORD     |vni (1-16777215)            |weight (1-255)            |backup-idx WORD   }]" */
244
DEFUN_CMD_FUNC_DECL(ecmp_nexthops)
245
#define funcdecl_ecmp_nexthops static int ecmp_nexthops_magic(\
246
  const struct cmd_element *self __attribute__ ((unused)),\
247
  struct vty *vty __attribute__ ((unused)),\
248
  int argc __attribute__ ((unused)),\
249
  struct cmd_token *argv[] __attribute__ ((unused)),\
250
  const char * no,\
251
  const union sockunion * addr,\
252
  const char * addr_str __attribute__ ((unused)),\
253
  const char * intf,\
254
  const char * onlink,\
255
  const char * vrf_name,\
256
  const char * label,\
257
  long vni,\
258
  const char * vni_str __attribute__ ((unused)),\
259
  long weight,\
260
  const char * weight_str __attribute__ ((unused)),\
261
  const char * backup_idx)
262
funcdecl_ecmp_nexthops;
263
DEFUN_CMD_FUNC_TEXT(ecmp_nexthops)
264
0
{
265
0
#if 9 /* anything to parse? */
266
0
  int _i;
267
0
#if 1 /* anything that can fail? */
268
0
  unsigned _fail = 0, _failcnt = 0;
269
0
#endif
270
0
  const char *no = NULL;
271
0
  union sockunion s__addr = { .sa.sa_family = AF_UNSPEC }, *addr = NULL;
272
0
  const char *addr_str = NULL;
273
0
  const char *intf = NULL;
274
0
  const char *onlink = NULL;
275
0
  const char *vrf_name = NULL;
276
0
  const char *label = NULL;
277
0
  long vni = 0;
278
0
  const char *vni_str = NULL;
279
0
  long weight = 0;
280
0
  const char *weight_str = NULL;
281
0
  const char *backup_idx = NULL;
282
283
0
  for (_i = 0; _i < argc; _i++) {
284
0
    if (!argv[_i]->varname)
285
0
      continue;
286
0
#if 1 /* anything that can fail? */
287
0
    _fail = 0;
288
0
#endif
289
290
0
    if (!strcmp(argv[_i]->varname, "no")) {
291
0
      no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
292
0
    }
293
0
    if (!strcmp(argv[_i]->varname, "addr")) {
294
0
      addr_str = argv[_i]->arg;
295
0
      if (argv[_i]->text[0] == 'X') {
296
0
        s__addr.sa.sa_family = AF_INET6;
297
0
        _fail = !inet_pton(AF_INET6, argv[_i]->arg, &s__addr.sin6.sin6_addr);
298
0
        addr = &s__addr;
299
0
      } else {
300
0
        s__addr.sa.sa_family = AF_INET;
301
0
        _fail = !inet_aton(argv[_i]->arg, &s__addr.sin.sin_addr);
302
0
        addr = &s__addr;
303
0
      }
304
0
    }
305
0
    if (!strcmp(argv[_i]->varname, "intf")) {
306
0
      intf = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
307
0
    }
308
0
    if (!strcmp(argv[_i]->varname, "onlink")) {
309
0
      onlink = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
310
0
    }
311
0
    if (!strcmp(argv[_i]->varname, "vrf_name")) {
312
0
      vrf_name = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
313
0
    }
314
0
    if (!strcmp(argv[_i]->varname, "label")) {
315
0
      label = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
316
0
    }
317
0
    if (!strcmp(argv[_i]->varname, "vni")) {
318
0
      vni_str = argv[_i]->arg;
319
0
      char *_end;
320
0
      vni = strtol(argv[_i]->arg, &_end, 10);
321
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
322
0
    }
323
0
    if (!strcmp(argv[_i]->varname, "weight")) {
324
0
      weight_str = argv[_i]->arg;
325
0
      char *_end;
326
0
      weight = strtol(argv[_i]->arg, &_end, 10);
327
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
328
0
    }
329
0
    if (!strcmp(argv[_i]->varname, "backup_idx")) {
330
0
      backup_idx = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
331
0
    }
332
0
#if 1 /* anything that can fail? */
333
0
    if (_fail)
334
0
      vty_out (vty, "%% invalid input for %s: %s\n",
335
0
           argv[_i]->varname, argv[_i]->arg);
336
0
    _failcnt += _fail;
337
0
#endif
338
0
  }
339
0
#if 1 /* anything that can fail? */
340
0
  if (_failcnt)
341
0
    return CMD_WARNING;
342
0
#endif
343
0
#endif
344
345
0
  return ecmp_nexthops_magic(self, vty, argc, argv, no, addr, addr_str, intf, onlink, vrf_name, label, vni, vni_str, weight, weight_str, backup_idx);
346
0
}
347