Commit Graph

153 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
16deb86746 - very minor size tweak.
TODO: mv to globals, config-out non-busybox dhcp client stuff, reduce string bloat, etc
   text    data     bss     dec     hex filename
   7543       0      28    7571    1d93 networking/ifupdown.o.orig
   7515       0      28    7543    1d77 networking/ifupdown.o
2007-03-19 19:54:56 +00:00
Denis Vlasenko
2b52b2797b ifupdown: do not complain if !/var/run/ifstate 2007-03-09 22:48:08 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00
Denis Vlasenko
c115fdbc80 ifupdown: code to deconstruct the state_list gracefully
(patch by Gabriel L. Somlo <somlo@cmu.edu>)
2007-03-06 22:53:10 +00:00
Denis Vlasenko
1d76f439da EXEC_PREFER_APPLETS support by Gabriel L. Somlo <somlo@cmu.edu> 2007-02-06 01:20:12 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
89ef65f024 preparatory patch for -Wwrite-strings #5 2007-01-29 23:43:18 +00:00
Denis Vlasenko
ab2aea4447 preparatory patch for -Wwrite-strings #4 2007-01-29 22:51:58 +00:00
Denis Vlasenko
b95636c52f remove casts from xmalloc() 2006-12-19 23:36:04 +00:00
Denis Vlasenko
2375d75f32 ifupdown: do not print and/or execute empty commands (""). 2006-12-19 23:15:46 +00:00
Denis Vlasenko
8cd1a288fa ifupdown: parse() returning NULL and returning "" is not the same,
it turned out! wow... okay, fixing my buglet...
2006-12-19 23:01:33 +00:00
Denis Vlasenko
fcfe834d50 ifupdown: strlen(NULL) is a no-no, fixed. Also few micro-optimizations 2006-12-18 21:02:00 +00:00
Denis Vlasenko
097c324f59 fix remaining survivors of the return(a) cleanup 2006-11-27 16:59:15 +00:00
Denis Vlasenko
a741b778fe ifupdown:
ifconfig said to set iface up before it processes hw %hwaddress%,
which then of course fails. Thus we run two separate ifconfig
2006-11-23 15:08:37 +00:00
Denis Vlasenko
93ad1c2385 ifupdown: save some 100+ bytes of code in addstr() 2006-11-23 15:07:38 +00:00
Denis Vlasenko
736230e209 dhcprelay: new applet 2006-11-20 19:40:36 +00:00
Denis Vlasenko
d18a3a20db use skip_whitespace where appropriate 2006-10-25 12:46:03 +00:00
Denis Vlasenko
4e33e07f60 strip -> $(STRIP); fix "unused variable" warning
(patch by Diekema, Jon (AGRE) <Jon.Diekema@smiths-aerospace.com>)
2006-10-16 18:24:57 +00:00
Denis Vlasenko
2d5ca60bfb bb_get_[chomped]line_from_file wasn't descriptive enough.
Renaming...
2006-10-12 22:43:20 +00:00
Denis Vlasenko
f6f43df60b ifupdown: stop emitting annoying/misleading error messages.
Patch by Gabriel Somlo <somlo at cmu.edu>
2006-10-11 22:16:56 +00:00
Denis Vlasenko
c12f53090b dnsd fix; option_mask32 added. dnsd needs more love. 2006-10-06 09:49:47 +00:00
Denis Vlasenko
8f8f268cfd bb_applet_name -> applet_name 2006-10-03 21:00:43 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
1c3577f91d ifupdown: Debian users contributed improvement to it 2006-10-02 20:57:10 +00:00
Denis Vlasenko
06b543b217 ifupdown: make dhcp start/stop scripts user configurable
in /etc/network/interfaces. Patch author is Gabriel L. Somlo <somlo@cmu.edu>
2006-09-28 22:31:51 +00:00
Denis Vlasenko
2f4399c6cc ifupdown: fix for standalone shell; removed hardcoded PATH 2006-09-27 14:14:51 +00:00
Denis Vlasenko
0534125ccc ifupdown: style cleanup, no code changes 2006-09-26 20:35:30 +00:00
Denis Vlasenko
7f1f5b001f ifupdown: getopt_ulflags'ification. 2006-09-23 12:49:01 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
"Robert P. J. Day"
d35ef0f666 More removal of "#if 0" content. 2006-07-01 14:59:54 +00:00
Mike Frysinger
b049c0ec19 only enable count_bit functions when actually needed to fix warning reported by Bernhard Fischer 2006-06-20 23:03:27 +00:00
Rob Landley
a6e131dab3 Size reductions, mostly switching things to use libbb functions. 2006-05-29 06:43:55 +00:00
Rob Landley
8bb50782a5 Change llist_add_* to take the address of the list rather than returning the new
head, and change all the callers.
2006-05-26 23:44:51 +00:00
Rob Landley
a389651115 Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes
as the old optimization did (actually does slightly better under gcc 4.0), and
simplifies the code.
2006-05-07 20:20:34 +00:00
Rob Landley
b0a2d6c19d Remove code for protocols we don't properly support. (Most of this could
never be selected via menuconfig anyway.)  If somebody wants one of these
protocols, ask on the list for us to support it _properly_.
2006-04-14 20:07:33 +00:00
Bernhard Reutner-Fischer
421d9e5941 - move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-04-03 16:39:31 +00:00
Rob Landley
a35886c862 Fix from Glenn McGrath. 2006-03-22 16:59:12 +00:00
Rob Landley
dfba741457 Robert P. Day removed 8 gazillion occurrences of "extern" on function
definitions.  (That should only be on prototypes.)
2006-03-06 20:47:33 +00:00
Rob Landley
12c2429a42 Fixup to make warnings from the last patch go away. 2006-03-01 21:36:18 +00:00
Rob Landley
e7c43b66d7 Cleanup patch from Denis Vlasenko. Mostly variants of removing the if(x)
from before "if(x) free(x)".
2006-03-01 16:39:45 +00:00
Rob Landley
e813ddba18 Cleanup from Glenn McGrath. 2006-02-28 03:53:14 +00:00
Rob Landley
4217bab02e Patch from Glenn McGrath to remove code that opens a file but does nothing
with it.
2006-02-26 04:42:05 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Bernhard Reutner-Fischer
d42ef28b98 - several functions depend on IPv4 or IPv6 od IPX support.
removes warning about unused code for allbareconfig.
2005-12-14 14:13:15 +00:00
Rob Landley
1b751c894b Rob Sullivan sent in some cleanups, which I beat on slightly. 2005-10-28 09:24:33 +00:00
"Vladimir N. Oleynik"
39a841cecf change interface to bb_xasprintf() - more perfect for me.
ln.c: error_msg(str)->error_msg(%s, str) - remove standart "feature" for hackers
reduce 100 bytes don't care in sum
2005-09-29 16:18:57 +00:00
Bernhard Reutner-Fischer
bee9eb1a9d - rename llist_add_to.c to llist.c
- move llist_add_to_end() from ifupdown.c to libbb/llist.c
2005-09-29 12:55:10 +00:00
"Vladimir N. Oleynik"
e4baaa2d27 more remove lost exported 2005-09-22 12:59:26 +00:00
Eric Andersen
70a5a1abde Do not attempt to free() the application's environment, which is was
not dynamically allocated.  Instead, use a private variable to store
the environment array, which is used when we exec applications.
2005-04-27 11:44:11 +00:00
Eric Andersen
14f5c8d764 Patch from Bernhard Fischer to make a bunch of symbols static
which were otherwise cluttering the global namespace.
2005-04-16 19:39:00 +00:00
Eric Andersen
42e3b00ae5 Only define a local environ when not using the prototype from unistd.h 2005-04-16 08:02:15 +00:00
Glenn L McGrath
d4004ee6a9 Patch from Felipe Kellermann, remove some unnecessary dups, i declared a few extra const's also. 2004-09-14 17:24:59 +00:00
Eric Andersen
15b588559b use SIGTERM to kill off udhcpd, not SIGKILL 2004-07-30 14:45:08 +00:00
Eric Andersen
373bc1eaee As noted by Eric Spakman, calling static_down() and then calling
bootp_down() seems redundant, esp since bootp_down was a subset
of static_down, so just use that...
2004-07-30 14:31:01 +00:00
Eric Andersen
7f8bcbefc7 add missing ; 2004-07-26 12:22:33 +00:00
Eric Andersen
b2a300590d bother. unrevert my fix. 2004-07-26 12:11:32 +00:00
Eric Andersen
ac594257c3 Make certain that udhcp shuts down the interface 2004-07-26 12:05:44 +00:00
Eric Andersen
29128cd412 oops 2004-07-26 11:46:50 +00:00
Eric Andersen
06e62fd5f0 Make certain that udhcp shuts down the interface 2004-07-26 11:45:25 +00:00
Glenn L McGrath
4d405bbc05 Patch from Manousaridis Angelos to bring dhclient down more elegently 2004-07-23 01:10:22 +00:00
Glenn L McGrath
0177ce1256 Patch from Mike Snitzer to fix return codes.
"I have a need to _really_ know if the interface was properly configured
via ifup so I made busybox's ifupdown pass the return codes through rather
than dropping them on the floor."

"All the functions in ifupdown.c return 1 on success and 0 on failure
(which happens to the opposite of standard practices but whatever).
So it is important for all these functions to not blindly return 1."

"The problem with blindly returning ret, even if it is != 1, is the
callers expect a 0 or 1 and accumulate the return codes.  So a function that
makes 3 calls to execute will have a value of 3 accumulated.  That value
of 1 (success) was almost always returned even if 1 of the commands in the
command sequence failed.  The attached patch fixes the lack of checking
to verify thar result == expected_reult."
2004-07-21 23:56:31 +00:00
Glenn L McGrath
469a1ead53 Patch from Mike Snitzer, bring down dhclient using its correct pid, fix
a grammatical error.
2004-07-21 12:21:39 +00:00
Eric Andersen
5e136f269b Prevent "bootp_down' was declared implicitly extern' and later `static'" warning 2004-07-20 06:35:54 +00:00
Eric Andersen
fe9b9cdfa5 Paul Fox writes:
hi --

working with ifupdown, i've found a couple of buglets --
the wrong string is passed to an error message.

paul
2004-06-29 00:48:30 +00:00
Glenn L McGrath
c6992feee3 Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
Eric Andersen
238e354b58 Eric Spakman noticed that ifdown' will attempt to run 'ifconfig'
even if built with CONFIG_FEATURE_IFUPDOWN_IP when shutting down
a dhcp connection.
2004-04-12 20:57:17 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Eric Andersen
658f8b1d1a Manousaridis Angelos writes:
Hello,

I have been using busybox for some time now, for an ARM based platform.
I was very pleased when I tried the 1.00preX series, with all the new
utilities and daemons.

I found out that the ifupdown in busybox does not behave exaclty like
the debian version. Then the pre-up script fails, the interface is
getting up. Also when the post-up script fails the return value is
ignored. Actually everything is always run and the return value is
always true. I looked at the original implementation from debian and
fixed the busybox version to do the same. A patch is attached if anyone
is interested.
2003-12-19 10:46:00 +00:00
Eric Andersen
eb213bd2a2 As vodz just pointed out, I screwup up the call to bb_xasprintf! 2003-09-12 08:39:05 +00:00
Eric Andersen
51ed242ad6 Invoke run-parts on /etc/network/if-*.d per the behavior of
the upstream ifupdown code...
2003-09-12 05:59:53 +00:00
Glenn L McGrath
dc4e75ef7c move all "-/bin/sh" "/bin/sh" and "sh" to libbb/messages.c file as one
constant.
Vodz last_patch_107
2003-09-02 02:36:18 +00:00
Glenn L McGrath
62b031fb82 label's dont work in v4 tunnels, patch by Eric Spakman 2003-08-29 07:47:52 +00:00
Eric Andersen
fdd2a0f318 Eric Spakman writes:
The attached patch adds "mtu" and "hwaddress" to the inet6 method and
"mtu", "hwaddr" and "pointopoint" to the inet4 method (just like in
the ifupdown part).
Note: "hwaddress" can't be used with the busybox ip applet (this
function isn't implemented in bb ip yet), but it can be of use with
an external "full blown" ip package.

The patch also removes "label" from the loopback configuration,
labels (subinterfaces) aren't used with loopback interfaces.

It further solves a problem in the bootp method, "ifconfig down
%interface%" should be "ifconfig %interface% down" and it's now also
possible to use ip with bootp.

The patch is fully tested with both busybox ip and "stand-alone" ip
and I didn't saw any problems.
2003-08-06 09:23:44 +00:00
Eric Andersen
76097edc0e Eric Spakman writes:
The recent changes in ifupdown where all calls to 'ip link set' and
'ip addr set' are swapped give some problems with v4tunnels.
For plain ipv4 and ipv6 interfaces it works correct, other methods
not tried. The patch below change the behaviour back for v4tunnels
only.

Without the patch the following errors are shown:
RTNETLINK answers: Network is down
RTNETLINK answers: No route to host
and the tunnel is not fully brought up

With this patch all works as expected.
2003-07-30 08:22:53 +00:00
Eric Andersen
c663ab0c6b Match up interfaces 2003-07-29 07:37:39 +00:00
Eric Andersen
2a186890ee Bruno Randolf writes:
this patch fixes run_parts when it's called by ifupdown. 1) argv has to be a
NULL terminated char* array, not just a string. 2) run_parts now explicitly
sets the environment. this environment is populated from the
/etc/network/interfaces config file and is needed by the scripts in
/etc/network/if-pre-up.d/. when run-parts is called from the command line the
environment is taken from the current process.


Vladimir Oleynik then wrote:

You can simplify this if use:

+       bb_xasprintf(&buf[0], "/etc/network/if-%s.d", opt);
+       buf[1] = NULL;
+
+       run_parts(&buf, 2, environ);
+       free(buf[0]);

--w
vodz
2003-07-29 07:05:40 +00:00
Eric Andersen
8a93179c14 Patch from Lars Kellogg-Stedman:
Erik, et al.

    The attached patch makes the following changes to networking/ifupdown.c:

    (1) It swaps all calls to 'ip link set' and 'ip addr set'.  This solves
    two problems:

      (a) Calling 'ip link set <dev> up' before assigning an address
      generates an error message, and

      (b) Under User Mode Linux, running in with ethernet interfaces
      in daemon mode, the MAC address for an interface is selected
      based on the IP address assigned to that interface.  If the
      interface is brought up before being assigned an IP address,
      it gets a null MAC.

    (2) It further cleans up run_mapping().

    This patch is against ifupdown.c revision 1.25.

    -- Lars
2003-07-03 10:20:29 +00:00
Eric Andersen
3c8bca364d Fixup whitespace handing, fixing some annoying behavior and
a couple of segfaults
2003-06-20 10:02:29 +00:00
Eric Andersen
233b170a85 Patch from Lars Kellogg-Stedman, lars at larsshack.org, to
make ifupdown's mapping function work as documented.
2003-06-05 19:37:01 +00:00
Eric Andersen
2894266f12 Patch from David Updegraff to avoid corrupting memory while parsing the
networks/iterfaces file with next_word routine.  Without this, next_word
increments one beyond the end of the string.
2003-04-19 23:15:06 +00:00
Eric Andersen
8320b425a3 Yet another rather large face lift. It now works for me as expected.
-Erik
2003-04-02 10:13:26 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Eric Andersen
46c203a6ce Fix a couple more ifupdown bugs 2003-02-03 12:44:59 +00:00
Eric Andersen
66a3af9d7c This seems sufficient for ifup and ifdown to actually work
as advertised.  Works for me (at least with glibc)
2003-01-27 17:41:19 +00:00
Glenn L McGrath
2e51a14d57 New test mode that allows run_parts to fail silently if the directory
is not found. Patch from Bastian Blank
2003-01-20 23:50:59 +00:00
Glenn L McGrath
8573704097 Fix leading spaces bug, free line buffer, redo next_word, save some
space.
2003-01-14 23:26:57 +00:00
Glenn L McGrath
d66370cd73 Option to allow ifupdown use ip commands instead of ifconfig, add flush
command to ipaddr, patch by Bastian Blank
2003-01-13 21:40:38 +00:00
Glenn L McGrath
8e49caa54f Start to cleanup handling of the state file, save some space and uses linked lists. 2002-12-08 01:23:39 +00:00
Glenn L McGrath
0325a1c9e3 Differentiate struct and type names 2002-12-07 07:45:42 +00:00
Glenn L McGrath
1d658263e8 Fix command that brings down loopback 2002-12-07 00:48:54 +00:00
Glenn L McGrath
398ff9d981 Use libbb/get_line_from_file, change default state file location 2002-12-06 11:51:46 +00:00
Glenn L McGrath
cdbe5e5d4c Make mapping a config option again to save space, turn off file locking, do we really need it ? 2002-12-06 08:35:55 +00:00
Glenn L McGrath
9227371b71 Fix bug that stoped -a working 2002-12-06 08:10:40 +00:00
Glenn L McGrath
2801eb925d Fix simple syntax error 2002-11-26 02:23:41 +00:00
Glenn L McGrath
d1431073d1 Dont use xargs 2002-11-19 09:58:56 +00:00
Glenn L McGrath
83bcba26c0 dont use the -i option of xargs 2002-11-19 09:23:13 +00:00
Glenn L McGrath
29d801b834 Remove mapping option, its should always be used 2002-11-17 21:48:11 +00:00
Glenn L McGrath
9af8a72f10 Make ifupdown use internal run_parts 2002-11-11 07:03:02 +00:00
Glenn L McGrath
545106f8db Move awk from textutils to editors. Cleanup run-parts, saves 200 bytes, moves the guts of run_parts to libbb to be used by ifupdown. 2002-11-11 06:21:00 +00:00