Coverage Report

Created: 2025-12-05 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/frr/zebra/zebra_srv6_vty_clippy.c
Line
Count
Source
1
/* locator_prefix => "prefix X:X::X:X/M$prefix [block-len (16-64)$block_bit_len]            [node-len (16-64)$node_bit_len] [func-bits (0-64)$func_bit_len]" */
2
DEFUN_CMD_FUNC_DECL(locator_prefix)
3
#define funcdecl_locator_prefix static int locator_prefix_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 struct prefix_ipv6 * prefix,\
9
  const char * prefix_str __attribute__ ((unused)),\
10
  long block_bit_len,\
11
  const char * block_bit_len_str __attribute__ ((unused)),\
12
  long node_bit_len,\
13
  const char * node_bit_len_str __attribute__ ((unused)),\
14
  long func_bit_len,\
15
  const char * func_bit_len_str __attribute__ ((unused)))
16
funcdecl_locator_prefix;
17
DEFUN_CMD_FUNC_TEXT(locator_prefix)
18
0
{
19
0
#if 4 /* anything to parse? */
20
0
  int _i;
21
0
#if 1 /* anything that can fail? */
22
0
  unsigned _fail = 0, _failcnt = 0;
23
0
#endif
24
0
  struct prefix_ipv6 prefix = { };
25
0
  const char *prefix_str = NULL;
26
0
  long block_bit_len = 0;
27
0
  const char *block_bit_len_str = NULL;
28
0
  long node_bit_len = 0;
29
0
  const char *node_bit_len_str = NULL;
30
0
  long func_bit_len = 0;
31
0
  const char *func_bit_len_str = NULL;
32
33
0
  for (_i = 0; _i < argc; _i++) {
34
0
    if (!argv[_i]->varname)
35
0
      continue;
36
0
#if 1 /* anything that can fail? */
37
0
    _fail = 0;
38
0
#endif
39
40
0
    if (!strcmp(argv[_i]->varname, "prefix")) {
41
0
      prefix_str = argv[_i]->arg;
42
0
      _fail = !str2prefix_ipv6(argv[_i]->arg, &prefix);
43
0
    }
44
0
    if (!strcmp(argv[_i]->varname, "block_bit_len")) {
45
0
      block_bit_len_str = argv[_i]->arg;
46
0
      char *_end;
47
0
      block_bit_len = strtol(argv[_i]->arg, &_end, 10);
48
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
49
0
    }
50
0
    if (!strcmp(argv[_i]->varname, "node_bit_len")) {
51
0
      node_bit_len_str = argv[_i]->arg;
52
0
      char *_end;
53
0
      node_bit_len = strtol(argv[_i]->arg, &_end, 10);
54
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
55
0
    }
56
0
    if (!strcmp(argv[_i]->varname, "func_bit_len")) {
57
0
      func_bit_len_str = argv[_i]->arg;
58
0
      char *_end;
59
0
      func_bit_len = strtol(argv[_i]->arg, &_end, 10);
60
0
      _fail = (_end == argv[_i]->arg) || (*_end != '\0');
61
0
    }
62
0
#if 1 /* anything that can fail? */
63
0
    if (_fail)
64
0
      vty_out (vty, "%% invalid input for %s: %s\n",
65
0
           argv[_i]->varname, argv[_i]->arg);
66
0
    _failcnt += _fail;
67
0
#endif
68
0
  }
69
0
#if 1 /* anything that can fail? */
70
0
  if (_failcnt)
71
0
    return CMD_WARNING;
72
0
#endif
73
0
#endif
74
0
  if (!prefix_str) {
75
0
    vty_out(vty, "Internal CLI error [%s]\n", "prefix_str");
76
0
    return CMD_WARNING;
77
0
  }
78
79
0
  return locator_prefix_magic(self, vty, argc, argv, &prefix, prefix_str, block_bit_len, block_bit_len_str, node_bit_len, node_bit_len_str, func_bit_len, func_bit_len_str);
80
0
}
81
82
/* locator_behavior => "[no] behavior usid" */
83
DEFUN_CMD_FUNC_DECL(locator_behavior)
84
#define funcdecl_locator_behavior static int locator_behavior_magic(\
85
  const struct cmd_element *self __attribute__ ((unused)),\
86
  struct vty *vty __attribute__ ((unused)),\
87
  int argc __attribute__ ((unused)),\
88
  struct cmd_token *argv[] __attribute__ ((unused)),\
89
  const char * no)
90
funcdecl_locator_behavior;
91
DEFUN_CMD_FUNC_TEXT(locator_behavior)
92
0
{
93
0
#if 1 /* anything to parse? */
94
0
  int _i;
95
#if 0 /* anything that can fail? */
96
  unsigned _fail = 0, _failcnt = 0;
97
#endif
98
0
  const char *no = NULL;
99
100
0
  for (_i = 0; _i < argc; _i++) {
101
0
    if (!argv[_i]->varname)
102
0
      continue;
103
#if 0 /* anything that can fail? */
104
    _fail = 0;
105
#endif
106
107
0
    if (!strcmp(argv[_i]->varname, "no")) {
108
0
      no = (argv[_i]->type == WORD_TKN) ? argv[_i]->text : argv[_i]->arg;
109
0
    }
110
#if 0 /* anything that can fail? */
111
    if (_fail)
112
      vty_out (vty, "%% invalid input for %s: %s\n",
113
           argv[_i]->varname, argv[_i]->arg);
114
    _failcnt += _fail;
115
#endif
116
0
  }
117
#if 0 /* anything that can fail? */
118
  if (_failcnt)
119
    return CMD_WARNING;
120
#endif
121
0
#endif
122
123
0
  return locator_behavior_magic(self, vty, argc, argv, no);
124
0
}
125