Skip to content

added sntp, dns and updated timer and net_proc#26

Merged
differrari merged 7 commits intodifferrari:mainfrom
CodeAnarchist:dns-sntp-timer
Aug 11, 2025
Merged

added sntp, dns and updated timer and net_proc#26
differrari merged 7 commits intodifferrari:mainfrom
CodeAnarchist:dns-sntp-timer

Conversation

@CodeAnarchist
Copy link
Copy Markdown
Contributor

added sntp client and sntp daemon
added dns resolver and dns daemon
updated timer to support sntp real/unix time alongside the monotonic clock
added DateTime type + helper and manual timezone offset support
cleaned up net_proc; better logs and moved the PID setter inside the daemons
renamed dhcp/arp getter

@codebrainz
Copy link
Copy Markdown
Contributor

If I could make a small gentle constructive criticism of this PR, it would be useful if you broke your changes down in to smaller meaningful commits with informative commit messages. It becomes difficult to review larger changes like this, but viewing the branch history as a "story" about the changes being made and why makes it more digestible.

This isn't to critique your actual changes, there is no doubt they improve the code, but just a random comment from a random coder who maintained random FOSS repos in the past.

Comment thread kernel/exceptions/timer.c
Comment thread kernel/networking/processes/net_proc.c Outdated
Comment thread kernel/networking/processes/net_proc.c
Comment thread kernel/networking/processes/net_proc.c Outdated
Comment thread kernel/networking/processes/net_proc.c Outdated
Comment thread kernel/networking/processes/net_proc.c Outdated
Comment thread shared/net/application_layer/dhcp_daemon.c Outdated
Comment thread shared/net/application_layer/sntp.c Outdated
@CodeAnarchist
Copy link
Copy Markdown
Contributor Author

Heya, thanks for the tip. I know it's not great to do a single huge commit (Ive been told that many times already, lmao), but I've mostly worked locally and havent used git much, so every time I try to do something with it i usually mess things up. Anyway, Ill try to get better at it, even if git drives me a bit crazy
btw, if you want, feel free to add me on discord stepleo5000, I’d be happy to chat about the different ways we handled the warnings, and it’d make it easier if you ever have any doubts or want to ask me something directly

@differrari differrari merged commit 97dea23 into differrari:main Aug 11, 2025
1 check passed
static port_entry_t g_port_table[PROTO_COUNT][MAX_PORTS];//tab proto/port

static inline bool port_valid(uint16_t p) {
static inline bool port_valid(uint32_t p) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing p parameter to uint32_t doesn't add any value here if all of the arguments ever passed to it are converted/truncated to 16-bits. If every value passed to this function is already between 0 and MAX_PORTS then at worst it wastes some CPU cycles for nothing and at best it gets optimized-out.

I removed it again in the update compiler warnings clean up branch. It was disused in the network changes which landed in master branch anyway, so kind of moot.

memcpy(pkt->payload, d->payload, 56);
else
memset(pkt->payload, 0, 56);
memset(pkt->payload, 0, sizeof(pkt->payload));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This memset call is unnecessary since the following line completely overwrites the entire pkt->payload anyway. It would probably get optimized-out if the project were built with optimizations, but in it's current state, it likely just wastes some CPU cycles.

#define TCP_RETRY_TIMEOUT_MS 1000

static int find_flow(uint16_t local_port, uint32_t remote_ip, uint16_t remote_port);
int find_flow(uint16_t local_port, uint32_t remote_ip, uint16_t remote_port);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the correct fix for the compiler warning it generates. The find_flow function is only ever used inside the tcp.c file, so it should remain static there, removed from the header here since it's not used in any other files, and then in tcp.c it should just be moved up in the file so that it's defined before use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants