authorgravatar for atlas.yu@canonical.compseudoc <atlas.yu@canonical.com> 2024-09-25 15:30:46+08:00
committergravatar for 85104110+pseudocc@users.noreply.github.comAtlas Yu <85104110+pseudocc@users.noreply.github.com> 2024-09-26 10:54:18+08:00
log0d00c733de80f41e2e4bae848658213f7076d49e
tree44d9bff0173690facd8631a498d0c0c11eb953cd
parent0e876a6378b5380900cf8755f624a670e8716f80

std.os.linux: extend rtattr.type to support IFA_*

This is a breaking change which updates the `rtattr.type` from `IFLA` to `union { IFLA, IFA }`. `IFLA` is for the `RTM_*LINK` messages and `IFA` is for the `RTM_*ADDR` messages.

1 files changed, 23 insertions(+), 1 deletions(-)

lib/std/os/linux.zig+23-1
...@@ -8064,11 +8064,33 @@ pub const rtattr = extern struct {...@@ -8064,11 +8064,33 @@ pub const rtattr = extern struct {
8064 len: c_ushort,8064 len: c_ushort,
80658065
8066 /// Type of option8066 /// Type of option
8067 type: IFLA,8067 type: extern union {
8068 /// IFLA_* from linux/if_link.h
8069 link: IFLA,
8070 /// IFA_* from linux/if_addr.h
8071 addr: IFA,
8072 },
80688073
8069 pub const ALIGNTO = 4;8074 pub const ALIGNTO = 4;
8070};8075};
80718076
8077pub const IFA = enum(c_ushort) {
8078 UNSPEC,
8079 ADDRESS,
8080 LOCAL,
8081 LABEL,
8082 BROADCAST,
8083 ANYCAST,
8084 CACHEINFO,
8085 MULTICAST,
8086 FLAGS,
8087 RT_PRIORITY,
8088 TARGET_NETNSID,
8089 PROTO,
8090
8091 _,
8092};
8093
8072pub const IFLA = enum(c_ushort) {8094pub const IFLA = enum(c_ushort) {
8073 UNSPEC,8095 UNSPEC,
8074 ADDRESS,8096 ADDRESS,