Commit Graph

31 Commits

Author SHA1 Message Date
jakubtomsu
8a7fb8bd4e net: generate DNS ID with context.random_generator directly 2026-02-17 18:51:41 +01:00
Jeroen van Rijn
29b6a7ddfe Remove unused import 2026-02-08 13:21:01 +01:00
Jeroen van Rijn
8f4bcf4d31 More conflicts during rebase 2026-02-08 12:48:41 +01:00
Laytan Laats
c10771305d net: implement OpenBSD and NetBSD support & add stubs for other targets & cleanup 2026-01-11 20:21:21 +01:00
gingerBill
842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn
a65ece4426 Allow core:net to be imported with -default-to-panic-allocator. 2025-06-17 15:36:17 +02:00
Jeroen van Rijn
3862555153 Replace core:posix usage in core:os/os2 2025-06-13 17:49:05 +02:00
Christiano Haesbaert
42d7e7a402 Fix multiple vulnerabilities in the resolver
This fixes some vulnerabilities in the resolver that make spoofing DNS
queries somewhat trivial due to the code failing to randomize xid, as
well as match the reply xid with the query, and the origin of the packet:

 - xid of the query was fixed at zero
 - xid from the reply was never checked
 - source address of the reply was never checked

This means anyone can flood the host with a fake reply with xid 0,
guessing the source port is trivial as it's less than 16bits (2^16 -
1024), which would cause odin to resolve a hostname to whatever an
attacker wanted.

While here also plug in two memory leaks.

Since this is CVE material, I've contacted @kelimion before hand which
instructed to put it in a PR.

There are also more bugs as the code conflates answer section,
authority section and aditional section into one, while in reality
only the anwer section should be taken into consideration.
2025-02-23 17:28:32 +01:00
Jeroen van Rijn
963663b8e1 Merge pull request #4814 from haesbaert/dns-cleanup
Cleanup allocated dns runtime data
2025-02-09 02:12:02 +01:00
Christiano Haesbaert
cd53949c92 Cleanup allocated dns runtime data
While harmless, the runtime should clean up non-user allocated data.
On the same veign of: https://github.com/odin-lang/Odin/pull/4680

I'm kinda new to Odin and wrote netcat, in order to get a clean valgrind run,
one has to manually destroy dns_configuration:
https://github.com/haesbaert/learn-odin/blob/main/netcat/netcat.odin#L168-L169

While here unexport the destroy procedure and make destruction idempotent.
2025-02-09 00:26:25 +01:00
Christiano Haesbaert
605527f9db Fix some compression bugs in dns.
- A compression pointer is when the two higher bits are set, the code was
   considering only 0xC0 as a pointer, where in reality anything from 0xC0-0xFF is
   a pointer, probably went unnoticed since you need big packets to have long pointers.
 - Make sure we can access the lower byte of the pointer by checking len, the
   code was careful to not access past the first byte, but ignored the second.
 - As per RFC9267 make sure a pointer only points backwards, this one is not so
   bad, as the code had a iteration_max that ended up guarding against infinite jumps.

Lightly tested, some eyes are welcome, but these are remote DOSable.
2025-02-09 00:00:11 +01:00
Jeroen van Rijn
cc29bdaefc Simplify *nix mDNS 2025-01-27 23:04:15 +01:00
Jeroen van Rijn
8998d74a92 Add mDNS for *nix. 2025-01-27 22:55:48 +01:00
Karl Zylinski
19f0127e55 Moved all packages in core, base, vendor, tests and examples to use new #+ file tag syntax. 2024-09-14 18:27:49 +02:00
Feoramund
fe754af13d Add new contribution notes to core:net 2024-08-05 03:05:49 -04:00
Feoramund
e61d893a74 Port core:net to FreeBSD 2024-06-26 10:05:24 -04:00
Andreas T Jonsson
dd95a8d11d More std lib fixes
Just selecting the same codepath as other BSD's for the most part.
2024-04-19 10:42:09 +02:00
Laytan Laats
3a0df80066 correct newly found vets 2024-04-03 00:52:58 +02:00
gingerBill
14adcb9db8 Use or_break and or_continue where appropriate in the core library 2023-09-30 15:34:39 +01:00
gingerBill
cd74cdfdaf Remove switch in in favour of switch _ in 2023-08-08 14:57:25 +01:00
Laytan Laats
ff745e0ad8 fix parse_address can return nil 2023-05-19 19:14:25 +02:00
Jeroen van Rijn
9a982cc5b5 Fix #2471 2023-04-21 08:35:21 +02:00
Jeroen van Rijn
fa42a788c8 Preserve port when calling net.resolve with hostname:port. 2023-04-18 18:24:27 +02:00
Jeroen van Rijn
d939d6079a Don't try to check core:net on the BSDs. 2023-03-03 18:24:26 +01:00
Jeroen van Rijn
d5ea492ef5 Make more private. 2023-03-03 13:00:43 +01:00
Jeroen van Rijn
96ac405952 Alignment + unnecessary allocator param. 2023-03-03 12:04:36 +01:00
Colin Davidson
38d58e818c ripple bill-suggestions 2023-03-02 06:56:54 -08:00
Jeroen van Rijn
c02ff3af27 Update comments 2023-03-02 13:45:12 +01:00
Colin Davidson
2ca30e3acd more test cleanup 2023-03-01 08:27:07 -08:00
Colin Davidson
d569daae33 more manual type carryover 2023-03-01 08:17:41 -08:00
Colin Davidson
28f7f57247 manually start merging core_net 2023-03-01 07:58:30 -08:00