hush/networking
Jonas Danielsson 4d5acd2d42 ping: populate icmp_id field for "simple" ping too
The ICMP RFC says that identifier and sequence number may be zero.
Having them zero for a Echo message, along with a data of zero's
as well will result in a Echo reply message with only zero's.

Some NAT implementations seem to get the checksum wrong on these
packages. Setting a checksum of 0x0 instead of 0xffff.

Through NAT:
  Internet Control Message Protocol
      Type: 0 (Echo (ping) reply)
      Code: 0
      Checksum: 0x0000 [incorrect, should be 0xffff]
      Identifier (BE): 0 (0x0000)
      Identifier (LE): 0 (0x0000)
      Sequence number (BE): 0 (0x0000)
      Sequence number (LE): 0 (0x0000)
      Data (56 bytes)
          Data: 000000000000000000000000000000000000000000000000...
          [Length: 56]

Without NAT:
  Internet Control Message Protocol
      Type: 0 (Echo (ping) reply)
      Code: 0
      Checksum: 0xffff [correct]
      Identifier (BE): 0 (0x0000)
      Identifier (LE): 0 (0x0000)
      Sequence number (BE): 0 (0x0000)
      Sequence number (LE): 0 (0x0000)
      [Request frame: 189]
      [Response time: 0.024 ms]
      Data (56 bytes)
          Data: 000000000000000000000000000000000000000000000000...
          [Length: 56]

And this in turn will make some hardware MAC checksum offloading
engines drop the packet.

(This was seen with a Synopsis MAC, the same one used in for instance the
stmmac Ethernet driver in the linux kernel.)

This change can be seen as a workaround for bugs in other layers.
But just setting an identifier for the Echo message packet will
avoid prodding the hornets nest.

function                                             old     new   delta
common_ping_main                                     424     500     +76

Signed-off-by: Jonas Danielsson <jonasdn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-23 18:26:32 +02:00
..
libiproute ip: fix problem on mips64 n64 big endian musl systems 2016-04-24 17:39:02 +02:00
ssl_helper
ssl_helper-wolfssl
udhcp *: slap on a few ALIGN1/2s where appropriate 2016-04-22 18:09:21 +02:00
arp.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
arping.c arping: avoid use of ether_ntoa(). Closes 8926 2016-05-26 21:35:46 +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
ether-wake.c
ftpd.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +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
ifplugd.c
ifupdown.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
inetd.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +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
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
Kbuild.src
nameif.c
nbd-client.c *: more BUILD_BUG_ON conversions 2015-10-13 17:17:34 +02:00
nc_bloaty.c
nc.c *: hopefully all setup_common_bufsiz() are in place 2016-04-21 18:38:51 +02:00
netstat.c
nslookup.c
ntpd.c ntpd: retry initial DNS resolution (forever, no timeout for now). 2016-06-06 02:26:49 +02:00
ntpd.diff ntpd: add experimental patch 2016-03-04 07:36:04 +01:00
ping.c ping: populate icmp_id field for "simple" ping too 2016-06-23 18:26:32 +02:00
pscan.c
route.c
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 *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
telnet.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00
telnetd.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +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 Replace a few more bb_info_msg's by bb_error_msg or printf 2016-03-30 16:20:28 +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 *: slap on a few ALIGN1/2s where appropriate 2016-04-22 18:09:21 +02:00
whois.c
zcip.c *: add most of the required setup_common_bufsiz() calls 2016-04-21 18:18:48 +02:00