X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Factions.c;h=61b903f683fe24d1158dad6ea9acbf6882eeb626;hb=a61680c6d15fa1f1ae3072a83c0e3d7ed08f6048;hp=3296dee8437a7400afd52290d17c24bec8c75cd1;hpb=530180fd5a99e2c55107831f99fee84d6780f38c;p=sliver-openvswitch.git diff --git a/datapath/actions.c b/datapath/actions.c index 3296dee84..61b903f68 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -151,6 +151,12 @@ static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, *addr = new_addr; } +static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl) +{ + 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) { struct iphdr *nh; @@ -172,6 +178,9 @@ static int set_ipv4(struct sk_buff *skb, const struct ovs_key_ipv4 *ipv4_key) if (ipv4_key->ipv4_tos != nh->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; }