~vcs-imports/busybox/trunk

« back to all changes in this revision

Viewing changes to networking/brctl.c

  • Committer: Denys Vlasenko
  • Author(s): Christian Franke
  • Date: 2023-11-13 10:32:35 UTC
  • Revision ID: git-v1:a63b60bdd6fa26b867c80d44074118babbae7ffd
Cygwin: regenerate defconfig

Signed-off-by: Christian Franke <christian.franke@t-online.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11
11
 */
12
12
//config:config BRCTL
13
 
//config:       bool "brctl (4.7 kb)"
 
13
//config:       bool "brctl (9.9 kb)"
14
14
//config:       default y
15
 
//config:       select PLATFORM_LINUX
16
15
//config:       help
17
16
//config:       Manage ethernet bridges.
18
17
//config:       Supports addbr/delbr and addif/delif.
90
89
{
91
90
        double dd;
92
91
        char *endptr;
 
92
//TODO: needs setlocale(LC_NUMERIC, "C")?
93
93
        dd = /*bb_*/strtod(time_str, &endptr);
94
94
        if (endptr == time_str || dd < 0)
95
95
                bb_error_msg_and_die(bb_msg_invalid_arg_to, time_str, "timespec");
107
107
 
108
108
#define filedata bb_common_bufsiz1
109
109
 
110
 
#if ENABLE_FEATURE_BRCTL_SHOW
 
110
#if ENABLE_FEATURE_BRCTL_SHOW || ENABLE_FEATURE_BRCTL_FANCY
111
111
static int read_file(const char *name)
112
112
{
113
113
        int n = open_read_close(name, filedata, COMMON_BUFSIZE - 1);
120
120
        }
121
121
        return n;
122
122
}
 
123
#endif
123
124
 
 
125
#if ENABLE_FEATURE_BRCTL_SHOW
124
126
/* NB: we are in /sys/class/net
125
127
 */
126
128
static int show_bridge(const char *name, int need_hdr)
155
157
        else
156
158
        if (LONE_CHAR(filedata, '1'))
157
159
                strcpy(filedata, "yes");
158
 
        fputs(filedata, stdout);
 
160
        fputs_stdout(filedata);
159
161
 
160
162
        /* sfx points past "BR/bridge/", turn it into "BR/brif": */
161
163
        sfx[-4] = 'f'; sfx[-3] = '\0';
316
318
        printf(fmt, xstrtou(filedata, 0));
317
319
}
318
320
 
319
 
static void show_bridge_port(const char *name)
 
321
static NOINLINE void show_bridge_port(const char *name)
320
322
{
321
323
        char pathbuf[IFNAMSIZ + sizeof("/brport/forward_delay_timer") + 8];
322
324
        char *sfx;
536
538
                DIR *net;
537
539
                struct dirent *ent;
538
540
                int need_hdr = 1;
539
 
                int exitcode = EXIT_SUCCESS;
 
541
                exitcode_t exitcode = EXIT_SUCCESS;
540
542
 
541
543
                if (*argv) {
542
544
                        /* "show BR1 BR2 BR3" */
591
593
                return EXIT_SUCCESS;
592
594
        }
593
595
 
 
596
#if ENABLE_FEATURE_BRCTL_FANCY
594
597
        if (key == ARG_showmacs) {
595
598
                show_bridge_macs(br);
596
599
                return EXIT_SUCCESS;
599
602
                show_bridge_stp(br);
600
603
                return EXIT_SUCCESS;
601
604
        }
 
605
#endif
602
606
 
603
607
        if (!*argv) /* All of the below need at least two arguments */
604
608
                bb_show_usage();