Currently DF handling is intertwined with path MTU discovery. This commit uses two new tunnel options to do special DF bit handling. TNL_F_DF_INHERIT determines whether the DF bit should be copied from the inner packet headers to the outer tunnel headers. TNL_F_DF_DEFAULT determines whether the DF bit is set if inheritance is turned off or if the inner packet isn't IP. TNL_F_PMTUD continues to determine whether the datapath sends frag needed messages back to the source if the DF bit is set and the packet size exceeds the calculated path MTU.
Suggested-by: Jesse Gross <[email protected]> Signed-off-by: Andrew Evans <[email protected]> Feature #5456. --- datapath/tunnel.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 899d1cd..45d94da 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -725,8 +725,9 @@ static bool check_mtu(struct sk_buff *skb, const struct tnl_mutable_config *mutable, const struct rtable *rt, __be16 *frag_offp) { + bool df_inherit = mutable->flags & TNL_F_DF_INHERIT; bool pmtud = mutable->flags & TNL_F_PMTUD; - __be16 frag_off = 0; + __be16 frag_off = mutable->flags & TNL_F_DF_DEFAULT ? htons(IP_DF) : 0; int mtu = 0; unsigned int packet_length = skb->len - ETH_HLEN; @@ -738,8 +739,6 @@ static bool check_mtu(struct sk_buff *skb, if (pmtud) { int vlan_header = 0; - frag_off = htons(IP_DF); - /* The tag needs to go in packet regardless of where it * currently is, so subtract it from the MTU. */ @@ -756,7 +755,8 @@ static bool check_mtu(struct sk_buff *skb, if (skb->protocol == htons(ETH_P_IP)) { struct iphdr *iph = ip_hdr(skb); - frag_off |= iph->frag_off & htons(IP_DF); + if (df_inherit) + frag_off = iph->frag_off & htons(IP_DF); if (pmtud && iph->frag_off & htons(IP_DF)) { mtu = max(mtu, IP_MIN_MTU); -- 1.7.4.1 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
