Set don't fragment, and use random id

This commit is contained in:
2026-01-20 21:58:43 -05:00
parent def8454012
commit 6db4204bf0

View File

@@ -120,7 +120,7 @@ pub fn main(init: std.process.Init) !void {
fragment_offset: u13 = 0,
flags: packed struct(u3) {
reserved: u1 = 0,
dont_fragment: u1 = 0,
dont_fragment: u1 = 1,
more_fragments: u1 = 0,
} = .{},
@@ -158,8 +158,8 @@ pub fn main(init: std.process.Init) !void {
var headers: EthIpUdp = .{
.src_mac = socket.mac,
.ip = .{
.id = 0,
.src_addr = rand.int(u32),
.id = rand.int(u16),
.src_addr = 0, //rand.int(u32),
.dst_addr = @bitCast([_]u8{ 255, 255, 255, 255 }),
.len = undefined,
},
@@ -231,6 +231,7 @@ pub fn main(init: std.process.Init) !void {
var res = socket.receive(&res_buf) catch continue;
headers.udp.dst_port = udp_dest_port;
headers.ip.id = rand.int(u16);
full_msg = blk: {
var msg_buf: [2048]u8 = undefined;
@@ -272,6 +273,7 @@ pub fn main(init: std.process.Init) !void {
connection.connection.payload = cmd_output;
connection_bytes = connection.toBytes(&connection_buf);
headers.setPayloadLen(connection_bytes.len);
headers.ip.id = rand.int(u16);
full_msg = blk: {
var msg_buf: [2048]u8 = undefined;