busybox/networking
Hauke Mehrtens 4ff86df861 libnetlink: fix alignment of netlink messages
A padding to align a message should not only be added between
different attributes of a netlink message, but also at the end of the
message to pad it to the correct size.

Without this patch the following command does not work and returns an
error code:
ip link add type nlmon

Without this ip from busybox sends this:

sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000},
	msg_namelen=12, msg_iov=[{iov_base={{len=45, ...},
		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon"}, iov_len=45}],
	msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 45
return value: 2

The normal ip utile from iproute2 sends this:

sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000},
	msg_namelen=12, msg_iov=[{iov_base={{len=48, ...},
		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon\0\0\0"}, iov_len=48}],
	msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 48
return value: 0

With this patch ip from busybox sends this:

sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000},
	msg_namelen=12, msg_iov=[{iov_base={{len=48, ...},
		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon\0\0\0"}, iov_len=48}],
	msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 48
return value: 0

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-18 22:55:47 +02:00
..
libiproute libnetlink: fix alignment of netlink messages 2016-09-18 22:55:47 +02:00
ssl_helper networking/ssl_helper: experimental matrixssl-based ssl helper 2014-02-23 23:31:13 +01:00
ssl_helper-wolfssl wget/ssl_helper: update to wolfssl-3.9.8 2016-08-21 03:39:39 +02:00
udhcp udhcpc: Unconditionally call deconfig script, not only if lease is active 2016-08-26 18:46:34 +02:00
arp.c arp: fix buffer overflow. Closes 9071 2016-07-04 17:38:01 +02:00
arping.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
brctl.c libiproute: rename invarg(a,b) to invarg_1_to_2(a,b) 2015-10-14 13:21:01 +02:00
Config.src inetd: make FEATURE_INETD_RPC off by default 2015-10-25 20:10:46 +01:00
dnsd.c libbb: introduce and use is_prefixed_with() 2015-03-12 17:48:34 +01:00
ether-wake.c
ftpd.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
ftpgetput.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
hostname.c
httpd_indexcgi.c
httpd_post_upload.txt
httpd_ssi.c
httpd.c *: hopefully all setup_common_bufsiz() are in place 2016-04-21 18:38:51 +02:00
ifconfig.c
ifenslave.c join some common strings, -400 bytes 2015-10-08 11:24:44 +02:00
ifplugd.c ifplugd: if SIOCSIFFLAGS fails with ENODEV, don't die 2016-08-16 20:39:52 +02:00
ifupdown.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
inetd.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
interface.c Revert "networking: properly initialize ipv6 scope id for printing it" 2016-03-29 19:27:00 +02:00
ip.c networking: add 'ip neigh' command 2015-10-14 12:53:47 +02:00
ipcalc.c ipcalc: fix trivial usage message 2015-08-15 21:15:27 +02:00
isrv_identd.c *: hopefully all setup_common_bufsiz() are in place 2016-04-21 18:38:51 +02:00
isrv.c libbb: introduce kernel-style BUILD_BUG_ON() 2015-10-13 14:50:20 +02:00
isrv.h fixlet for the previous commit #2 2014-01-09 20:09:43 +01:00
Kbuild.src wget: make openssl/ssl_helper choice configurable 2015-10-07 01:39:40 +02:00
nameif.c libbb: introduce and use is_prefixed_with() 2015-03-12 17:48:34 +01:00
nbd-client.c *: more BUILD_BUG_ON conversions 2015-10-13 17:17:34 +02:00
nc_bloaty.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
nc.c *: hopefully all setup_common_bufsiz() are in place 2016-04-21 18:38:51 +02:00
netstat.c typo fixes 2015-05-25 13:46:36 +02:00
nslookup.c
ntpd.c ntpd: respond only to client and symmetric active packets 2016-08-01 20:25:06 +02:00
ntpd.diff ntpd: add experimental patch 2016-03-04 07:36:04 +01:00
ping.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
pscan.c
route.c typo fixes 2016-07-19 17:48:55 +02:00
slattach.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
tc.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
tcpudp_perhost.c
tcpudp_perhost.h
tcpudp.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
telnet.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
telnetd.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
telnetd.ctrlSQ.patch *: slap on a few ALIGN1/2s where appropriate 2016-04-22 18:09:21 +02:00
tftp.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
traceroute.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
tunctl.c Replace a few more bb_info_msg's by bb_error_msg or printf 2016-03-30 16:20:28 +02:00
vconfig.c
wget.c *: placate some compile warnings on OSX 2016-09-01 11:16:22 +02:00
whois.c getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST 2016-07-06 21:58:02 +02:00
zcip.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00