X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Factions.c;h=dc74a3768776cf0e4d86171e439a8c4be9cbff76;hb=eba9291a25a9d38f3382510de52e619a65b2f711;hp=b5b92ba8f5b5389882bc6a9d143feb74df71ef85;hpb=fb516ed8c26a1b8c6d2be45eb4de183de242ed87;p=sliver-openvswitch.git diff --git a/datapath/actions.c b/datapath/actions.c index b5b92ba8f..dc74a3768 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -19,11 +19,10 @@ #include #include #include -#include #include #include +#include -#include "actions.h" #include "checksum.h" #include "datapath.h" #include "vlan.h" @@ -151,16 +150,10 @@ static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, *addr = new_addr; } -static void set_ip_tos(struct sk_buff *skb, struct iphdr *nh, u8 new_tos) +static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl) { - u8 old, new; - - /* Set the DSCP bits and preserve the ECN bits. */ - old = nh->tos; - new = new_tos | (nh->tos & INET_ECN_MASK); - csum_replace4(&nh->check, (__force __be32)old, - (__force __be32)new); - nh->tos = new; + csum_replace2(&nh->check, htons(nh->ttl << 8), htons(new_ttl << 8)); + nh->ttl = new_ttl; } static int set_ipv4(struct sk_buff *skb, const struct ovs_key_ipv4 *ipv4_key) @@ -182,7 +175,10 @@ static int set_ipv4(struct sk_buff *skb, const struct ovs_key_ipv4 *ipv4_key) set_ip_addr(skb, nh, &nh->daddr, ipv4_key->ipv4_dst); if (ipv4_key->ipv4_tos != nh->tos) - set_ip_tos(skb, nh, ipv4_key->ipv4_tos); + ipv4_change_dsfield(nh, 0, ipv4_key->ipv4_tos); + + if (ipv4_key->ipv4_ttl != nh->ttl) + set_ip_ttl(skb, nh, ipv4_key->ipv4_ttl); return 0; }