On 10/03/17 02:00, David Ahern wrote:
On 3/7/17 5:46 PM, Robert Shearman wrote:
@@ -244,24 +245,33 @@ static bool mpls_egress(struct mpls_route *rt, struct 
sk_buff *skb,
                payload_type = ip_hdr(skb)->version;

        switch (payload_type) {
-       case MPT_IPV4: {
-               struct iphdr *hdr4 = ip_hdr(skb);
+       case MPT_IPV4:
+               if (rt->rt_ttl_propagate == MPLS_TTL_PROP_ENABLED ||
+                   (rt->rt_ttl_propagate == MPLS_TTL_PROP_DEFAULT &&
+                    net->mpls.ip_ttl_propagate)) {
+                       struct iphdr *hdr4 = ip_hdr(skb);
+
+                       csum_replace2(&hdr4->check,
+                                     htons(hdr4->ttl << 8),
+                                     htons(dec.ttl << 8));
+                       hdr4->ttl = dec.ttl;
+               }
                skb->protocol = htons(ETH_P_IP);
-               csum_replace2(&hdr4->check,
-                             htons(hdr4->ttl << 8),
-                             htons(dec.ttl << 8));
-               hdr4->ttl = dec.ttl;
                success = true;
                break;
-       }
-       case MPT_IPV6: {
-               struct ipv6hdr *hdr6 = ipv6_hdr(skb);
+       case MPT_IPV6:
+               if (rt->rt_ttl_propagate == MPLS_TTL_PROP_ENABLED ||
+                   (rt->rt_ttl_propagate == MPLS_TTL_PROP_DEFAULT &&
+                    net->mpls.ip_ttl_propagate)) {
+                       struct ipv6hdr *hdr6 = ipv6_hdr(skb);
+
+                       hdr6->hop_limit = dec.ttl;
+               }
                skb->protocol = htons(ETH_P_IPV6);
-               hdr6->hop_limit = dec.ttl;
                success = true;
                break;
-       }

What decrements the TTL if it is not propagated from MPLS to IP?


Good point. Will address in v3.

Thanks,
Rob

Reply via email to