]> Pileus Git - ~andy/linux/blobdiff - drivers/net/vxlan.c
vxlan: compute source port in network byte order
[~andy/linux] / drivers / net / vxlan.c
index e532b2ab5b0f387c368d00e39a937dcecfdb83fe..66fd7bef0a4d9a88186afcbc3c6f724dde12c537 100644 (file)
@@ -1,14 +1,13 @@
 /*
  * VXLAN: Virtual eXtensible Local Area Network
  *
- * Copyright (c) 2012 Vyatta Inc.
+ * Copyright (c) 2012-2013 Vyatta Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
  * TODO
- *  - use IANA UDP port number (when defined)
  *  - IPv6 (not in RFC)
  */
 
@@ -65,7 +64,10 @@ struct vxlanhdr {
        __be32 vx_vni;
 };
 
-/* UDP port for VXLAN traffic. */
+/* UDP port for VXLAN traffic.
+ * The IANA assigned port is 4789, but the Linux default is 8472
+ * for compatability with early adopters.
+ */
 static unsigned int vxlan_port __read_mostly = 8472;
 module_param_named(udp_port, vxlan_port, uint, 0444);
 MODULE_PARM_DESC(udp_port, "Destination UDP port");
@@ -98,6 +100,7 @@ struct vxlan_fdb {
        unsigned long     used;
        struct vxlan_rdst remote;
        u16               state;        /* see ndm_state */
+       u8                flags;        /* see ndm_flags */
        u8                eth_addr[ETH_ALEN];
 };
 
@@ -105,10 +108,8 @@ struct vxlan_fdb {
 struct vxlan_dev {
        struct hlist_node hlist;
        struct net_device *dev;
-       __u32             vni;          /* virtual network id */
-       __be32            gaddr;        /* multicast group */
+       struct vxlan_rdst default_dst;  /* default destination */
        __be32            saddr;        /* source address */
-       unsigned int      link;         /* link to multicast over */
        __u16             port_min;     /* source port range */
        __u16             port_max;
        __u8              tos;          /* TOS override */
@@ -146,7 +147,7 @@ static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id)
        struct vxlan_dev *vxlan;
 
        hlist_for_each_entry_rcu(vxlan, vni_head(net, id), hlist) {
-               if (vxlan->vni == id)
+               if (vxlan->default_dst.remote_vni == id)
                        return vxlan;
        }
 
@@ -182,7 +183,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
                ndm->ndm_family = AF_BRIDGE;
        ndm->ndm_state = fdb->state;
        ndm->ndm_ifindex = vxlan->dev->ifindex;
-       ndm->ndm_flags = NTF_SELF;
+       ndm->ndm_flags = fdb->flags;
        ndm->ndm_type = NDA_DST;
 
        if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
@@ -191,10 +192,10 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
        if (send_ip && nla_put_be32(skb, NDA_DST, rdst->remote_ip))
                goto nla_put_failure;
 
-       if (rdst->remote_port && rdst->remote_port != vxlan_port &&
+       if (rdst->remote_port && rdst->remote_port != htons(vxlan_port) &&
            nla_put_be16(skb, NDA_PORT, rdst->remote_port))
                goto nla_put_failure;
-       if (rdst->remote_vni != vxlan->vni &&
+       if (rdst->remote_vni != vxlan->default_dst.remote_vni &&
            nla_put_be32(skb, NDA_VNI, rdst->remote_vni))
                goto nla_put_failure;
        if (rdst->remote_ifindex &&
@@ -221,7 +222,7 @@ static inline size_t vxlan_nlmsg_size(void)
        return NLMSG_ALIGN(sizeof(struct ndmsg))
                + nla_total_size(ETH_ALEN) /* NDA_LLADDR */
                + nla_total_size(sizeof(__be32)) /* NDA_DST */
-               + nla_total_size(sizeof(__be32)) /* NDA_PORT */
+               + nla_total_size(sizeof(__be16)) /* NDA_PORT */
                + nla_total_size(sizeof(__be32)) /* NDA_VNI */
                + nla_total_size(sizeof(__u32)) /* NDA_IFINDEX */
                + nla_total_size(sizeof(struct nda_cacheinfo));
@@ -316,7 +317,7 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
 
 /* Add/update destinations for multicast */
 static int vxlan_fdb_append(struct vxlan_fdb *f,
-                           __be32 ip, __u32 port, __u32 vni, __u32 ifindex)
+                           __be32 ip, __be16 port, __u32 vni, __u32 ifindex)
 {
        struct vxlan_rdst *rd_prev, *rd;
 
@@ -345,7 +346,8 @@ static int vxlan_fdb_append(struct vxlan_fdb *f,
 static int vxlan_fdb_create(struct vxlan_dev *vxlan,
                            const u8 *mac, __be32 ip,
                            __u16 state, __u16 flags,
-                           __u32 port, __u32 vni, __u32 ifindex)
+                           __be16 port, __u32 vni, __u32 ifindex,
+                           __u8 ndm_flags)
 {
        struct vxlan_fdb *f;
        int notify = 0;
@@ -362,6 +364,11 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
                        f->updated = jiffies;
                        notify = 1;
                }
+               if (f->flags != ndm_flags) {
+                       f->flags = ndm_flags;
+                       f->updated = jiffies;
+                       notify = 1;
+               }
                if ((flags & NLM_F_APPEND) &&
                    is_multicast_ether_addr(f->eth_addr)) {
                        int rc = vxlan_fdb_append(f, ip, port, vni, ifindex);
@@ -389,6 +396,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
                f->remote.remote_ifindex = ifindex;
                f->remote.remote_next = NULL;
                f->state = state;
+               f->flags = ndm_flags;
                f->updated = f->used = jiffies;
                memcpy(f->eth_addr, mac, ETH_ALEN);
 
@@ -403,7 +411,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
        return 0;
 }
 
-void vxlan_fdb_free(struct rcu_head *head)
+static void vxlan_fdb_free(struct rcu_head *head)
 {
        struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
 
@@ -436,7 +444,8 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
        struct vxlan_dev *vxlan = netdev_priv(dev);
        struct net *net = dev_net(vxlan->dev);
        __be32 ip;
-       u32 port, vni, ifindex;
+       __be16 port;
+       u32 vni, ifindex;
        int err;
 
        if (!(ndm->ndm_state & (NUD_PERMANENT|NUD_REACHABLE))) {
@@ -454,35 +463,35 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
        ip = nla_get_be32(tb[NDA_DST]);
 
        if (tb[NDA_PORT]) {
-               if (nla_len(tb[NDA_PORT]) != sizeof(u32))
+               if (nla_len(tb[NDA_PORT]) != sizeof(__be16))
                        return -EINVAL;
-               port = nla_get_u32(tb[NDA_PORT]);
+               port = nla_get_be16(tb[NDA_PORT]);
        } else
-               port = vxlan_port;
+               port = htons(vxlan_port);
 
        if (tb[NDA_VNI]) {
                if (nla_len(tb[NDA_VNI]) != sizeof(u32))
                        return -EINVAL;
                vni = nla_get_u32(tb[NDA_VNI]);
        } else
-               vni = vxlan->vni;
+               vni = vxlan->default_dst.remote_vni;
 
        if (tb[NDA_IFINDEX]) {
-               struct net_device *dev;
+               struct net_device *tdev;
 
                if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32))
                        return -EINVAL;
                ifindex = nla_get_u32(tb[NDA_IFINDEX]);
-               dev = dev_get_by_index(net, ifindex);
-               if (!dev)
+               tdev = dev_get_by_index(net, ifindex);
+               if (!tdev)
                        return -EADDRNOTAVAIL;
-               dev_put(dev);
+               dev_put(tdev);
        } else
                ifindex = 0;
 
        spin_lock_bh(&vxlan->hash_lock);
-       err = vxlan_fdb_create(vxlan, addr, ip, ndm->ndm_state, flags, port,
-               vni, ifindex);
+       err = vxlan_fdb_create(vxlan, addr, ip, ndm->ndm_state, flags,
+                              port, vni, ifindex, ndm->ndm_flags);
        spin_unlock_bh(&vxlan->hash_lock);
 
        return err;
@@ -570,7 +579,9 @@ static void vxlan_snoop(struct net_device *dev,
                err = vxlan_fdb_create(vxlan, src_mac, src_ip,
                                       NUD_REACHABLE,
                                       NLM_F_EXCL|NLM_F_CREATE,
-                                      vxlan_port, vxlan->vni, 0);
+                                      vxlan_port,
+                                      vxlan->default_dst.remote_vni,
+                                      0, NTF_SELF);
                spin_unlock(&vxlan->hash_lock);
        }
 }
@@ -591,7 +602,7 @@ static bool vxlan_group_used(struct vxlan_net *vn,
                        if (!netif_running(vxlan->dev))
                                continue;
 
-                       if (vxlan->gaddr == this->gaddr)
+                       if (vxlan->default_dst.remote_ip == this->default_dst.remote_ip)
                                return true;
                }
 
@@ -605,8 +616,8 @@ static int vxlan_join_group(struct net_device *dev)
        struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
        struct sock *sk = vn->sock->sk;
        struct ip_mreqn mreq = {
-               .imr_multiaddr.s_addr   = vxlan->gaddr,
-               .imr_ifindex            = vxlan->link,
+               .imr_multiaddr.s_addr   = vxlan->default_dst.remote_ip,
+               .imr_ifindex            = vxlan->default_dst.remote_ifindex,
        };
        int err;
 
@@ -633,8 +644,8 @@ static int vxlan_leave_group(struct net_device *dev)
        int err = 0;
        struct sock *sk = vn->sock->sk;
        struct ip_mreqn mreq = {
-               .imr_multiaddr.s_addr   = vxlan->gaddr,
-               .imr_ifindex            = vxlan->link,
+               .imr_multiaddr.s_addr   = vxlan->default_dst.remote_ip,
+               .imr_ifindex            = vxlan->default_dst.remote_ifindex,
        };
 
        /* Only leave group when last vxlan is done. */
@@ -792,7 +803,6 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
        n = neigh_lookup(&arp_tbl, &tip, dev);
 
        if (n) {
-               struct vxlan_dev *vxlan = netdev_priv(dev);
                struct vxlan_fdb *f;
                struct sk_buff  *reply;
 
@@ -864,28 +874,6 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
        return false;
 }
 
-/* Extract dsfield from inner protocol */
-static inline u8 vxlan_get_dsfield(const struct iphdr *iph,
-                                  const struct sk_buff *skb)
-{
-       if (skb->protocol == htons(ETH_P_IP))
-               return iph->tos;
-       else if (skb->protocol == htons(ETH_P_IPV6))
-               return ipv6_get_dsfield((const struct ipv6hdr *)iph);
-       else
-               return 0;
-}
-
-/* Propogate ECN bits out */
-static inline u8 vxlan_ecn_encap(u8 tos,
-                                const struct iphdr *iph,
-                                const struct sk_buff *skb)
-{
-       u8 inner = vxlan_get_dsfield(iph, skb);
-
-       return INET_ECN_encapsulate(tos, inner);
-}
-
 static void vxlan_sock_free(struct sk_buff *skb)
 {
        sock_put(skb->sk);
@@ -908,7 +896,7 @@ static void vxlan_set_owner(struct net_device *dev, struct sk_buff *skb)
  *     better and maybe available from hardware
  *   secondary choice is to use jhash on the Ethernet header
  */
-static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
+static __be16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
 {
        unsigned int range = (vxlan->port_max - vxlan->port_min) + 1;
        u32 hash;
@@ -918,7 +906,7 @@ static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
                hash = jhash(skb->data, 2 * ETH_ALEN,
                             (__force u32) skb->protocol);
 
-       return (((u64) hash * range) >> 32) + vxlan->port_min;
+       return htons((((u64) hash * range) >> 32) + vxlan->port_min);
 }
 
 static int handle_offloads(struct sk_buff *skb)
@@ -935,6 +923,37 @@ static int handle_offloads(struct sk_buff *skb)
        return 0;
 }
 
+/* Bypass encapsulation if the destination is local */
+static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
+                              struct vxlan_dev *dst_vxlan)
+{
+       struct pcpu_tstats *tx_stats = this_cpu_ptr(src_vxlan->dev->tstats);
+       struct pcpu_tstats *rx_stats = this_cpu_ptr(dst_vxlan->dev->tstats);
+
+       skb->pkt_type = PACKET_HOST;
+       skb->encapsulation = 0;
+       skb->dev = dst_vxlan->dev;
+       __skb_pull(skb, skb_network_offset(skb));
+
+       if (dst_vxlan->flags & VXLAN_F_LEARN)
+               vxlan_snoop(skb->dev, htonl(INADDR_LOOPBACK),
+                           eth_hdr(skb)->h_source);
+
+       u64_stats_update_begin(&tx_stats->syncp);
+       tx_stats->tx_packets++;
+       tx_stats->tx_bytes += skb->len;
+       u64_stats_update_end(&tx_stats->syncp);
+
+       if (netif_rx(skb) == NET_RX_SUCCESS) {
+               u64_stats_update_begin(&rx_stats->syncp);
+               rx_stats->rx_packets++;
+               rx_stats->rx_bytes += skb->len;
+               u64_stats_update_end(&rx_stats->syncp);
+       } else {
+               skb->dev->stats.rx_dropped++;
+       }
+}
+
 static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
                                  struct vxlan_rdst *rdst, bool did_rsc)
 {
@@ -945,35 +964,20 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
        struct vxlanhdr *vxh;
        struct udphdr *uh;
        struct flowi4 fl4;
-       unsigned int pkt_len = skb->len;
        __be32 dst;
-       __u16 src_port, dst_port;
+       __be16 src_port, dst_port;
         u32 vni;
        __be16 df = 0;
        __u8 tos, ttl;
 
-       dst_port = rdst->remote_port ? rdst->remote_port : vxlan_port;
+       dst_port = rdst->remote_port ? rdst->remote_port : htons(vxlan_port);
        vni = rdst->remote_vni;
        dst = rdst->remote_ip;
 
        if (!dst) {
                if (did_rsc) {
-                       __skb_pull(skb, skb_network_offset(skb));
-                       skb->ip_summed = CHECKSUM_NONE;
-                       skb->pkt_type = PACKET_HOST;
-
                        /* short-circuited back to local bridge */
-                       if (netif_rx(skb) == NET_RX_SUCCESS) {
-                               struct pcpu_tstats *stats = this_cpu_ptr(dev->tstats);
-
-                               u64_stats_update_begin(&stats->syncp);
-                               stats->tx_packets++;
-                               stats->tx_bytes += pkt_len;
-                               u64_stats_update_end(&stats->syncp);
-                       } else {
-                               dev->stats.tx_errors++;
-                               dev->stats.tx_aborted_errors++;
-                       }
+                       vxlan_encap_bypass(skb, vxlan, vxlan);
                        return NETDEV_TX_OK;
                }
                goto drop;
@@ -996,7 +1000,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 
        tos = vxlan->tos;
        if (tos == 1)
-               tos = vxlan_get_dsfield(old_iph, skb);
+               tos = ip_tunnel_get_dsfield(old_iph, skb);
 
        src_port = vxlan_src_port(vxlan, skb);
 
@@ -1020,6 +1024,19 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
                goto tx_error;
        }
 
+       /* Bypass encapsulation if the destination is local */
+       if (rt->rt_flags & RTCF_LOCAL &&
+           !(rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))) {
+               struct vxlan_dev *dst_vxlan;
+
+               ip_rt_put(rt);
+               dst_vxlan = vxlan_find_vni(dev_net(dev), vni);
+               if (!dst_vxlan)
+                       goto tx_error;
+               vxlan_encap_bypass(skb, vxlan, dst_vxlan);
+               return NETDEV_TX_OK;
+       }
+
        memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
        IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
                              IPSKB_REROUTED);
@@ -1034,8 +1051,8 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
        skb_reset_transport_header(skb);
        uh = udp_hdr(skb);
 
-       uh->dest = htons(dst_port);
-       uh->source = htons(src_port);
+       uh->dest = dst_port;
+       uh->source = src_port;
 
        uh->len = htons(skb->len);
        uh->check = 0;
@@ -1047,7 +1064,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
        iph->ihl        = sizeof(struct iphdr) >> 2;
        iph->frag_off   = df;
        iph->protocol   = IPPROTO_UDP;
-       iph->tos        = vxlan_ecn_encap(tos, old_iph, skb);
+       iph->tos        = ip_tunnel_ecn_encap(tos, old_iph, skb);
        iph->daddr      = dst;
        iph->saddr      = fl4.saddr;
        iph->ttl        = ttl ? : ip4_dst_hoplimit(&rt->dst);
@@ -1085,7 +1102,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
        struct vxlan_dev *vxlan = netdev_priv(dev);
        struct ethhdr *eth;
        bool did_rsc = false;
-       struct vxlan_rdst group, *rdst0, *rdst;
+       struct vxlan_rdst *rdst0, *rdst;
        struct vxlan_fdb *f;
        int rc1, rc;
 
@@ -1094,20 +1111,21 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 
        if ((vxlan->flags & VXLAN_F_PROXY) && ntohs(eth->h_proto) == ETH_P_ARP)
                return arp_reduce(dev, skb);
-       else if ((vxlan->flags&VXLAN_F_RSC) && ntohs(eth->h_proto) == ETH_P_IP)
-               did_rsc = route_shortcircuit(dev, skb);
 
        f = vxlan_find_mac(vxlan, eth->h_dest);
+       did_rsc = false;
+
+       if (f && (f->flags & NTF_ROUTER) && (vxlan->flags & VXLAN_F_RSC) &&
+           ntohs(eth->h_proto) == ETH_P_IP) {
+               did_rsc = route_shortcircuit(dev, skb);
+               if (did_rsc)
+                       f = vxlan_find_mac(vxlan, eth->h_dest);
+       }
+
        if (f == NULL) {
-               did_rsc = false;
-               group.remote_port = vxlan_port;
-               group.remote_vni = vxlan->vni;
-               group.remote_ip = vxlan->gaddr;
-               group.remote_ifindex = vxlan->link;
-               group.remote_next = 0;
-               rdst0 = &group;
-
-               if (group.remote_ip == htonl(INADDR_ANY) &&
+               rdst0 = &vxlan->default_dst;
+
+               if (rdst0->remote_ip == htonl(INADDR_ANY) &&
                    (vxlan->flags & VXLAN_F_L2MISS) &&
                    !is_multicast_ether_addr(eth->h_dest))
                        vxlan_fdb_miss(vxlan, eth->h_dest);
@@ -1185,7 +1203,7 @@ static int vxlan_open(struct net_device *dev)
        struct vxlan_dev *vxlan = netdev_priv(dev);
        int err;
 
-       if (vxlan->gaddr) {
+       if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) {
                err = vxlan_join_group(dev);
                if (err)
                        return err;
@@ -1219,7 +1237,7 @@ static int vxlan_stop(struct net_device *dev)
 {
        struct vxlan_dev *vxlan = netdev_priv(dev);
 
-       if (vxlan->gaddr)
+       if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)))
                vxlan_leave_group(dev);
 
        del_timer_sync(&vxlan->age_timer);
@@ -1343,14 +1361,6 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
                        return -ERANGE;
        }
 
-       if (data[IFLA_VXLAN_GROUP]) {
-               __be32 gaddr = nla_get_be32(data[IFLA_VXLAN_GROUP]);
-               if (!IN_MULTICAST(ntohl(gaddr))) {
-                       pr_debug("group address is not IPv4 multicast\n");
-                       return -EADDRNOTAVAIL;
-               }
-       }
-
        if (data[IFLA_VXLAN_PORT_RANGE]) {
                const struct ifla_vxlan_port_range *p
                        = nla_data(data[IFLA_VXLAN_PORT_RANGE]);
@@ -1381,6 +1391,7 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
                         struct nlattr *tb[], struct nlattr *data[])
 {
        struct vxlan_dev *vxlan = netdev_priv(dev);
+       struct vxlan_rdst *dst = &vxlan->default_dst;
        __u32 vni;
        int err;
 
@@ -1392,21 +1403,21 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
                pr_info("duplicate VNI %u\n", vni);
                return -EEXIST;
        }
-       vxlan->vni = vni;
+       dst->remote_vni = vni;
 
        if (data[IFLA_VXLAN_GROUP])
-               vxlan->gaddr = nla_get_be32(data[IFLA_VXLAN_GROUP]);
+               dst->remote_ip = nla_get_be32(data[IFLA_VXLAN_GROUP]);
 
        if (data[IFLA_VXLAN_LOCAL])
                vxlan->saddr = nla_get_be32(data[IFLA_VXLAN_LOCAL]);
 
        if (data[IFLA_VXLAN_LINK] &&
-           (vxlan->link = nla_get_u32(data[IFLA_VXLAN_LINK]))) {
+           (dst->remote_ifindex = nla_get_u32(data[IFLA_VXLAN_LINK]))) {
                struct net_device *lowerdev
-                        = __dev_get_by_index(net, vxlan->link);
+                        = __dev_get_by_index(net, dst->remote_ifindex);
 
                if (!lowerdev) {
-                       pr_info("ifindex %d does not exist\n", vxlan->link);
+                       pr_info("ifindex %d does not exist\n", dst->remote_ifindex);
                        return -ENODEV;
                }
 
@@ -1458,7 +1469,7 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 
        err = register_netdevice(dev);
        if (!err)
-               hlist_add_head_rcu(&vxlan->hlist, vni_head(net, vxlan->vni));
+               hlist_add_head_rcu(&vxlan->hlist, vni_head(net, dst->remote_vni));
 
        return err;
 }
@@ -1495,18 +1506,19 @@ static size_t vxlan_get_size(const struct net_device *dev)
 static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 {
        const struct vxlan_dev *vxlan = netdev_priv(dev);
+       const struct vxlan_rdst *dst = &vxlan->default_dst;
        struct ifla_vxlan_port_range ports = {
                .low =  htons(vxlan->port_min),
                .high = htons(vxlan->port_max),
        };
 
-       if (nla_put_u32(skb, IFLA_VXLAN_ID, vxlan->vni))
+       if (nla_put_u32(skb, IFLA_VXLAN_ID, dst->remote_vni))
                goto nla_put_failure;
 
-       if (vxlan->gaddr && nla_put_be32(skb, IFLA_VXLAN_GROUP, vxlan->gaddr))
+       if (dst->remote_ip && nla_put_be32(skb, IFLA_VXLAN_GROUP, dst->remote_ip))
                goto nla_put_failure;
 
-       if (vxlan->link && nla_put_u32(skb, IFLA_VXLAN_LINK, vxlan->link))
+       if (dst->remote_ifindex && nla_put_u32(skb, IFLA_VXLAN_LINK, dst->remote_ifindex))
                goto nla_put_failure;
 
        if (vxlan->saddr && nla_put_be32(skb, IFLA_VXLAN_LOCAL, vxlan->saddr))
@@ -1654,5 +1666,5 @@ module_exit(vxlan_cleanup_module);
 
 MODULE_LICENSE("GPL");
 MODULE_VERSION(VXLAN_VERSION);
-MODULE_AUTHOR("Stephen Hemminger <shemminger@vyatta.com>");
+MODULE_AUTHOR("Stephen Hemminger <stephen@networkplumber.org>");
 MODULE_ALIAS_RTNL_LINK("vxlan");