summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-29 23:43:18 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-29 23:43:18 +0000
commit89ef65f02463b27313ff0eba806aa6e4aec10716 (patch)
tree70eab3e72843b1418ef3d88437c1f1a19169bda8 /networking
parentab2aea44479fd6f519bccd651a37f30e792b7593 (diff)
downloadbusybox-w32-89ef65f02463b27313ff0eba806aa6e4aec10716.tar.gz
busybox-w32-89ef65f02463b27313ff0eba806aa6e4aec10716.tar.bz2
busybox-w32-89ef65f02463b27313ff0eba806aa6e4aec10716.zip
preparatory patch for -Wwrite-strings #5
Diffstat (limited to 'networking')
-rw-r--r--networking/ifupdown.c24
-rw-r--r--networking/libiproute/ip_common.h3
-rw-r--r--networking/libiproute/ip_parse_common_args.c2
-rw-r--r--networking/libiproute/iplink.c2
-rw-r--r--networking/libiproute/iproute.c16
-rw-r--r--networking/libiproute/utils.h3
-rw-r--r--networking/ping.c6
-rw-r--r--networking/zcip.c6
8 files changed, 26 insertions, 36 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 4ec3d37a8..834c7fa7d 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -36,22 +36,19 @@ struct interface_defn_t;
36 36
37typedef int execfn(char *command); 37typedef int execfn(char *command);
38 38
39struct method_t 39struct method_t {
40{ 40 const char *name;
41 char *name;
42 int (*up)(struct interface_defn_t *ifd, execfn *e); 41 int (*up)(struct interface_defn_t *ifd, execfn *e);
43 int (*down)(struct interface_defn_t *ifd, execfn *e); 42 int (*down)(struct interface_defn_t *ifd, execfn *e);
44}; 43};
45 44
46struct address_family_t 45struct address_family_t {
47{ 46 const char *name;
48 char *name;
49 int n_methods; 47 int n_methods;
50 const struct method_t *method; 48 const struct method_t *method;
51}; 49};
52 50
53struct mapping_defn_t 51struct mapping_defn_t {
54{
55 struct mapping_defn_t *next; 52 struct mapping_defn_t *next;
56 53
57 int max_matches; 54 int max_matches;
@@ -65,14 +62,12 @@ struct mapping_defn_t
65 char **mapping; 62 char **mapping;
66}; 63};
67 64
68struct variable_t 65struct variable_t {
69{
70 char *name; 66 char *name;
71 char *value; 67 char *value;
72}; 68};
73 69
74struct interface_defn_t 70struct interface_defn_t {
75{
76 const struct address_family_t *address_family; 71 const struct address_family_t *address_family;
77 const struct method_t *method; 72 const struct method_t *method;
78 73
@@ -82,8 +77,7 @@ struct interface_defn_t
82 struct variable_t *option; 77 struct variable_t *option;
83}; 78};
84 79
85struct interfaces_file_t 80struct interfaces_file_t {
86{
87 llist_t *autointerfaces; 81 llist_t *autointerfaces;
88 llist_t *ifaces; 82 llist_t *ifaces;
89 struct mapping_defn_t *mappings; 83 struct mapping_defn_t *mappings;
@@ -105,7 +99,7 @@ enum {
105 99
106static char **my_environ; 100static char **my_environ;
107 101
108static char *startup_PATH; 102static const char *startup_PATH;
109 103
110#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6 104#if ENABLE_FEATURE_IFUPDOWN_IPV4 || ENABLE_FEATURE_IFUPDOWN_IPV6
111 105
diff --git a/networking/libiproute/ip_common.h b/networking/libiproute/ip_common.h
index 15291780e..05a6a95f5 100644
--- a/networking/libiproute/ip_common.h
+++ b/networking/libiproute/ip_common.h
@@ -14,7 +14,8 @@
14#endif 14#endif
15 15
16extern int preferred_family; 16extern int preferred_family;
17extern char * _SL_; 17//FIXME! Appears in two .h files!
18extern const char * _SL_;
18 19
19extern void ip_parse_common_args(int *argcp, char ***argvp); 20extern void ip_parse_common_args(int *argcp, char ***argvp);
20extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 21extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c
index 64386c9dd..00a891232 100644
--- a/networking/libiproute/ip_parse_common_args.c
+++ b/networking/libiproute/ip_parse_common_args.c
@@ -24,7 +24,7 @@
24 24
25int preferred_family = AF_UNSPEC; 25int preferred_family = AF_UNSPEC;
26int oneline = 0; 26int oneline = 0;
27char * _SL_ = NULL; 27const char * _SL_ = NULL;
28 28
29void ip_parse_common_args(int *argcp, char ***argvp) 29void ip_parse_common_args(int *argcp, char ***argvp)
30{ 30{
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index ae41ab308..cb6ee962b 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -25,7 +25,7 @@
25/* take from linux/sockios.h */ 25/* take from linux/sockios.h */
26#define SIOCSIFNAME 0x8923 /* set interface name */ 26#define SIOCSIFNAME 0x8923 /* set interface name */
27 27
28static int on_off(char *msg) 28static int on_off(const char *msg)
29{ 29{
30 bb_error_msg("error: argument of \"%s\" must be \"on\" or \"off\"", msg); 30 bb_error_msg("error: argument of \"%s\" must be \"on\" or \"off\"", msg);
31 return -1; 31 return -1;
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index c8a58c11c..27d37ac79 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -469,21 +469,15 @@ static int rtnl_rtcache_request(struct rtnl_handle *rth, int family)
469 469
470static int iproute_flush_cache(void) 470static int iproute_flush_cache(void)
471{ 471{
472#define ROUTE_FLUSH_PATH "/proc/sys/net/ipv4/route/flush" 472 static const char fn[] = "/proc/sys/net/ipv4/route/flush";
473 473 int flush_fd = open(fn, O_WRONLY);
474 int len;
475 int flush_fd = open (ROUTE_FLUSH_PATH, O_WRONLY);
476 char *buffer = "-1";
477
478 if (flush_fd < 0) { 474 if (flush_fd < 0) {
479 fprintf(stderr, "Cannot open \"%s\"\n", ROUTE_FLUSH_PATH); 475 bb_perror_msg("cannot open '%s'", fn);
480 return -1; 476 return -1;
481 } 477 }
482 478
483 len = strlen (buffer); 479 if (write(flush_fd, "-1", 2) < 2) {
484 480 bb_perror_msg("cannot flush routing cache");
485 if ((write (flush_fd, (void *)buffer, len)) < len) {
486 fprintf(stderr, "Cannot flush routing cache\n");
487 return -1; 481 return -1;
488 } 482 }
489 close(flush_fd); 483 close(flush_fd);
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index ebf2af194..556541f79 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -14,7 +14,8 @@ extern int show_details;
14extern int show_raw; 14extern int show_raw;
15extern int resolve_hosts; 15extern int resolve_hosts;
16extern int oneline; 16extern int oneline;
17extern char * _SL_; 17//FIXME! Appears in two .h files!
18extern const char * _SL_;
18 19
19#ifndef IPPROTO_ESP 20#ifndef IPPROTO_ESP
20#define IPPROTO_ESP 50 21#define IPPROTO_ESP 50
diff --git a/networking/ping.c b/networking/ping.c
index 52e48867e..53aabb6d7 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -369,7 +369,7 @@ static void sendping6(int junk ATTRIBUTE_UNUSED)
369} 369}
370#endif 370#endif
371 371
372static char *icmp_type_name(int id) 372static const char *icmp_type_name(int id)
373{ 373{
374 switch (id) { 374 switch (id) {
375 case ICMP_ECHOREPLY: return "Echo Reply"; 375 case ICMP_ECHOREPLY: return "Echo Reply";
@@ -400,7 +400,7 @@ static char *icmp_type_name(int id)
400#ifndef MLD_LISTENER_REDUCTION 400#ifndef MLD_LISTENER_REDUCTION
401# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION 401# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
402#endif 402#endif
403static char *icmp6_type_name(int id) 403static const char *icmp6_type_name(int id)
404{ 404{
405 switch (id) { 405 switch (id) {
406 case ICMP6_DST_UNREACH: return "Destination Unreachable"; 406 case ICMP6_DST_UNREACH: return "Destination Unreachable";
@@ -761,7 +761,7 @@ int ping_main(int argc, char **argv)
761#if ENABLE_PING6 761#if ENABLE_PING6
762int ping6_main(int argc, char **argv) 762int ping6_main(int argc, char **argv)
763{ 763{
764 argv[0] = "-6"; 764 argv[0] = (char*)"-6";
765 return ping_main(argc + 1, argv - 1); 765 return ping_main(argc + 1, argv - 1);
766} 766}
767#endif 767#endif
diff --git a/networking/zcip.c b/networking/zcip.c
index 5d57c4287..b56870652 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -130,10 +130,10 @@ static void arp(int fd, struct sockaddr *saddr, int op,
130/** 130/**
131 * Run a script. 131 * Run a script.
132 */ 132 */
133static int run(char *script, char *arg, char *intf, struct in_addr *ip) 133static int run(const char *script, const char *arg, const char *intf, struct in_addr *ip)
134{ 134{
135 int pid, status; 135 int pid, status;
136 char *why; 136 const char *why;
137 137
138 if(1) { //always true: if (script != NULL) 138 if(1) { //always true: if (script != NULL)
139 VDBG("%s run %s %s\n", intf, script, arg); 139 VDBG("%s run %s %s\n", intf, script, arg);
@@ -207,7 +207,7 @@ static int state = PROBE;
207int zcip_main(int argc, char *argv[]) 207int zcip_main(int argc, char *argv[])
208{ 208{
209 struct ether_addr eth_addr; 209 struct ether_addr eth_addr;
210 char *why; 210 const char *why;
211 int fd; 211 int fd;
212 212
213 // parse commandline: prog [options] ifname script 213 // parse commandline: prog [options] ifname script