All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] bonding: show NS IPv6 targets in proc master info
@ 2022-05-27  6:44 Hangbin Liu
  2022-05-27 14:13 ` Jonathan Toppins
  0 siblings, 1 reply; 6+ messages in thread
From: Hangbin Liu @ 2022-05-27  6:44 UTC (permalink / raw)
  To: netdev
  Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
	David S . Miller, Jakub Kicinski, Jonathan Toppins, Eric Dumazet,
	Paolo Abeni, Hangbin Liu, Li Liang

When adding bond new parameter ns_targets. I forgot to print this
in bond master proc info. After updating, the bond master info will looks
like:

ARP IP target/s (n.n.n.n form): 192.168.1.254
NS IPv6 target/s (XX::XX form): 2022::1, 2022::2

Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
Reported-by: Li Liang <liali@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 drivers/net/bonding/bond_procfs.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index cfe37be42be4..b6c012270e2e 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -129,6 +129,19 @@ static void bond_info_show_master(struct seq_file *seq)
 			printed = 1;
 		}
 		seq_printf(seq, "\n");
+
+		printed = 0;
+		seq_printf(seq, "NS IPv6 target/s (xx::xx form):");
+
+		for (i = 0; (i < BOND_MAX_NS_TARGETS); i++) {
+			if (ipv6_addr_any(&bond->params.ns_targets[i]))
+				break;
+			if (printed)
+				seq_printf(seq, ",");
+			seq_printf(seq, " %pI6c", &bond->params.ns_targets[i]);
+			printed = 1;
+		}
+		seq_printf(seq, "\n");
 	}
 
 	if (BOND_MODE(bond) == BOND_MODE_8023AD) {
-- 
2.35.1


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

* Re: [PATCH net] bonding: show NS IPv6 targets in proc master info
  2022-05-27  6:44 [PATCH net] bonding: show NS IPv6 targets in proc master info Hangbin Liu
@ 2022-05-27 14:13 ` Jonathan Toppins
  2022-05-27 23:21   ` Jay Vosburgh
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Toppins @ 2022-05-27 14:13 UTC (permalink / raw)
  To: Hangbin Liu, netdev
  Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
	David S . Miller, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Li Liang

On 5/27/22 02:44, Hangbin Liu wrote:
> When adding bond new parameter ns_targets. I forgot to print this
> in bond master proc info. After updating, the bond master info will looks
                                                                look ---^
> like:
> 
> ARP IP target/s (n.n.n.n form): 192.168.1.254
> NS IPv6 target/s (XX::XX form): 2022::1, 2022::2
> 
> Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
> Reported-by: Li Liang <liali@redhat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
>   drivers/net/bonding/bond_procfs.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
> index cfe37be42be4..b6c012270e2e 100644
> --- a/drivers/net/bonding/bond_procfs.c
> +++ b/drivers/net/bonding/bond_procfs.c
> @@ -129,6 +129,19 @@ static void bond_info_show_master(struct seq_file *seq)
>   			printed = 1;
>   		}
>   		seq_printf(seq, "\n");

Does this need to be guarded by "#if IS_ENABLED(CONFIG_IPV6)"?
> +
> +		printed = 0;
> +		seq_printf(seq, "NS IPv6 target/s (xx::xx form):");
> +
> +		for (i = 0; (i < BOND_MAX_NS_TARGETS); i++) {
> +			if (ipv6_addr_any(&bond->params.ns_targets[i]))
> +				break;
> +			if (printed)
> +				seq_printf(seq, ",");
> +			seq_printf(seq, " %pI6c", &bond->params.ns_targets[i]);
> +			printed = 1;
> +		}
> +		seq_printf(seq, "\n");
>   	}
>   
>   	if (BOND_MODE(bond) == BOND_MODE_8023AD) {


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

* Re: [PATCH net] bonding: show NS IPv6 targets in proc master info
  2022-05-27 14:13 ` Jonathan Toppins
@ 2022-05-27 23:21   ` Jay Vosburgh
  2022-05-30  3:01     ` Hangbin Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Jay Vosburgh @ 2022-05-27 23:21 UTC (permalink / raw)
  To: Jonathan Toppins
  Cc: Hangbin Liu, netdev, Veaceslav Falico, Andy Gospodarek,
	David S . Miller, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Li Liang

Jonathan Toppins <jtoppins@redhat.com> wrote:

>On 5/27/22 02:44, Hangbin Liu wrote:
>> When adding bond new parameter ns_targets. I forgot to print this
>> in bond master proc info. After updating, the bond master info will looks
>                                                               look ---^
>> like:
>> ARP IP target/s (n.n.n.n form): 192.168.1.254
>> NS IPv6 target/s (XX::XX form): 2022::1, 2022::2
>> Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
>> Reported-by: Li Liang <liali@redhat.com>
>> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>> ---
>>   drivers/net/bonding/bond_procfs.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>> diff --git a/drivers/net/bonding/bond_procfs.c
>> b/drivers/net/bonding/bond_procfs.c
>> index cfe37be42be4..b6c012270e2e 100644
>> --- a/drivers/net/bonding/bond_procfs.c
>> +++ b/drivers/net/bonding/bond_procfs.c
>> @@ -129,6 +129,19 @@ static void bond_info_show_master(struct seq_file *seq)
>>   			printed = 1;
>>   		}
>>   		seq_printf(seq, "\n");
>
>Does this need to be guarded by "#if IS_ENABLED(CONFIG_IPV6)"?

	On looking at it, the definition of ns_targets in struct
bond_params isn't gated by CONFIG_IPV6, either (and is 256 bytes for
just ns_targets).

	I suspect this will all compile even if CONFIG_IPV6 isn't
enabled, since functions like ipv6_addr_any are defined regardless of
the CONFIG_IPV6 setting, but it's dead code that shouldn't be built if
CONFIG_IPV6 isn't set.

	The options code for ns_targets depends on CONFIG_IPV6, so
making this conditional as well would be consistent.

	-J

>> +
>> +		printed = 0;
>> +		seq_printf(seq, "NS IPv6 target/s (xx::xx form):");
>> +
>> +		for (i = 0; (i < BOND_MAX_NS_TARGETS); i++) {
>> +			if (ipv6_addr_any(&bond->params.ns_targets[i]))
>> +				break;
>> +			if (printed)
>> +				seq_printf(seq, ",");
>> +			seq_printf(seq, " %pI6c", &bond->params.ns_targets[i]);
>> +			printed = 1;
>> +		}
>> +		seq_printf(seq, "\n");
>>   	}
>>     	if (BOND_MODE(bond) == BOND_MODE_8023AD) {
>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

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

* Re: [PATCH net] bonding: show NS IPv6 targets in proc master info
  2022-05-27 23:21   ` Jay Vosburgh
@ 2022-05-30  3:01     ` Hangbin Liu
  2022-05-30  3:35       ` Jonathan Toppins
  0 siblings, 1 reply; 6+ messages in thread
From: Hangbin Liu @ 2022-05-30  3:01 UTC (permalink / raw)
  To: Jay Vosburgh
  Cc: Jonathan Toppins, netdev, Veaceslav Falico, Andy Gospodarek,
	David S . Miller, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Li Liang

On Fri, May 27, 2022 at 04:21:45PM -0700, Jay Vosburgh wrote:
> Jonathan Toppins <jtoppins@redhat.com> wrote:
> 
> >On 5/27/22 02:44, Hangbin Liu wrote:
> >> When adding bond new parameter ns_targets. I forgot to print this
> >> in bond master proc info. After updating, the bond master info will looks
> >                                                               look ---^
> >> like:
> >> ARP IP target/s (n.n.n.n form): 192.168.1.254
> >> NS IPv6 target/s (XX::XX form): 2022::1, 2022::2
> >> Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
> >> Reported-by: Li Liang <liali@redhat.com>
> >> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> >> ---
> >>   drivers/net/bonding/bond_procfs.c | 13 +++++++++++++
> >>   1 file changed, 13 insertions(+)
> >> diff --git a/drivers/net/bonding/bond_procfs.c
> >> b/drivers/net/bonding/bond_procfs.c
> >> index cfe37be42be4..b6c012270e2e 100644
> >> --- a/drivers/net/bonding/bond_procfs.c
> >> +++ b/drivers/net/bonding/bond_procfs.c
> >> @@ -129,6 +129,19 @@ static void bond_info_show_master(struct seq_file *seq)
> >>   			printed = 1;
> >>   		}
> >>   		seq_printf(seq, "\n");
> >
> >Does this need to be guarded by "#if IS_ENABLED(CONFIG_IPV6)"?
> 
> 	On looking at it, the definition of ns_targets in struct
> bond_params isn't gated by CONFIG_IPV6, either (and is 256 bytes for
> just ns_targets).
> 
> 	I suspect this will all compile even if CONFIG_IPV6 isn't
> enabled, since functions like ipv6_addr_any are defined regardless of
> the CONFIG_IPV6 setting, but it's dead code that shouldn't be built if
> CONFIG_IPV6 isn't set.

Yes, I didn't protect the code if if could be build without CONFIG_IPV6.
e.g. function bond_get_targets_ip6(). Do you think if I should also
add the condition for bond_get_targets_ip6() and ns_targets in struct
bond_params?

> 
> 	The options code for ns_targets depends on CONFIG_IPV6, so
> making this conditional as well would be consistent.

I will add the protection for this patch.

Thanks
Hangbin

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

* Re: [PATCH net] bonding: show NS IPv6 targets in proc master info
  2022-05-30  3:01     ` Hangbin Liu
@ 2022-05-30  3:35       ` Jonathan Toppins
  2022-05-30  5:41         ` Hangbin Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Toppins @ 2022-05-30  3:35 UTC (permalink / raw)
  To: Hangbin Liu, Jay Vosburgh
  Cc: netdev, Veaceslav Falico, Andy Gospodarek, David S . Miller,
	Jakub Kicinski, Eric Dumazet, Paolo Abeni, Li Liang

On 5/29/22 23:01, Hangbin Liu wrote:
> On Fri, May 27, 2022 at 04:21:45PM -0700, Jay Vosburgh wrote:
>> Jonathan Toppins <jtoppins@redhat.com> wrote:
>>
>>> On 5/27/22 02:44, Hangbin Liu wrote:
>>>> When adding bond new parameter ns_targets. I forgot to print this
>>>> in bond master proc info. After updating, the bond master info will looks
>>>                                                                look ---^
>>>> like:
>>>> ARP IP target/s (n.n.n.n form): 192.168.1.254
>>>> NS IPv6 target/s (XX::XX form): 2022::1, 2022::2
>>>> Fixes: 4e24be018eb9 ("bonding: add new parameter ns_targets")
>>>> Reported-by: Li Liang <liali@redhat.com>
>>>> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
>>>> ---
>>>>    drivers/net/bonding/bond_procfs.c | 13 +++++++++++++
>>>>    1 file changed, 13 insertions(+)
>>>> diff --git a/drivers/net/bonding/bond_procfs.c
>>>> b/drivers/net/bonding/bond_procfs.c
>>>> index cfe37be42be4..b6c012270e2e 100644
>>>> --- a/drivers/net/bonding/bond_procfs.c
>>>> +++ b/drivers/net/bonding/bond_procfs.c
>>>> @@ -129,6 +129,19 @@ static void bond_info_show_master(struct seq_file *seq)
>>>>    			printed = 1;
>>>>    		}
>>>>    		seq_printf(seq, "\n");
>>>
>>> Does this need to be guarded by "#if IS_ENABLED(CONFIG_IPV6)"?
>>
>> 	On looking at it, the definition of ns_targets in struct
>> bond_params isn't gated by CONFIG_IPV6, either (and is 256 bytes for
>> just ns_targets).
>>
>> 	I suspect this will all compile even if CONFIG_IPV6 isn't
>> enabled, since functions like ipv6_addr_any are defined regardless of
>> the CONFIG_IPV6 setting, but it's dead code that shouldn't be built if
>> CONFIG_IPV6 isn't set.
> 
> Yes, I didn't protect the code if if could be build without CONFIG_IPV6.
> e.g. function bond_get_targets_ip6(). Do you think if I should also
> add the condition for bond_get_targets_ip6() and ns_targets in struct
> bond_params?

Yes, if the code that will use the entries in `struct bonding` and 
`struct bond_params` is going to be compiled out these entries should be 
compiled out as well.

Also, I was looking over the code in bond_options.c:bond_opts, and the 
entry `BOND_OPT_NS_TARGETS` is the only bonding option that will be left 
uninitialized if IPv6 is disabled. Does the bonding options infra handle 
this correctly or do you need a dummy set of values when IPv6 is disabled?


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

* Re: [PATCH net] bonding: show NS IPv6 targets in proc master info
  2022-05-30  3:35       ` Jonathan Toppins
@ 2022-05-30  5:41         ` Hangbin Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Hangbin Liu @ 2022-05-30  5:41 UTC (permalink / raw)
  To: Jonathan Toppins
  Cc: Jay Vosburgh, netdev, Veaceslav Falico, Andy Gospodarek,
	David S . Miller, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Li Liang

On Sun, May 29, 2022 at 11:35:21PM -0400, Jonathan Toppins wrote:
> > Yes, I didn't protect the code if if could be build without CONFIG_IPV6.
> > e.g. function bond_get_targets_ip6(). Do you think if I should also
> > add the condition for bond_get_targets_ip6() and ns_targets in struct
> > bond_params?
> 
> Yes, if the code that will use the entries in `struct bonding` and `struct
> bond_params` is going to be compiled out these entries should be compiled
> out as well.

OK, I will fix it.
> 
> Also, I was looking over the code in bond_options.c:bond_opts, and the entry
> `BOND_OPT_NS_TARGETS` is the only bonding option that will be left
> uninitialized if IPv6 is disabled. Does the bonding options infra handle
> this correctly or do you need a dummy set of values when IPv6 is disabled?
> 

The only entry to set ns_target is via netlink, which has protected by
CONFIG_IPV6. So I think it's safe now. To make it more safer. I will add
a dummy set.

Thanks
Hangbin

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

end of thread, other threads:[~2022-05-30  5:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27  6:44 [PATCH net] bonding: show NS IPv6 targets in proc master info Hangbin Liu
2022-05-27 14:13 ` Jonathan Toppins
2022-05-27 23:21   ` Jay Vosburgh
2022-05-30  3:01     ` Hangbin Liu
2022-05-30  3:35       ` Jonathan Toppins
2022-05-30  5:41         ` Hangbin Liu

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.