From: Feng Zhou <zhoufeng.zf@bytedance.com>
To: Martin KaFai Lau <martin.lau@linux.dev>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
mykolal@fb.com, shuah@kernel.org, alan.maguire@oracle.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
yangzhenze@bytedance.com, wangdongdong.6@bytedance.com
Subject: Re: [External] Re: [PATCH bpf-next v3 1/2] bpf: Fix bpf_get/setsockopt to tos not take effect when TCP over IPv4 via INET6 API
Date: Wed, 16 Oct 2024 16:29:08 +0800 [thread overview]
Message-ID: <1e49c65d-5fa0-4559-9251-b75537d43ef8@bytedance.com> (raw)
In-Reply-To: <8a81f13f-c877-435c-9887-732b20a7d827@linux.dev>
在 2024/10/1 10:27, Martin KaFai Lau 写道:
> On 9/14/24 3:32 AM, Feng zhou wrote:
>> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>>
>> when TCP over IPv4 via INET6 API, bpf_get/setsockopt with ipv4 will
>
> I think you meant bpf_get/setsockopt with SOL_IP will fail. so
> s/ipv4/SOL_IP/?
>
>> fail, because sk->sk_family is AF_INET6. With ipv6 will success, not
>> take effect, because inet_csk(sk)->icsk_af_ops is ipv6_mapped and
>> use ip_queue_xmit, inet_sk(sk)->tos.
>
> Change lgtm.
>
> Patch 2 has a conflict, so can you please reword this commit message to
> reflect the latest change. e.g. afaik, this is no longer specific to
> mapped address or not.
>
Sorry for taking so long to reply.
Will do, thanks.
>>
>> Bpf_get/setsockopt use sk_is_inet() helper to fix this case.
>>
>> Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
>> ---
>> net/core/filter.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index e4a4454df5f9..90f4dbb8d2b5 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -5399,7 +5399,12 @@ static int sol_ip_sockopt(struct sock *sk, int
>> optname,
>> char *optval, int *optlen,
>> bool getopt)
>> {
>> - if (sk->sk_family != AF_INET)
>> +
>> + /*
>> + * SOL_IP socket options are available on AF_INET and AF_INET6, for
>> + * example, TCP over IPv4 via INET6 API.
>> + */
>> + if (!sk_is_inet(sk))
>> return -EINVAL;
>> switch (optname) {
>
next prev parent reply other threads:[~2024-10-16 8:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-14 10:32 [PATCH bpf-next v3 0/2] Fix bpf_get/setsockopt failed when TCP over IPv4 via INET6 API Feng zhou
2024-09-14 10:32 ` [PATCH bpf-next v3 1/2] bpf: Fix bpf_get/setsockopt to tos not take effect " Feng zhou
2024-09-14 11:47 ` Eric Dumazet
2024-10-01 2:27 ` Martin KaFai Lau
2024-10-16 8:29 ` Feng Zhou [this message]
2024-09-14 10:32 ` [PATCH bpf-next v3 2/2] selftests/bpf: Setget_sockopt add a test for tcp over ipv4 via ipv6 Feng zhou
2024-10-01 2:33 ` Martin KaFai Lau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e49c65d-5fa0-4559-9251-b75537d43ef8@bytedance.com \
--to=zhoufeng.zf@bytedance.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=wangdongdong.6@bytedance.com \
--cc=yangzhenze@bytedance.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox