Commit Graph

2299 Commits

Author SHA1 Message Date
Denys Vlasenko
e4785ca653 udhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03 18:03:42 +01:00
Kaarle Ritvanen
fe8390e0fe ifupdown: support 'link' address family
Does not configure anything. L2 configuration hook scripts should do
their job on receiving ADDRFAM=link. Configuration will be done only
once, irrespective of L3 protocols used.

Using the 'link' family in the interfaces file conforms to the Debian
implementation:

http://sources.debian.net/src/ifupdown/0.7.47.1/link.defn

function                                             old     new   delta
link_methods                                           -      12     +12
addr_link                                              -      12     +12
link_up_down                                           -       6      +6
static.addr_fams                                      12      16      +4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 1/0 up/down: 34/0)               Total: 34 bytes

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03 15:56:20 +01:00
Denys Vlasenko
d353bfff46 wget: fix use-after-free of ->user. Closes 6836
function                                             old     new   delta
wget_main                                           2207    2223     +16
parse_url                                            339     353     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03 14:09:42 +01:00
Eugene Rudoy
731f596175 iplink: fix build with kernel versions prior to 2.6.23
Signed-off-by: Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-22 11:49:46 +01:00
Denys Vlasenko
c009d35f00 ntpd: remove now unnecessary check for IP_PKTINFO definition
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-20 03:24:51 +01:00
Bartosz Golaszewski
76ad7481b1 ntpd: fix compilation warnings
GCC complained about since_last_update being set but not used.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-20 03:21:08 +01:00
Denys Vlasenko
604b7b6cc0 fakeidentd: simplify ndelay manipulations
function                                             old     new   delta
new_peer                                              91      79     -12
do_rd                                                197     152     -45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-10 17:12:54 +01:00
Denys Vlasenko
3deabea893 fixlet for the previous commit #2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 20:09:43 +01:00
Denys Vlasenko
abaf9109bd fixlet for the previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 20:05:47 +01:00
Denys Vlasenko
3ea93e853e networking: explain isrv_run() API
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 19:58:19 +01:00
Ryan Mallon
89deb22f97 fakeidentd: fix use-after-free
function                                             old     new   delta
do_rd                                                199     197      -2

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 19:15:16 +01:00
Denys Vlasenko
f0058b1b1f ping: revert "try SOCK_DGRAM if no root privileges"
It wasn't working, and fixes on top of it would make ping
noticeably larger.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 11:53:26 +01:00
Denys Vlasenko
cb7611385c ntpd: adjust last packet's recv time after a step
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-08 17:17:52 +01:00
Michael Tokarev
e9355c4326 hostname: do not use gethostbyname() for "hostname -s"
There's no reason to call gethostbyname() on the value returned
by uname() when asked just for a short name of a host.  This may
also be wrong, when uname is set to one value, but in /etc/hosts
(or elsewhere) the "canonical" name is different.  This is often
the case for localhost entry in /etc/hosts:

  127.0.0.1     localhost       myname

With this content of /etc/hosts, and uname being set to myname,
busybox hostname -s will return localhost, while regular
hostname utility returns myname.

Fix this by not calling gethostbyname() for the simple
'hostname -s' use.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-17 19:13:45 +01:00
Lauri Kasanen
4967a41ba1 wget: user-friendly fallback to http
GNU wget: wget google.com // ok
bb before: wget google.com // wget: not an http or ftp url

function                                             old     new   delta
parse_url                                            317     339     +22

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-17 19:09:43 +01:00
Denys Vlasenko
0b3a38b9f5 ntpd: speed up resyncing if our clock is seriously off
function                                             old     new   delta
recv_and_process_peer_pkt                            892     922     +30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-08 16:11:04 +01:00
Denys Vlasenko
777be10ebe ntpd: do not invalidate datapoints after step
Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
and clear reachable bits, but this proved to be too agressive:
after step (tested with suspinding laptop for ~30 secs),
this caused all previous data to be considered invalid,
making us needing to collect full ~8 datapoins per peer
after step in order to start trusting them.
In turn, this was making poll interval decrease even after
step was done. (Poll interval decreases already before step
in this scenario, because we see large offsets and end up with
no good peer to select).

function                                             old     new   delta
reset_peer_stats                                     157     139     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-07 17:29:03 +01:00
Denys Vlasenko
6c46eed6e9 ntpd: comment out "spike detection" code
function                                             old     new   delta
update_local_clock                                   982     835    -147

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-04 17:12:11 +01:00
Denys Vlasenko
a14958c69d ntpd: promote log level 3 to production
Without it, peer selection logic is hard to debug

function                                             old     new   delta
update_local_clock                                   861     982    +121
select_and_cluster                                   962    1065    +103
common_ping_main                                    1788    1821     +33
huft_build                                          1287    1296      +9
chpst_main                                           708     704      -4
INET6_resolve                                        127     119      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 266/-12)           Total: 254 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-04 16:32:09 +01:00
Denys Vlasenko
cb1dc1d1d1 ntpd: let user know if spike was detected
function                                             old     new   delta
update_local_clock                                   861     943     +82

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-04 13:19:04 +01:00
Denys Vlasenko
327f550669 Use unsigned printf/scanf conversion where more appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:45:45 +01:00
Denys Vlasenko
9b2a9f0210 fix assorted unused code and wrong format specs found by cppchekc (bug 6716)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:43:33 +01:00
Daniel Borca
72745632a1 ping: try SOCK_DGRAM if no root privileges
Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-28 12:50:25 +01:00
Jeremy Kerr
d3092c99ae udhcp: add PXELINUX config file option (code 209) definition
This change adds a definition for DHCP option 209. RFC 5071 defines code
209 as a configuration file for a PXE bootloader; this change uses
the string "pxeconffile" as its text identifier.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-12 11:18:26 +01:00
Denys Vlasenko
8d3efaf35e udhcpc: allow zero server-id. Closes 6614.
function                                             old     new   delta
bcast_or_ucast                                         -      47     +47
udhcp_send_kernel_packet                             271     295     +24
udhcpc_main                                         2696    2705      +9
udhcp_send_raw_packet                                456     459      +3
send_release                                          90      76     -14
send_renew                                           105      77     -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/2 up/down: 83/-42)             Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 19:20:54 +01:00
Johannes Stezenbach
2d576e2a22 udhcpc: make DHCP packets to have at least 300 DHCP bytes
Commit b8b72f02 removed all padding from DHCP packets
to fix operation with buggy servers which can't handle
maximum sized packets.  But it introduced a regression
with buggy routers which drop DHCP packets smaller
than 300 bytes (i.e. 342 byte ethernet packets).
Add back some padding to work around.

function                                             old     new   delta
udhcp_send_kernel_packet                             268     292     +24
udhcp_send_raw_packet                                462     473     +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-28 23:27:37 +01:00
Guilherme Maciel Ferreira
840ef17f63 wget: if FEATURE_CLEAN_UP, free(ptr_to_globals)
Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-16 14:43:30 +02:00
Denys Vlasenko
5117eff6f9 Fix some compiler warnings emitted by gcc-4.8.0
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-16 14:21:20 +02:00
Denys Vlasenko
eba5faec67 ether-wake: shorten help text, reduce packet buffer size
function                                             old     new   delta
ether_wake_main                                      726     727      +1
packed_usage                                       29468   29434     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-14 19:04:20 +02:00
Lauri Kasanen
d074b416f8 wget: add support for connect timeout
function                                             old     new   delta
open_socket                                           33      64     +31
wget_main                                           2182    2194     +12

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 21:47:07 +02:00
Denys Vlasenko
a6ed6a3148 httpd: make sire pfd[TO_CGI].revents is cleared before poll()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-18 12:08:41 +02:00
Denys Vlasenko
fbe250db76 httpd: treat errors from stdin correctly.
Fron bug report:

If a CGI or proxied connection is rudely aborted (SIG_{KILL,BUS,SEGV})
then httpd will spin madly the poll loop in:

networking/httpd.c:1080
cgi_io_loop_and_exit()

Upon investigation I found that pfd[0].revents == 0x0018 (POLLHUP|POLLERR),
which leads to empty read, but the pfd[0].fd (STDIN_FILENO) is left open,
and in the FD list given to poll() which immediately returns to once
again inform the loop of (POLLHUP|POLLERR) condition of pfd[0].fd.
This continues until pfd[FROM_CGI].revents != 0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-11 14:59:21 +02:00
Denys Vlasenko
ec2bef11a7 iplink: comment out include <net/if_packet.h>
iplink.c includes net/if_packet.h, which (on GLIBC)
only defines struct sockaddr_pkt. this struct is not
used anywhere in the code, and removing the #include
makes compilation succeed with musl libc.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16 12:20:25 +02:00
Denys Vlasenko
fc364ba9e3 fix build error with musl libc due to if_slip.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-15 09:54:51 +02:00
Nicolas Dichtel
6761d7da83 networking: fix potential overflow in ife_print6()
devname is used by fscanf to store a string specified by '%20s'.

Extract from the man for the '%s' specifier:
Matches a sequence of non-white-space characters; the next pointer must be a
pointer to character array that is long enough to hold the input sequence and
the terminating null byte ('\0'), which is added automatically. The input
string stops at white space or at the maximum field width, whichever occurs
first.

Hence, the right length is 20 + 1 for the '\0'.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-14 17:43:05 +02:00
Denys Vlasenko
9ae6d79307 udhcpc: tweak help text more
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 12:45:45 +02:00
Denys Vlasenko
456687fff1 udhcpc: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 12:33:18 +02:00
Denys Vlasenko
aadb485bd0 udhcpc: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-05 02:21:36 +02:00
Tito Ragusa
da331d779c ifplugd: use a larger netlink buffer
function                                             old     new   delta
check_existence_through_netlink                      310     321     +11

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-04 18:10:26 +02:00
Denys Vlasenko
982e87f2fb Whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 11:52:58 +02:00
Denys Vlasenko
05965cbb75 nc: remove unnecessary "errno = 0"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-29 14:18:32 +02:00
Denys Vlasenko
2ead5316b4 iplink: fix build error (IFLA_VLAN_PROTOCOL defined before include)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 23:24:55 +02:00
Denys Vlasenko
fd3ac96c0f nc: remove some dead code
function                                             old     new   delta
readwrite                                            887     841     -46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 22:24:51 +02:00
Denys Vlasenko
ffeeb7a96c nc: exit when both stdin and network are closed.
function                                             old     new   delta
nc_main                                             1051    1042      -9
readwrite                                            943     887     -56

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 22:23:12 +02:00
Denys Vlasenko
ca54b662e7 nc: use symbolic SHUT_WR instead of literal 1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 21:08:37 +02:00
Bartosz Golaszewski
c19be75d57 networking: code shrink
function                                             old     new   delta
in_ether                                               -     124    +124
hexchar2int                                           42       -     -42
ifconfig_main                                       1237    1106    -131
ether_input                                          141       -    -141
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/1 up/down: 124/-314)         Total: -190 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-25 04:39:04 +02:00
Patrick McHardy
a7ecbed56b ip link: add VLAN support
function                                             old     new   delta
do_add_or_delete                                       -    1073   +1073
get_u16                                                -      62     +62
static.protocols                                       -      16     +16
do_iplink                                           1235    1232      -3
do_change                                            495       -    -495
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/1 up/down: 1151/-498)         Total: 653 bytes

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-15 05:16:13 +02:00
Denys Vlasenko
9b58fe9c0b ip: code shrink
function                                             old     new   delta
do_ipaddr                                             78      81      +3
do_iprule                                            140     139      -1
do_iptunnel                                          283     278      -5
iprule_modify                                        851     841     -10
ipaddr_modify                                       1293    1236     -57
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 3/-73)             Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-15 05:15:46 +02:00
Denys Vlasenko
ea267d518f wget: do not abort if "_" is encountered in a HTTP header
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-01 15:05:09 +02:00
Denys Vlasenko
26a7e2ecbf ping: code shrink
function                                             old     new   delta
unpack_tail                                          262     243     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-28 01:33:47 +02:00