const std = @import("std"); const linux = std.os.linux; const netlink = @import("netlink"); const size = @sizeOf(linux.ifinfomsg); buf: [size]u8 = @splat(0), len: usize = 0, const Self = @This(); pub fn init(ifindex: i32, up: bool) !Self { var self: Self = .{}; const builder = try netlink.MessageBuilder.init( &self.buf, linux.ifinfomsg{ .family = linux.AF.UNSPEC, .__pad1 = 0, .type = 0, .index = ifindex, .flags = @backingInt(linux.IFF{ .UP = up }), .change = @backingInt(linux.IFF{ .UP = true }), }, ); self.len = builder.bytes.items.len; return self; } pub fn bytes(self: *const Self) []const u8 { return self.buf[0..self.len]; } pub const nlmsg_flags = linux.NLM_F_REQUEST | linux.NLM_F_ACK;