| ... | @@ -27,7 +27,7 @@ pub fn resolveScopeId(name: []const u8) !u32 { | ... | @@ -27,7 +27,7 @@ pub fn resolveScopeId(name: []const u8) !u32 { |
| 27 | return rc; | 27 | return rc; |
| 28 | } | 28 | } |
| 29 | | 29 | |
| 30 | const fd = try os.socket(os.AF.UNIX, os.SOCK.DGRAM, 0); | 30 | const fd = try os.socket(os.AF.INET, os.SOCK.DGRAM, 0); |
| 31 | defer os.closeSocket(fd); | 31 | defer os.closeSocket(fd); |
| 32 | | 32 | |
| 33 | var f: os.ifreq = undefined; | 33 | var f: os.ifreq = undefined; |
| ... | @@ -566,21 +566,17 @@ test "ipv6: parse & format" { | ... | @@ -566,21 +566,17 @@ test "ipv6: parse & format" { |
| 566 | | 566 | |
| 567 | test "ipv6: parse & format addresses with scope ids" { | 567 | test "ipv6: parse & format addresses with scope ids" { |
| 568 | if (!have_ifnamesize) return error.SkipZigTest; | 568 | if (!have_ifnamesize) return error.SkipZigTest; |
| 569 | | 569 | const iface = if (native_os.tag == .linux) |
| 570 | const inputs = [_][]const u8{ | 570 | "lo" |
| 571 | "FF01::FB%lo", | 571 | else |
| 572 | }; | 572 | "lo0"; |
| 573 | | 573 | const input = "FF01::FB%" ++ iface; |
| 574 | const outputs = [_][]const u8{ | 574 | const output = "ff01::fb%1"; |
| 575 | "ff01::fb%1", | 575 | |
| | 576 | const parsed = IPv6.parse(input) catch |err| switch (err) { |
| | 577 | error.InterfaceNotFound => return, |
| | 578 | else => return err, |
| 576 | }; | 579 | }; |
| 577 | | 580 | |
| 578 | for (inputs) |input, i| { | 581 | try testing.expectFmt(output, "{}", .{parsed}); |
| 579 | const parsed = IPv6.parse(input) catch |err| switch (err) { | | |
| 580 | error.InterfaceNotFound => continue, | | |
| 581 | else => return err, | | |
| 582 | }; | | |
| 583 | | | |
| 584 | try testing.expectFmt(outputs[i], "{}", .{parsed}); | | |
| 585 | } | | |
| 586 | } | 582 | } |