diff options
author | Gokul Sivakumar <gokulkumar792@gmail.com> | 2021-09-19 11:03:04 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-09-21 23:27:54 +0300 |
commit | f5c4e4191b542c8ceb4e945342fda8ea2e9a9193 (patch) | |
tree | cabf05f899926a78adcca6cf6317d90356d2fb28 /samples/watch_queue | |
parent | 97c140d94e2e5f050d5f418317cc34f83da3d0f5 (diff) | |
download | linux-f5c4e4191b542c8ceb4e945342fda8ea2e9a9193.tar.xz |
samples: bpf: Convert route table network order fields into readable format
The route table that is dumped when the xdp_router_ipv4 process is launched
has the "Gateway" field in non-readable network byte order format, also the
alignment is off when printing the table.
Destination Gateway Genmask Metric Iface
0.0.0.0 196a8c0 0 0 enp7s0
0.0.0.0 196a8c0 0 0 wlp6s0
169.254.0.0 196a8c0 16 0 enp7s0
172.17.0.0 0 16 0 docker0
192.168.150.0 0 24 0 enp7s0
192.168.150.0 0 24 0 wlp6s0
Fix this by converting the "Gateway" field from network byte order Hex into
dotted decimal notation IPv4 format and "Genmask" from CIDR notation into
dotted decimal notation IPv4 format. Also fix the aligntment of the fields
in the route table.
Destination Gateway Genmask Metric Iface
0.0.0.0 192.168.150.1 0.0.0.0 0 enp7s0
0.0.0.0 192.168.150.1 0.0.0.0 0 wlp6s0
169.254.0.0 192.168.150.1 255.255.0.0 0 enp7s0
172.17.0.0 0.0.0.0 255.255.0.0 0 docker0
192.168.150.0 0.0.0.0 255.255.255.0 0 enp7s0
192.168.150.0 0.0.0.0 255.255.255.0 0 wlp6s0
Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210919080305.173588-1-gokulkumar792@gmail.com
Diffstat (limited to 'samples/watch_queue')
0 files changed, 0 insertions, 0 deletions