bonding: show NS IPv6 targets in proc master info
Subsystems (3)
PATCH 1/1 bonding: show NS IPv6 targets in proc master info
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
--- drivers/net/bonding/bond_procfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/bonding/bond_procfs.c +13 -0
@@ -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 ) {
Signature · 1 line
2.35.1
Quoted 2 lines · Hangbin Liu
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 ---^
Quoted 17 lines
like:
ARP IP target/s (n.n.n.n form): 192.168.1.254
NS IPv6 target/s (XX::XXform): 2022::1, 2022::2Fixes 4e24be018eb9 ("bonding: add new parameter ns_targets")Reported-by Li Liang <[email protected]>Signed-off-by Hangbin Liu <[email protected]>--- drivers/net/bonding/bond_procfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/net/bonding/bond_procfs.c +0
-0
drivers/net/bonding/bond_procfs.c static void bond_info_show_master(struct seq_file *seq) · line 131
Quoted 3 lines
drivers/net/bonding/bond_procfs.c +0
-0@@ -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)"?
Quoted 16 lines
drivers/net/bonding/bond_procfs.c +13
-0+ + 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 ) {
Quoted 16 lines · Jonathan Toppins
Quoted 2 lines · Hangbin Liu
When adding bond new parameter
ns_targets. I forgot to print this in bond master proc info. After updating, the bond master info will lookslook ---^Quoted 12 lines
like:
ARP IP target/s (n.n.n.n form): 192.168.1.254
NS IPv6 target/s (XX::XXform): 2022::1, 2022::2Fixes 4e24be018eb9 ("bonding: add new parameter ns_targets")Reported-by Li Liang <[email protected]>Signed-off-by Hangbin Liu <[email protected]>--- drivers/net/bonding/bond_procfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/net/bonding/bond_procfs.c +0
-0
Quoted 8 lines
drivers/net/bonding/bond_procfs.c static void bond_info_show_master(struct seq_file *seq) · line 131
Quoted 6 lines
drivers/net/bonding/bond_procfs.c +0
-0@@ -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 structbond_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
Quoted 7 lines
Quoted 7 lines
drivers/net/bonding/bond_procfs.c +7
-0+ + 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 ;
Quoted 9 lines
drivers/net/bonding/bond_procfs.c static void bond_info_show_master(struct seq_file *seq) · line 147
Quoted 8 lines
drivers/net/bonding/bond_procfs.c +6
-0+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, [email protected]
Quoted 27 lines · Jay Vosburgh
Quoted 16 lines · Jonathan Toppins
Quoted 2 lines · Hangbin Liu
When adding bond new parameter
ns_targets. I forgot to print this in bond master proc info. After updating, the bond master info will lookslook ---^Quoted 12 lines
like:
ARP IP target/s (n.n.n.n form): 192.168.1.254
NS IPv6 target/s (XX::XXform): 2022::1, 2022::2Fixes 4e24be018eb9 ("bonding: add new parameter ns_targets")Reported-by Li Liang <[email protected]>Signed-off-by Hangbin Liu <[email protected]>--- drivers/net/bonding/bond_procfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/net/bonding/bond_procfs.c +0
-0Quoted 8 lines
drivers/net/bonding/bond_procfs.c static void bond_info_show_master(struct seq_file *seq) · line 131
Quoted 6 lines
drivers/net/bonding/bond_procfs.c +0
-0@@ -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)"?
Quoted 8 lines
On looking at it, the definition of
ns_targetsin structbond_paramsisn't gated byCONFIG_IPV6, either (and is 256 bytes for justns_targets).I suspect this will all compile even if
CONFIG_IPV6isn't
enabled, since functions likeipv6_addr_anyare defined regardless of theCONFIG_IPV6setting, but it's dead code that shouldn't be built ifCONFIG_IPV6isn'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?
Quoted 3 lines
The options code for
ns_targetsdepends onCONFIG_IPV6, so
making this conditional as well would be consistent.
I will add the protection for this patch.
Thanks
Hangbin
Quoted 37 lines · Hangbin Liu
Quoted 27 lines · Jay Vosburgh
Quoted 16 lines · Jonathan Toppins
Quoted 2 lines · Hangbin Liu
When adding bond new parameter
ns_targets. I forgot to print this in bond master proc info. After updating, the bond master info will lookslook ---^Quoted 12 lines
like:
ARP IP target/s (n.n.n.n form): 192.168.1.254
NS IPv6 target/s (XX::XXform): 2022::1, 2022::2Fixes 4e24be018eb9 ("bonding: add new parameter ns_targets")Reported-by Li Liang <[email protected]>Signed-off-by Hangbin Liu <[email protected]>--- drivers/net/bonding/bond_procfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/net/bonding/bond_procfs.c +0
-0Quoted 8 lines
drivers/net/bonding/bond_procfs.c static void bond_info_show_master(struct seq_file *seq) · line 131
Quoted 6 lines
drivers/net/bonding/bond_procfs.c +0
-0@@ -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)"?Quoted 8 lines
On looking at it, the definition of
ns_targetsin structbond_paramsisn't gated byCONFIG_IPV6, either (and is 256 bytes for justns_targets).I suspect this will all compile even if
CONFIG_IPV6isn't
enabled, since functions likeipv6_addr_anyare defined regardless of theCONFIG_IPV6setting, but it's dead code that shouldn't be built ifCONFIG_IPV6isn't set.
Quoted 4 lines
Yes, I didn't protect the code if if could be build without
CONFIG_IPV6. e.g. functionbond_get_targets_ip6(). Do you think if I should also add the condition forbond_get_targets_ip6()andns_targetsin structbond_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?
Quoted 8 lines · Jonathan Toppins
Quoted 4 lines
Yes, I didn't protect the code if if could be build without
CONFIG_IPV6. e.g. functionbond_get_targets_ip6(). Do you think if I should also add the condition forbond_get_targets_ip6()andns_targetsin structbond_params?Yes, if the code that will use the entries in
struct bondingandstruct bond_paramsis going to be compiled out these entries should be compiled out as well.
OK, I will fix it.
Quoted 6 lines
Also, I was looking over the code in bond_options.c:bond_opts, and the entry
BOND_OPT_NS_TARGETSis 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