[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220126073521.1313870-4-liuhangbin@gmail.com>
Date: Wed, 26 Jan 2022 15:35:19 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: netdev@...r.kernel.org
Cc: Jay Vosburgh <j.vosburgh@...il.com>,
Veaceslav Falico <vfalico@...il.com>,
Andy Gospodarek <andy@...yhouse.net>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
David Ahern <dsahern@...il.com>,
Hangbin Liu <liuhangbin@...il.com>
Subject: [PATCH RFC net-next 3/5] bonding: add ip6_addr for bond_opt_value
Adding a new field ip6_addr for bond_opt_value so we can get
IPv6 address in future.
Also change the checking logic of __bond_opt_init(). Set string
or addr when there is, otherwise set the value.
Is there a need to update bond_opt_parse() for IPv6 address? I think the
checking in patch 05 should be enough.
Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
---
include/net/bond_options.h | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/net/bond_options.h b/include/net/bond_options.h
index dd75c071f67e..a9e68e88ff73 100644
--- a/include/net/bond_options.h
+++ b/include/net/bond_options.h
@@ -79,6 +79,7 @@ struct bond_opt_value {
char *string;
u64 value;
u32 flags;
+ struct in6_addr ip6_addr;
};
struct bonding;
@@ -118,17 +119,20 @@ const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val);
* When value is ULLONG_MAX then string will be used.
*/
static inline void __bond_opt_init(struct bond_opt_value *optval,
- char *string, u64 value)
+ char *string, u64 value, struct in6_addr *addr)
{
memset(optval, 0, sizeof(*optval));
optval->value = ULLONG_MAX;
- if (value == ULLONG_MAX)
+ if (string)
optval->string = string;
+ else if (addr)
+ optval->ip6_addr = *addr;
else
optval->value = value;
}
-#define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value)
-#define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX)
+#define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value, NULL)
+#define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX, NULL)
+#define bond_opt_initaddr(optval, addr) __bond_opt_init(optval, NULL, ULLONG_MAX, addr)
void bond_option_arp_ip_targets_clear(struct bonding *bond);
--
2.31.1
Powered by blists - more mailing lists