blob: b7320966a8cba4799449f11560a7146f61b045f0 [file] [log] [blame]
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Small implementation of brctl for busybox.
4 *
Bernhard Reutner-Fischer6c4dade2008-09-25 12:13:34 +00005 * Copyright (C) 2008 by Bernhard Reutner-Fischer
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +00006 *
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +00007 * Some helper functions from bridge-utils are
8 * Copyright (C) 2000 Lennert Buytenhek
9 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +020010 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +000011 */
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +000012/* This applet currently uses only the ioctl interface and no sysfs at all.
13 * At the time of this writing this was considered a feature.
14 */
Pere Orga5bc8c002011-04-11 03:29:49 +020015
16//usage:#define brctl_trivial_usage
17//usage: "COMMAND [BRIDGE [INTERFACE]]"
18//usage:#define brctl_full_usage "\n\n"
19//usage: "Manage ethernet bridges\n"
20//usage: "\nCommands:"
21//usage: IF_FEATURE_BRCTL_SHOW(
22//usage: "\n show Show a list of bridges"
23//usage: )
24//usage: "\n addbr BRIDGE Create BRIDGE"
25//usage: "\n delbr BRIDGE Delete BRIDGE"
26//usage: "\n addif BRIDGE IFACE Add IFACE to BRIDGE"
27//usage: "\n delif BRIDGE IFACE Delete IFACE from BRIDGE"
28//usage: IF_FEATURE_BRCTL_FANCY(
29//usage: "\n setageing BRIDGE TIME Set ageing time"
30//usage: "\n setfd BRIDGE TIME Set bridge forward delay"
31//usage: "\n sethello BRIDGE TIME Set hello time"
32//usage: "\n setmaxage BRIDGE TIME Set max message age"
33//usage: "\n setpathcost BRIDGE COST Set path cost"
34//usage: "\n setportprio BRIDGE PRIO Set port priority"
35//usage: "\n setbridgeprio BRIDGE PRIO Set bridge priority"
36//usage: "\n stp BRIDGE [1/yes/on|0/no/off] STP on/off"
37//usage: )
38
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +000039#include "libbb.h"
40#include <linux/sockios.h>
41#include <net/if.h>
42
Denis Vlasenko802cab12009-01-31 20:08:21 +000043#ifndef SIOCBRADDBR
44# define SIOCBRADDBR BRCTL_ADD_BRIDGE
45#endif
46#ifndef SIOCBRDELBR
47# define SIOCBRDELBR BRCTL_DEL_BRIDGE
48#endif
49#ifndef SIOCBRADDIF
50# define SIOCBRADDIF BRCTL_ADD_IF
51#endif
52#ifndef SIOCBRDELIF
53# define SIOCBRDELIF BRCTL_DEL_IF
54#endif
55
56
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +000057/* Maximum number of ports supported per bridge interface. */
58#ifndef MAX_PORTS
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +010059# define MAX_PORTS 32
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +000060#endif
61
62/* Use internal number parsing and not the "exact" conversion. */
63/* #define BRCTL_USE_INTERNAL 0 */ /* use exact conversion */
64#define BRCTL_USE_INTERNAL 1
65
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +000066#if ENABLE_FEATURE_BRCTL_FANCY
Denys Vlasenko5fa6d1a2015-10-05 11:15:43 +020067/* #include <linux/if_bridge.h>
68 * breaks on musl: we already included netinet/in.h in libbb.h,
69 * if we include <linux/if_bridge.h> here, we get this:
70 * In file included from /usr/include/linux/if_bridge.h:18,
71 * from networking/brctl.c:67:
72 * /usr/include/linux/in6.h:32: error: redefinition of 'struct in6_addr'
73 * /usr/include/linux/in6.h:49: error: redefinition of 'struct sockaddr_in6'
74 * /usr/include/linux/in6.h:59: error: redefinition of 'struct ipv6_mreq'
75 */
76/* From <linux/if_bridge.h> */
77#define BRCTL_GET_VERSION 0
78#define BRCTL_GET_BRIDGES 1
79#define BRCTL_ADD_BRIDGE 2
80#define BRCTL_DEL_BRIDGE 3
81#define BRCTL_ADD_IF 4
82#define BRCTL_DEL_IF 5
83#define BRCTL_GET_BRIDGE_INFO 6
84#define BRCTL_GET_PORT_LIST 7
85#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
86#define BRCTL_SET_BRIDGE_HELLO_TIME 9
87#define BRCTL_SET_BRIDGE_MAX_AGE 10
88#define BRCTL_SET_AGEING_TIME 11
89#define BRCTL_SET_GC_INTERVAL 12
90#define BRCTL_GET_PORT_INFO 13
91#define BRCTL_SET_BRIDGE_STP_STATE 14
92#define BRCTL_SET_BRIDGE_PRIORITY 15
93#define BRCTL_SET_PORT_PRIORITY 16
94#define BRCTL_SET_PATH_COST 17
95#define BRCTL_GET_FDB_ENTRIES 18
96struct __bridge_info {
97 uint64_t designated_root;
98 uint64_t bridge_id;
99 uint32_t root_path_cost;
100 uint32_t max_age;
101 uint32_t hello_time;
102 uint32_t forward_delay;
103 uint32_t bridge_max_age;
104 uint32_t bridge_hello_time;
105 uint32_t bridge_forward_delay;
106 uint8_t topology_change;
107 uint8_t topology_change_detected;
108 uint8_t root_port;
109 uint8_t stp_enabled;
110 uint32_t ageing_time;
111 uint32_t gc_interval;
112 uint32_t hello_timer_value;
113 uint32_t tcn_timer_value;
114 uint32_t topology_change_timer_value;
115 uint32_t gc_timer_value;
116};
117/* end <linux/if_bridge.h> */
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000118
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000119/* FIXME: These 4 funcs are not really clean and could be improved */
Denys Vlasenko49b8e722012-06-10 14:16:16 +0200120static ALWAYS_INLINE void bb_strtotimeval(struct timeval *tv,
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000121 const char *time_str)
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000122{
123 double secs;
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100124# if BRCTL_USE_INTERNAL
Maciek Borzecki46abfc02010-03-16 12:41:29 +0100125 char *endptr;
126 secs = /*bb_*/strtod(time_str, &endptr);
127 if (endptr == time_str)
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100128# else
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000129 if (sscanf(time_str, "%lf", &secs) != 1)
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100130# endif
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200131 bb_error_msg_and_die(bb_msg_invalid_arg_to, time_str, "timespec");
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000132 tv->tv_sec = secs;
133 tv->tv_usec = 1000000 * (secs - tv->tv_sec);
134}
135
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100136static ALWAYS_INLINE unsigned long tv_to_jiffies(const struct timeval *tv)
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000137{
138 unsigned long long jif;
139
140 jif = 1000000ULL * tv->tv_sec + tv->tv_usec;
141
142 return jif/10000;
143}
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000144# if 0
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100145static void jiffies_to_tv(struct timeval *tv, unsigned long jiffies)
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000146{
147 unsigned long long tvusec;
148
149 tvusec = 10000ULL*jiffies;
150 tv->tv_sec = tvusec/1000000;
151 tv->tv_usec = tvusec - 1000000 * tv->tv_sec;
152}
153# endif
154static unsigned long str_to_jiffies(const char *time_str)
155{
156 struct timeval tv;
Denys Vlasenko49b8e722012-06-10 14:16:16 +0200157 bb_strtotimeval(&tv, time_str);
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100158 return tv_to_jiffies(&tv);
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000159}
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000160
161static void arm_ioctl(unsigned long *args,
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000162 unsigned long arg0, unsigned long arg1, unsigned long arg2)
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000163{
164 args[0] = arg0;
165 args[1] = arg1;
166 args[2] = arg2;
167 args[3] = 0;
168}
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000169#endif
170
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000171
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000172int brctl_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denis Vlasenkoa60f84e2008-07-05 09:18:54 +0000173int brctl_main(int argc UNUSED_PARAM, char **argv)
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000174{
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000175 static const char keywords[] ALIGN1 =
176 "addbr\0" "delbr\0" "addif\0" "delif\0"
Denis Vlasenko5e34ff22009-04-21 11:09:40 +0000177 IF_FEATURE_BRCTL_FANCY(
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000178 "stp\0"
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000179 "setageing\0" "setfd\0" "sethello\0" "setmaxage\0"
180 "setpathcost\0" "setportprio\0" "setbridgeprio\0"
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000181 )
Nicolas Thillf47ce072012-09-25 14:06:01 +0200182 IF_FEATURE_BRCTL_SHOW("show\0");
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000183
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000184 enum { ARG_addbr = 0, ARG_delbr, ARG_addif, ARG_delif
Denis Vlasenko5e34ff22009-04-21 11:09:40 +0000185 IF_FEATURE_BRCTL_FANCY(,
Denys Vlasenko60cb48c2013-01-14 15:57:44 +0100186 ARG_stp,
187 ARG_setageing, ARG_setfd, ARG_sethello, ARG_setmaxage,
188 ARG_setpathcost, ARG_setportprio, ARG_setbridgeprio
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000189 )
Nicolas Thillf47ce072012-09-25 14:06:01 +0200190 IF_FEATURE_BRCTL_SHOW(, ARG_show)
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000191 };
192
193 int fd;
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000194 smallint key;
195 struct ifreq ifr;
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000196 char *br, *brif;
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000197
198 argv++;
199 while (*argv) {
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000200#if ENABLE_FEATURE_BRCTL_FANCY
201 int ifidx[MAX_PORTS];
202 unsigned long args[4];
203 ifr.ifr_data = (char *) &args;
204#endif
205
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000206 key = index_in_strings(keywords, *argv);
207 if (key == -1) /* no match found in keywords array, bail out. */
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200208 bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, applet_name);
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000209 argv++;
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000210 fd = xsocket(AF_INET, SOCK_STREAM, 0);
211
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000212#if ENABLE_FEATURE_BRCTL_SHOW
213 if (key == ARG_show) { /* show */
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000214 char brname[IFNAMSIZ];
215 int bridx[MAX_PORTS];
216 int i, num;
217 arm_ioctl(args, BRCTL_GET_BRIDGES,
218 (unsigned long) bridx, MAX_PORTS);
219 num = xioctl(fd, SIOCGIFBR, args);
Denys Vlasenkod60752f2015-10-07 22:42:45 +0200220 puts("bridge name\tbridge id\t\tSTP enabled\tinterfaces");
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000221 for (i = 0; i < num; i++) {
222 char ifname[IFNAMSIZ];
223 int j, tabs;
224 struct __bridge_info bi;
225 unsigned char *x;
226
227 if (!if_indextoname(bridx[i], brname))
228 bb_perror_msg_and_die("can't get bridge name for index %d", i);
Denis Vlasenko360d9662008-12-02 18:18:50 +0000229 strncpy_IFNAMSIZ(ifr.ifr_name, brname);
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000230
231 arm_ioctl(args, BRCTL_GET_BRIDGE_INFO,
232 (unsigned long) &bi, 0);
233 xioctl(fd, SIOCDEVPRIVATE, &ifr);
234 printf("%s\t\t", brname);
235
236 /* print bridge id */
237 x = (unsigned char *) &bi.bridge_id;
238 for (j = 0; j < 8; j++) {
Denys Vlasenkod60752f2015-10-07 22:42:45 +0200239 printf("%02x", x[j]);
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000240 if (j == 1)
241 bb_putchar('.');
242 }
243 printf(bi.stp_enabled ? "\tyes" : "\tno");
244
245 /* print interface list */
246 arm_ioctl(args, BRCTL_GET_PORT_LIST,
247 (unsigned long) ifidx, MAX_PORTS);
248 xioctl(fd, SIOCDEVPRIVATE, &ifr);
249 tabs = 0;
250 for (j = 0; j < MAX_PORTS; j++) {
251 if (!ifidx[j])
252 continue;
253 if (!if_indextoname(ifidx[j], ifname))
254 bb_perror_msg_and_die("can't get interface name for index %d", j);
255 if (tabs)
256 printf("\t\t\t\t\t");
257 else
258 tabs = 1;
259 printf("\t\t%s\n", ifname);
260 }
Denys Vlasenkoe4dcba12010-10-28 18:57:19 +0200261 if (!tabs) /* bridge has no interfaces */
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000262 bb_putchar('\n');
263 }
264 goto done;
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000265 }
266#endif
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000267
268 if (!*argv) /* all but 'show' need at least one argument */
269 bb_show_usage();
270
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000271 br = *argv++;
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000272
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000273 if (key == ARG_addbr || key == ARG_delbr) { /* addbr or delbr */
274 ioctl_or_perror_and_die(fd,
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000275 key == ARG_addbr ? SIOCBRADDBR : SIOCBRDELBR,
276 br, "bridge %s", br);
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000277 goto done;
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000278 }
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000279
Bernhard Reutner-Fischer0c0f1762010-03-17 11:23:04 +0100280 if (!*argv) /* all but 'addbr/delbr' need at least two arguments */
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000281 bb_show_usage();
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000282
Denis Vlasenko360d9662008-12-02 18:18:50 +0000283 strncpy_IFNAMSIZ(ifr.ifr_name, br);
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000284 if (key == ARG_addif || key == ARG_delif) { /* addif or delif */
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000285 brif = *argv;
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000286 ifr.ifr_ifindex = if_nametoindex(brif);
287 if (!ifr.ifr_ifindex) {
288 bb_perror_msg_and_die("iface %s", brif);
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000289 }
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000290 ioctl_or_perror_and_die(fd,
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000291 key == ARG_addif ? SIOCBRADDIF : SIOCBRDELIF,
292 &ifr, "bridge %s", br);
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000293 goto done_next_argv;
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000294 }
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000295#if ENABLE_FEATURE_BRCTL_FANCY
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000296 if (key == ARG_stp) { /* stp */
Denys Vlasenko8a659f62010-04-03 00:52:16 +0200297 static const char no_yes[] ALIGN1 =
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100298 "0\0" "off\0" "n\0" "no\0" /* 0 .. 3 */
299 "1\0" "on\0" "y\0" "yes\0"; /* 4 .. 7 */
Denys Vlasenko8a659f62010-04-03 00:52:16 +0200300 int onoff = index_in_strings(no_yes, *argv);
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100301 if (onoff < 0)
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200302 bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, applet_name);
Maciek Borzecki30ebd7b2010-03-23 05:18:38 +0100303 onoff = (unsigned)onoff / 4;
304 arm_ioctl(args, BRCTL_SET_BRIDGE_STP_STATE, onoff, 0);
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000305 goto fire;
306 }
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000307 if ((unsigned)(key - ARG_setageing) < 4) { /* time related ops */
308 static const uint8_t ops[] ALIGN1 = {
309 BRCTL_SET_AGEING_TIME, /* ARG_setageing */
310 BRCTL_SET_BRIDGE_FORWARD_DELAY, /* ARG_setfd */
311 BRCTL_SET_BRIDGE_HELLO_TIME, /* ARG_sethello */
312 BRCTL_SET_BRIDGE_MAX_AGE /* ARG_setmaxage */
313 };
314 arm_ioctl(args, ops[key - ARG_setageing], str_to_jiffies(*argv), 0);
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000315 goto fire;
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000316 }
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000317 if (key == ARG_setpathcost
Denis Vlasenkod0a071a2008-03-17 09:33:45 +0000318 || key == ARG_setportprio
319 || key == ARG_setbridgeprio
320 ) {
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000321 static const uint8_t ops[] ALIGN1 = {
322 BRCTL_SET_PATH_COST, /* ARG_setpathcost */
323 BRCTL_SET_PORT_PRIORITY, /* ARG_setportprio */
324 BRCTL_SET_BRIDGE_PRIORITY /* ARG_setbridgeprio */
325 };
326 int port = -1;
327 unsigned arg1, arg2;
328
329 if (key != ARG_setbridgeprio) {
330 /* get portnum */
331 unsigned i;
332
333 port = if_nametoindex(*argv++);
334 if (!port)
Denys Vlasenko0f296a32015-10-14 13:21:01 +0200335 bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, "port");
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000336 memset(ifidx, 0, sizeof ifidx);
337 arm_ioctl(args, BRCTL_GET_PORT_LIST, (unsigned long)ifidx,
Denys Vlasenko60cb48c2013-01-14 15:57:44 +0100338 MAX_PORTS);
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000339 xioctl(fd, SIOCDEVPRIVATE, &ifr);
340 for (i = 0; i < MAX_PORTS; i++) {
341 if (ifidx[i] == port) {
342 port = i;
343 break;
344 }
345 }
346 }
347 arg1 = port;
Denys Vlasenko77832482010-08-12 14:14:45 +0200348 arg2 = xatoi_positive(*argv);
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000349 if (key == ARG_setbridgeprio) {
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000350 arg1 = arg2;
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000351 arg2 = 0;
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000352 }
353 arm_ioctl(args, ops[key - ARG_setpathcost], arg1, arg2);
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000354 }
355 fire:
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000356 /* Execute the previously set command */
Bernhard Reutner-Fischer2b11fb42008-01-14 16:10:11 +0000357 xioctl(fd, SIOCDEVPRIVATE, &ifr);
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000358#endif
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000359 done_next_argv:
360 argv++;
Bernhard Reutner-Fischer1aac3ab2008-01-13 18:43:50 +0000361 done:
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000362 close(fd);
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000363 }
Denis Vlasenko278a1c22008-04-06 07:17:02 +0000364
Bernhard Reutner-Fischerd27d9252008-01-13 15:23:27 +0000365 return EXIT_SUCCESS;
366}