Re: [PATCH bpf-next] bpf: Add document for 'dst_port' of 'struct bpf_sock'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

On Thu, Jan 20, 2022 at 6:03 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
[...]
>
> Looks like
>  __sk_buff->remote_port
>  bpf_sock_ops->remote_port
>  sk_msg_md->remote_port
> are doing the right thing,
> but bpf_sock->dst_port is not correct?
>
> I think it's better to fix it,
> but probably need to consolidate it with
> convert_ctx_accesses() that deals with narrow access.
> I suspect reading u8 from three flavors of 'remote_port'
> won't be correct.

What's the meaning of 'narrow access'? Do you mean to
make 'remote_port' u16? Or 'remote_port' should be made
accessible with u8? In fact, '*((u16 *)&skops->remote_port + 1)'
won't work, as it only is accessible with u32.

I can simply make 'dst_port' endianness right with what
'remote_port' do.

Thanks!
Menglong Dong


> 'dst_port' works with a narrow load, but gets endianness wrong.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux