Thread (12 messages) flat view 12 messages, 2 authors, 20d ago

Re: [PATCH net-next 1/4] netconsole: add an address family to struct inet_addr

From: Gustavo Luiz Duarte <hidden>
Date: 2026-08-07 11:21:45
Also in: lkml

On Thu, Aug 6, 2026 at 4:49 PM Breno Leitao [off-list ref] wrote:
On Wed, Aug 05, 2026 at 10:33:01PM +0100, Gustavo Luiz Duarte wrote:
quoted
@@ -731,7 +733,7 @@ static void netconsole_print_banner(struct netconsole_target *nt)
 /* Parse the string and populate the `inet_addr` union. Return 0 if IPv4 is
                                                    ^-> there is no more union.

I think there are other references for union that needs to be updated as
well.
I fixed this in the next patch, but let me do it here for consistency.
I didn't find any other reference to union.
quoted
+static int netpoll_parse_ip_addr(const char *str, struct inet_addr *addr)
...
quoted
      return -1;
Should the failure path set addr->family = AF_UNSPEC?
The failure path leaves addr untouched, so if the user writes an invalid value
to local_ip or remote_ip the write fails and the original value is maintained.
quoted
+++ b/include/linux/netpoll.h
+struct inet_addr {
+     /* Address family: AF_UNSPEC when unset, else AF_INET or AF_INET6 */
+     u8                      family;
+     union {
+             __be32          ip;
+             struct in6_addr in6;
+     };
 };
Since a1116396476f6 ("netconsole: move local_ip/remote_ip/ipv6 to
netconsole_target") struct netpoll has no address member, and netconsole
is the only user left in the tree:

    drivers/net/netconsole.c:   union inet_addr         local_ip, remote_ip;
    drivers/net/netconsole.c:static int netpoll_parse_ip_addr(const char *str, union inet_addr *addr)

Since you touched it, can you move it to netconsole headers, please?
Sure, will do it in v2.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help