Thread (25 messages) 25 messages, 5 authors, 2017-03-13

Re: [PATCH net-next v2 1/2] mpls: allow TTL propagation to IP packets to be configured

From: Robert Shearman <hidden>
Date: 2017-03-10 10:12:34

On 10/03/17 02:00, David Ahern wrote:
On 3/7/17 5:46 PM, Robert Shearman wrote:
quoted
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help