All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] netconsole and networking co-existence
@ 2021-05-03 11:55 Ian Ray
  2021-05-03 11:55 ` [RFC 1/2] net: net_up, net_down Ian Ray
  2021-05-03 11:55 ` [RFC 2/2] netconsole and networking co-existence Ian Ray
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Ray @ 2021-05-03 11:55 UTC (permalink / raw)
  To: u-boot

Commit d9506cd41ce98e10a29c25c4766878367103bb2d attempts to fix ping in
netconsole [1] but IIUC the fix is incomplete (at least in our config).

[1] https://patchwork.ozlabs.org/project/uboot/patch/20201221034439.2747170-1-yliu at cybertec.com.au/

Two issues were identified:

Firstly that the logic of eth_halt() in the various network operations
would break an already running netconsole.

Secondly, netconsole uses the net output buffer which means that any
nested network operation (such as arp or ping) will cause an overwrite
of the netconsole data.

Marked as RFC since not all network protocols have been tested, and not
all nc configurations have been tested (e.g. broadcast address).

Tested against ge_bx50v3_defconfig (i.MX6) using the fec.

Tested against 2020.10 050acee119b3757fee3bd128f55d720fdd9bb890, using a
configuration that includes CONFIG_NETCONSOLE, CONFIG_CMD_NFS, and
CONFIG_CMD_PING.

A sample session is as follows:

Configure (via serial console)

    => env set ethaddr ca:fe:de:ca:f0:11 ; env set ipaddr 192.168.120.49 ; setenv stdout serial,nc; setenv stdin serial,nc
    => env set ncip 192.168.120.1

Invoke net console

    ./netconsole 192.168.120.49

Invoke ping (via serial console)

    => ping 192.168.120.1
    Using ethernet at 2188000 device
    host 192.168.120.1 is alive
    => _

Output on net console

    Board out port: 6666
    Board in port: 6666
    NOTE: the interrupt signal (normally ^C) has been remapped to ^T
    ncb: not found

    => ping 192.168.120.1
    Using ethernet at 2188000 device
    host 192.168.120.1 is alive
    =>

Invoke ping (via netconsole) for an IP address that is not reachable.
Type ^C to abort.
The ^C is not echoed.

    => ping 192.168.120.2
    Using ethernet at 2188000 device

    Abort
    ping failed; host 192.168.120.2 is not alive
    => _

Output on serial console

    => ping 192.168.120.2
    Using ethernet at 2188000 device

    Abort
    ping failed; host 192.168.120.2 is not alive
    => 

The following tcpdump fragment captures the typing of the letters "ok"
in the net console.  There was approximately 3 seconds between each
letter.

    > sudo tcpdump -i enx001a9f0c4f04 -n host 192.168.120.49
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on enx001a9f0c4f04, link-type EN10MB (Ethernet), capture size 262144 bytes
    14:20:05.856372 IP 192.168.120.1.53891 > 192.168.120.49.6666: UDP, length 1
'o' from host (nc stdin) to target
    14:20:05.856684 ARP, Request who-has 192.168.120.1 tell 192.168.120.49, length 46
    14:20:05.856709 ARP, Reply 192.168.120.1 is-at 00:1a:9f:0c:4f:04, length 28
    14:20:05.856981 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 1
'o' from target (stdout) to host
    14:20:06.626637 ARP, Request who-has 192.168.120.49 tell 192.168.120.1, length 28
    14:20:06.626915 ARP, Reply 192.168.120.49 is-at ca:fe:de:ca:f0:11, length 46
    14:20:09.364465 IP 192.168.120.1.53891 > 192.168.120.49.6666: UDP, length 1
'k' from host to target
    14:20:09.364776 ARP, Request who-has 192.168.120.1 tell 192.168.120.49, length 46
    14:20:09.364794 ARP, Reply 192.168.120.1 is-at 00:1a:9f:0c:4f:04, length 28
    14:20:09.365041 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 1
'k' from target to host

The following tcpdump fragment captures the typing of the letters "ok"
in the serial console.  There was approximately 3 seconds between each
letter.

    14:22:48.225004 ARP, Request who-has 192.168.120.1 tell 192.168.120.49, length 46
    14:22:48.225032 ARP, Reply 192.168.120.1 is-at 00:1a:9f:0c:4f:04, length 28
    14:22:48.225291 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 1
'o' from target (stdout) to host
    14:22:51.777002 ARP, Request who-has 192.168.120.1 tell 192.168.120.49, length 46
    14:22:51.777031 ARP, Reply 192.168.120.1 is-at 00:1a:9f:0c:4f:04, length 28
    14:22:51.777251 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 1
'k' from target to host

The following tcpdump fragment captures ping to a known host.
(Not shown: the command "ping 192.168.120.1")

    14:23:56.873103 ARP, Request who-has 192.168.120.1 tell 192.168.120.49, length 46
    14:23:56.873131 ARP, Reply 192.168.120.1 is-at 00:1a:9f:0c:4f:04, length 28
    14:23:56.873426 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 1
'\n'
    14:23:56.876020 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 30
"Using ethernet at 2188000 device"
    14:23:56.876021 ARP, Request who-has 192.168.120.1 tell 192.168.120.49, length 46
    14:23:56.876060 ARP, Reply 192.168.120.1 is-at 00:1a:9f:0c:4f:04, length 28
    14:23:56.876354 IP 192.168.120.49 > 192.168.120.1: ICMP echo request, id 0, seq 5, length 8
    14:23:56.876385 IP 192.168.120.1 > 192.168.120.49: ICMP echo reply, id 0, seq 5, length 8
    14:23:56.879037 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 28
"host 192.168.120.1 is alive"
    14:23:56.879272 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 3
"=> "
    14:24:01.890653 ARP, Request who-has 192.168.120.49 tell 192.168.120.1, length 28
    14:24:01.890933 ARP, Reply 192.168.120.49 is-at ca:fe:de:ca:f0:11, length 46

And, finally, the following tcpdump fragment captures ping to an unknown host.
(Not shown: the command "ping 192.168.120.2")

    14:35:57.680889 ARP, Request who-has 192.168.120.2 tell 192.168.120.49, length 46
    14:36:02.681255 ARP, Request who-has 192.168.120.2 tell 192.168.120.49, length 46
    14:36:02.786656 ARP, Request who-has 192.168.120.49 tell 192.168.120.1, length 28
    14:36:02.786953 ARP, Reply 192.168.120.49 is-at ca:fe:de:ca:f0:11, length 46
    14:36:04.154698 IP 192.168.120.1.53891 > 192.168.120.49.6666: UDP, length 1
^C
    14:36:04.155671 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 7
"Abort"
    14:36:04.159672 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 45
"ping failed; host 192.168.120.2 is not alive"
    14:36:04.159878 IP 192.168.120.49.6666 > 192.168.120.1.6666: UDP, length 3
"=> "


Ian Ray (2):
  net: net_up, net_down
  netconsole and networking co-existence

 drivers/net/netconsole.c |  45 +++++++------------
 include/net.h            |  28 ++++--------
 net/arp.c                |   7 ++-
 net/arp.h                |   1 +
 net/net.c                | 111 ++++++++++++++++++++++++++++++++++-------------
 net/ping.c               |   4 +-
 net/tftp.c               |   4 --
 net/wol.c                |   1 -
 8 files changed, 111 insertions(+), 90 deletions(-)

--
2.10.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-05  7:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 11:55 [RFC 0/2] netconsole and networking co-existence Ian Ray
2021-05-03 11:55 ` [RFC 1/2] net: net_up, net_down Ian Ray
2021-05-05  2:02   ` Ramon Fried
2021-05-05  7:04     ` EXT: " Ian Ray
2021-05-03 11:55 ` [RFC 2/2] netconsole and networking co-existence Ian Ray

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.