]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
netconsole: add support for strings with new line in netpoll_parse_ip_addr
authorBreno Leitao <leitao@debian.org>
Mon, 11 Aug 2025 18:13:26 +0000 (11:13 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 13 Aug 2025 00:32:42 +0000 (17:32 -0700)
commit364213b736e313fab963b272ebe5a2ffeb888831
tree165a209069ff224851cdcddd30e44d3c4b573135
parentfa38524ca5a783aa0cfc8ffa5730c5012edfccf4
netconsole: add support for strings with new line in netpoll_parse_ip_addr

The current IP address parsing logic fails when the input string
contains a trailing newline character. This can occur when IP
addresses are provided through configfs, which contains newlines in
a const buffer.

Teach netpoll_parse_ip_addr() how to ignore newlines at the end of the
IPs. Also, simplify the code by:

 * No need to check for separators. Try to parse ipv4, if it fails try
   ipv6 similarly to ceph_pton()
 * If ipv6 is not supported, don't call in6_pton() at all.

Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250811-netconsole_ref-v4-2-9c510d8713a2@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netconsole.c