Nicolas Dichtel 5b7d4d91c0 ipv{4,6}/raw: fix output xfrm lookup wrt protocol
commit 3632679d9e4f879f49949bb5b050e0de553e4739 upstream.

With a raw socket bound to IPPROTO_RAW (ie with hdrincl enabled), the
protocol field of the flow structure, build by raw_sendmsg() /
rawv6_sendmsg()),  is set to IPPROTO_RAW. This breaks the ipsec policy
lookup when some policies are defined with a protocol in the selector.

For ipv6, the sin6_port field from 'struct sockaddr_in6' could be used to
specify the protocol. Just accept all values for IPPROTO_RAW socket.

For ipv4, the sin_port field of 'struct sockaddr_in' could not be used
without breaking backward compatibility (the value of this field was never
checked). Let's add a new kind of control message, so that the userland
could specify which protocol is used.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
CC: stable@vger.kernel.org
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20230522120820.1319391-1-nicolas.dichtel@6wind.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-05 08:17:33 +02:00
..
2020-06-07 13:18:48 +02:00
2019-07-09 12:11:59 -07:00
2019-03-07 18:32:01 -08:00
2019-01-24 11:11:42 -07:00
2019-09-19 14:22:44 +02:00
2019-09-25 17:51:39 -07:00
2019-08-02 14:44:02 +10:00
2019-09-16 10:18:01 -04:00
2019-02-14 11:51:51 -05:00
2018-12-20 19:13:07 +01:00
2019-03-27 13:30:07 -07:00
2019-09-21 14:26:33 -07:00
2018-06-18 15:11:53 +10:00
2019-08-12 19:33:50 -07:00
2018-09-13 10:46:24 +02:00
2018-09-05 22:27:11 -07:00
2019-09-18 10:43:22 -06:00
2019-09-08 15:37:04 +02:00
2018-07-07 17:41:38 +02:00
2018-08-03 10:03:57 -07:00
2019-08-19 13:04:45 -07:00
2018-12-16 12:15:25 -08:00
2018-12-01 12:38:32 +01:00
2019-05-28 21:37:30 -07:00
2020-10-29 09:58:00 +01:00
2019-10-02 20:32:27 -06:00
2019-01-22 10:21:45 +01:00
2019-07-30 20:34:34 +02:00
2019-05-28 21:37:30 -07:00
2019-11-05 15:50:14 +01:00
2019-09-16 16:26:11 +02:00
2019-02-14 11:51:51 -05:00
2018-09-03 13:29:38 +02:00
2019-09-18 20:17:50 +02:00
2019-08-01 21:49:46 +02:00