Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: bpftool: Formatting defined by user:fmt: decl tag
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 5a427fd
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 58a5820
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 348f611
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 2383e45
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: f0b5c14
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 8b52d09
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 34f033a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: ceeaa71
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

Certain data types get exceptionally unwieldy when formatted by bpftool,
e.g. IP6 addresses.

Introduce custom formatting in bpftool driven by user:fmt: decl tag.
When a type is tagged user:fmt:ip, the value is formatted as IP4 or IP6
address depending on the value size.

When a type is tagged user:fmt:be, the value is interpreted as a
big-endian integer (2, 4 or 8 bytes).

Example:

typedef struct in6_addr bpf_in6_addr
    __attribute__((__btf_decl_tag__("user:fmt:ip")));
bpf_in6_addr in6;

$ bpftool map dump name .data
[{
        "value": {
            ".data": [{
                    "in6": "2001:db8:130f::9c0:876a:130b"
                }
            ]
        }
    }
]

versus

$ bpftool map dump name .data
[{
        "value": {
            ".data": [{
                    "in6": {
                        "in6_u": {
                            "u6_addr8": [32,1,13,184,19,15,0,0,0,0,9,192,135,106,19,11
                            ],
                            "u6_addr16": [288,47117,3859,0,0,49161,27271,2835
                            ],
                            "u6_addr32": [3087860000,3859,3221815296,185821831
                            ]
                        }
                    }
                }
            ]
        }
    }
]

Signed-off-by: Nick Zavaritsky <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: d4680a1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1004635 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants