aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/usage.h4
-rw-r--r--networking/nameif.c12
2 files changed, 5 insertions, 11 deletions
diff --git a/include/usage.h b/include/usage.h
index aaac7dfd9..e5aad2f4f 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1505,11 +1505,11 @@
1505 "$ mv /tmp/foo /bin/bar\n" 1505 "$ mv /tmp/foo /bin/bar\n"
1506 1506
1507#define nameif_trivial_usage \ 1507#define nameif_trivial_usage \
1508 "[OPTIONS] [{IFNAME MACADDR}]" 1508 "[-s] [-c FILE] [{IFNAME MACADDR}]"
1509#define nameif_full_usage \ 1509#define nameif_full_usage \
1510 "Nameif renaming network interface while it in the down state.\n\n" \ 1510 "Nameif renaming network interface while it in the down state.\n\n" \
1511 "Options:\n" \ 1511 "Options:\n" \
1512 "\t-c FILE\t\tUse another configuration file (default is /etc/mactab)\n" \ 1512 "\t-c FILE\t\tUse configuration file (default is /etc/mactab)\n" \
1513 "\t-s\t\tUse syslog (LOCAL0 facility).\n" \ 1513 "\t-s\t\tUse syslog (LOCAL0 facility).\n" \
1514 "\tIFNAME MACADDR\tnew_interface_name interface_mac_address\n" 1514 "\tIFNAME MACADDR\tnew_interface_name interface_mac_address\n"
1515#define nameif_example_usage \ 1515#define nameif_example_usage \
diff --git a/networking/nameif.c b/networking/nameif.c
index cd18b4c18..f3b927158 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -36,7 +36,7 @@
36#include "busybox.h" 36#include "busybox.h"
37 37
38/* take from linux/sockios.h */ 38/* take from linux/sockios.h */
39#define SIOCSIFNAME 0x8923 /* set interface name */ 39#define SIOCSIFNAME 0x8923 /* set interface name */
40 40
41/* Octets in one ethernet addr, from <linux/if_ether.h> */ 41/* Octets in one ethernet addr, from <linux/if_ether.h> */
42#define ETH_ALEN 6 42#define ETH_ALEN 6
@@ -101,13 +101,8 @@ int nameif_main(int argc, char **argv)
101 int if_index = 1; 101 int if_index = 1;
102 mactable_t *ch; 102 mactable_t *ch;
103 103
104 static struct option opts[] = {
105 {"syslog", 0, NULL, 's'},
106 {"configfile", 1, NULL, 'c'},
107 {NULL},
108 };
109 104
110 while ((opt = getopt_long(argc, argv, "c:s", opts, NULL)) != -1) { 105 while ((opt = getopt(argc, argv, "c:s")) != -1) {
111 switch (opt) { 106 switch (opt) {
112 case 'c': 107 case 'c':
113 fname = optarg; 108 fname = optarg;
@@ -152,8 +147,7 @@ int nameif_main(int argc, char **argv)
152 ch = xcalloc(1, sizeof(mactable_t)); 147 ch = xcalloc(1, sizeof(mactable_t));
153 ch->ifname = xstrndup(line_ptr, name_length); 148 ch->ifname = xstrndup(line_ptr, name_length);
154 if (name_length > IF_NAMESIZE) 149 if (name_length > IF_NAMESIZE)
155 serror("interface name `%s' too long", 150 serror("interface name `%s' too long", ch->ifname);
156 ch->ifname);
157 line_ptr += name_length; 151 line_ptr += name_length;
158 line_ptr += strspn(line_ptr, " \t"); 152 line_ptr += strspn(line_ptr, " \t");
159 name_length = strspn(line_ptr, "0123456789ABCDEFabcdef:"); 153 name_length = strspn(line_ptr, "0123456789ABCDEFabcdef:");