vxlan: Use initializer for dummy structures
For the notification code, a couple of places build fdb entries on the stack, use structure initialization instead and fix formatting. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
9daaa397b3
commit
bb3fd6878a
1 changed files with 11 additions and 13 deletions
|
@ -311,14 +311,13 @@ errout:
|
||||||
static void vxlan_ip_miss(struct net_device *dev, __be32 ipa)
|
static void vxlan_ip_miss(struct net_device *dev, __be32 ipa)
|
||||||
{
|
{
|
||||||
struct vxlan_dev *vxlan = netdev_priv(dev);
|
struct vxlan_dev *vxlan = netdev_priv(dev);
|
||||||
struct vxlan_fdb f;
|
struct vxlan_fdb f = {
|
||||||
struct vxlan_rdst remote;
|
.state = NUD_STALE,
|
||||||
|
};
|
||||||
memset(&f, 0, sizeof f);
|
struct vxlan_rdst remote = {
|
||||||
f.state = NUD_STALE;
|
.remote_ip = ipa, /* goes to NDA_DST */
|
||||||
|
.remote_vni = VXLAN_N_VID,
|
||||||
remote.remote_ip = ipa; /* goes to NDA_DST */
|
};
|
||||||
remote.remote_vni = VXLAN_N_VID;
|
|
||||||
|
|
||||||
INIT_LIST_HEAD(&f.remotes);
|
INIT_LIST_HEAD(&f.remotes);
|
||||||
list_add_rcu(&remote.list, &f.remotes);
|
list_add_rcu(&remote.list, &f.remotes);
|
||||||
|
@ -328,11 +327,11 @@ static void vxlan_ip_miss(struct net_device *dev, __be32 ipa)
|
||||||
|
|
||||||
static void vxlan_fdb_miss(struct vxlan_dev *vxlan, const u8 eth_addr[ETH_ALEN])
|
static void vxlan_fdb_miss(struct vxlan_dev *vxlan, const u8 eth_addr[ETH_ALEN])
|
||||||
{
|
{
|
||||||
struct vxlan_fdb f;
|
struct vxlan_fdb f = {
|
||||||
|
.state = NUD_STALE,
|
||||||
|
};
|
||||||
|
|
||||||
memset(&f, 0, sizeof f);
|
|
||||||
INIT_LIST_HEAD(&f.remotes);
|
INIT_LIST_HEAD(&f.remotes);
|
||||||
f.state = NUD_STALE;
|
|
||||||
memcpy(f.eth_addr, eth_addr, ETH_ALEN);
|
memcpy(f.eth_addr, eth_addr, ETH_ALEN);
|
||||||
|
|
||||||
vxlan_fdb_notify(vxlan, &f, RTM_GETNEIGH);
|
vxlan_fdb_notify(vxlan, &f, RTM_GETNEIGH);
|
||||||
|
@ -1485,6 +1484,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port)
|
||||||
struct sockaddr_in vxlan_addr = {
|
struct sockaddr_in vxlan_addr = {
|
||||||
.sin_family = AF_INET,
|
.sin_family = AF_INET,
|
||||||
.sin_addr.s_addr = htonl(INADDR_ANY),
|
.sin_addr.s_addr = htonl(INADDR_ANY),
|
||||||
|
.sin_port = port,
|
||||||
};
|
};
|
||||||
int rc;
|
int rc;
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
|
@ -1510,8 +1510,6 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port)
|
||||||
sk = vs->sock->sk;
|
sk = vs->sock->sk;
|
||||||
sk_change_net(sk, net);
|
sk_change_net(sk, net);
|
||||||
|
|
||||||
vxlan_addr.sin_port = port;
|
|
||||||
|
|
||||||
rc = kernel_bind(vs->sock, (struct sockaddr *) &vxlan_addr,
|
rc = kernel_bind(vs->sock, (struct sockaddr *) &vxlan_addr,
|
||||||
sizeof(vxlan_addr));
|
sizeof(vxlan_addr));
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue