Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334005
b: refs/heads/master
c: ef59feb
h: refs/heads/master
i:
  334003: b2b04b2
v: v3
  • Loading branch information
stephen hemminger authored and David S. Miller committed Oct 11, 2012
1 parent 204b882 commit 05f358b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2a5cf8016c745191605f312a7cd7bd22e9be94a5
refs/heads/master: ef59febe3b2aa475bc2bf5b390db5e189f395710
31 changes: 20 additions & 11 deletions trunk/drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,22 @@ static inline u8 vxlan_ecn_encap(u8 tos,
return INET_ECN_encapsulate(tos, inner);
}

static __be32 vxlan_find_dst(struct vxlan_dev *vxlan, struct sk_buff *skb)
{
const struct ethhdr *eth = (struct ethhdr *) skb->data;
const struct vxlan_fdb *f;

if (is_multicast_ether_addr(eth->h_dest))
return vxlan->gaddr;

f = vxlan_find_mac(vxlan, eth->h_dest);
if (f)
return f->remote_ip;
else
return vxlan->gaddr;

}

/* Transmit local packets over Vxlan
*
* Outer IP header inherits ECN and DF from inner header.
Expand All @@ -632,35 +648,28 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct vxlan_dev *vxlan = netdev_priv(dev);
struct rtable *rt;
const struct ethhdr *eth;
const struct iphdr *old_iph;
struct iphdr *iph;
struct vxlanhdr *vxh;
struct udphdr *uh;
struct flowi4 fl4;
struct vxlan_fdb *f;
unsigned int pkt_len = skb->len;
u32 hash;
__be32 dst;
__be16 df = 0;
__u8 tos, ttl;
int err;

dst = vxlan_find_dst(vxlan, skb);
if (!dst)
goto drop;

/* Need space for new headers (invalidates iph ptr) */
if (skb_cow_head(skb, VXLAN_HEADROOM))
goto drop;

eth = (void *)skb->data;
old_iph = ip_hdr(skb);

if (!is_multicast_ether_addr(eth->h_dest) &&
(f = vxlan_find_mac(vxlan, eth->h_dest)))
dst = f->remote_ip;
else if (vxlan->gaddr) {
dst = vxlan->gaddr;
} else
goto drop;

ttl = vxlan->ttl;
if (!ttl && IN_MULTICAST(ntohl(dst)))
ttl = 1;
Expand Down

0 comments on commit 05f358b

Please sign in to comment.