Skip to contentSkip to conversation

Missing INET6_PROTO_FINAL in l2tp_ip6_protocol?

DISCUSSION Shmulik Ladkani 2 participants 5 messages May 21, 2016 – May 23, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

inet6_protocol's INET6_PROTO_FINAL flag denotes handler is expected not to request resubmission for local delivery.

For an INET6_PROTO_FINAL handler, the following actions gets executed prior delivery, in ip6_input_finish:

			nf_reset(skb);

			skb_postpull_rcsum(skb, skb_network_header(skb),
					   skb_network_header_len(skb));

For some reason, l2tp_ip6_protocol handler is NOT marked as INET6_PROTO_FINAL. Probably an oversight.

Since 'l2tp_ip6_recv' never results in a resubmission, the above actions are not applied to skbs passed to l2tp_ip6.

Any reason why l2tp_ip6_protocol should NOT be marked INET6_PROTO_FINAL?

What's the consequences not executing the above actions for l2tp_ip6 packets?

Thanks,
Shmulik

#1 lore raw
Quoted 13 lines · Shmulik Ladkani

Hi,

inet6_protocol's INET6_PROTO_FINAL flag denotes handler is expected not to request resubmission for local delivery.

For an INET6_PROTO_FINAL handler, the following actions gets executed prior delivery, in ip6_input_finish:

			nf_reset(skb);

			skb_postpull_rcsum(skb, skb_network_header(skb),
					   skb_network_header_len(skb));
Quoted 7 lines

For some reason, l2tp_ip6_protocol handler is NOT marked as INET6_PROTO_FINAL. Probably an oversight.

Since 'l2tp_ip6_recv' never results in a resubmission, the above actions are not applied to skbs passed to l2tp_ip6.

Any reason why l2tp_ip6_protocol should NOT be marked INET6_PROTO_FINAL?

I don't see any specific reason why it shouldn't be a INET6_PROTO_FINAL. Anyway, receive path of L2TPv3 without UDP encapsulation doesn't deal with checksums anyway, as far as I know.

Quoted 2 lines

What's the consequences not executing the above actions for l2tp_ip6 packets?

Probably not a whole lot in this case.

Bye,
Hannes

#2 lore raw
Quoted 22 lines · On Sat, 21 May 2016 17:55:59 +0200 Hannes Frederic Sowa…
Quoted 13 lines · Shmulik Ladkani

Hi,

inet6_protocol's INET6_PROTO_FINAL flag denotes handler is expected not to request resubmission for local delivery.

For an INET6_PROTO_FINAL handler, the following actions gets executed prior delivery, in ip6_input_finish:

			nf_reset(skb);

			skb_postpull_rcsum(skb, skb_network_header(skb),
					   skb_network_header_len(skb));
Quoted 7 lines

For some reason, l2tp_ip6_protocol handler is NOT marked as INET6_PROTO_FINAL. Probably an oversight.

Since 'l2tp_ip6_recv' never results in a resubmission, the above actions are not applied to skbs passed to l2tp_ip6.

Any reason why l2tp_ip6_protocol should NOT be marked INET6_PROTO_FINAL?

Quoted 8 lines

I don't see any specific reason why it shouldn't be a INET6_PROTO_FINAL. Anyway, receive path of L2TPv3 without UDP encapsulation doesn't deal with checksums anyway, as far as I know.

Quoted 2 lines

What's the consequences not executing the above actions for l2tp_ip6 packets?

Probably not a whole lot in this case.

OK, so the skb_postpull_rcsum is irrelevant for IPPROTO_L2TP over ipv6.

However, one more thing WRT to INET6_PROTO_FINAL not being set - we're also missing the multicast filtering of 'ip6_input_finish':

			if (ipv6_addr_is_multicast(&hdr->daddr) &&
			    !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
			    &hdr->saddr) &&
			    !ipv6_is_mld(skb, nexthdr, skb_network_header_len(skb)))
				goto discard;

I assume no reason to allow multicast daddr which aren't in the mc_list (or saddr excluded) to pass up into 'l2tp_ip6_recv'?

#3 lore raw
Quoted 37 lines · Shmulik Ladkani
Quoted 22 lines · On Sat, 21 May 2016 17:55:59 +0200 Hannes Frederic Sowa…
Quoted 13 lines · Shmulik Ladkani

Hi,

inet6_protocol's INET6_PROTO_FINAL flag denotes handler is expected not to request resubmission for local delivery.

For an INET6_PROTO_FINAL handler, the following actions gets executed prior delivery, in ip6_input_finish:

			nf_reset(skb);

			skb_postpull_rcsum(skb, skb_network_header(skb),
					   skb_network_header_len(skb));
Quoted 7 lines

For some reason, l2tp_ip6_protocol handler is NOT marked as INET6_PROTO_FINAL. Probably an oversight.

Since 'l2tp_ip6_recv' never results in a resubmission, the above actions are not applied to skbs passed to l2tp_ip6.

Any reason why l2tp_ip6_protocol should NOT be marked INET6_PROTO_FINAL?

Quoted 8 lines

I don't see any specific reason why it shouldn't be a INET6_PROTO_FINAL. Anyway, receive path of L2TPv3 without UDP encapsulation doesn't deal with checksums anyway, as far as I know.

Quoted 2 lines

What's the consequences not executing the above actions for l2tp_ip6 packets?

Probably not a whole lot in this case.

OK, so the skb_postpull_rcsum is irrelevant for IPPROTO_L2TP over ipv6.

However, one more thing WRT to INET6_PROTO_FINAL not being set - we're also missing the multicast filtering of 'ip6_input_finish':

Quoted 9 lines
			if (ipv6_addr_is_multicast(&hdr->daddr) &&
			    !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
			    &hdr->saddr) &&
			    !ipv6_is_mld(skb, nexthdr, skb_network_header_len(skb)))
				goto discard;

I assume no reason to allow multicast daddr which aren't in the mc_list (or saddr excluded) to pass up into 'l2tp_ip6_recv'?

Good point, seems we would benefit of the addition of the PROTO_FINAL flag. Could you test and send a patch?

Thanks,
Hannes

#4 lore raw

Hi,

Quoted 9 lines · On Mon, 23 May 2016 13:05:50 +0200, [email protected] wrote:
Quoted 9 lines

However, one more thing WRT to INET6_PROTO_FINAL not being set - we're also missing the multicast filtering of 'ip6_input_finish':

			if (ipv6_addr_is_multicast(&hdr->daddr) &&
			    !ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
			    &hdr->saddr) &&
			    !ipv6_is_mld(skb, nexthdr, skb_network_header_len(skb)))
				goto discard;
Quoted 6 lines
Quoted 3 lines

I assume no reason to allow multicast daddr which aren't in the mc_list (or saddr excluded) to pass up into 'l2tp_ip6_recv'?

Good point, seems we would benefit of the addition of the PROTO_FINAL flag. Could you test and send a patch?

Will do.

Regards,
Shmulik