On 31/01/17 01:09, David Ahern wrote:
On 1/30/17 1:36 PM, Robert Shearman wrote:
@@ -243,24 +245,29 @@ 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);
-               skb->protocol = htons(ETH_P_IP);
-               csum_replace2(&hdr4->check,
-                             htons(hdr4->ttl << 8),
-                             htons(dec.ttl << 8));
-               hdr4->ttl = dec.ttl;
+       case MPT_IPV4:
+               if (net->mpls.ip_ttl_propagate) {
+                       struct iphdr *hdr4 = ip_hdr(skb);
+
+                       skb->protocol = htons(ETH_P_IP);

The protocol setting here and ...

+                       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);
-               skb->protocol = htons(ETH_P_IPV6);
-               hdr6->hop_limit = dec.ttl;
+       case MPT_IPV6:
+               if (net->mpls.ip_ttl_propagate) {
+                       struct ipv6hdr *hdr6 = ipv6_hdr(skb);
+
+                       skb->protocol = htons(ETH_P_IPV6);

here need to be done outside of net->mpls.ip_ttl_propagate otherwise ...

+                       hdr6->hop_limit = dec.ttl;
+               }
                success = true;
                break;
-       }
        case MPT_UNSPEC:
+               /* Should have decided which protocol it is by now */
                break;
        }


disabling ip_ttl_propagate causes a corrupted packet to show up at the end host 
(after the LSP):

Oops, good catch. Will fix in v2.

Thanks,
Rob

Reply via email to