summaryrefslogtreecommitdiff
path: root/kernel/network/arp.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-02-21 00:14:29 +0100
committerAnton Kling <anton@kling.gg>2024-02-21 00:14:29 +0100
commit8ff63b062d724826d8017504063df9b92f8e6703 (patch)
tree03bf0b5a278a4908da8912f956e5651bea9412f1 /kernel/network/arp.c
parenta85eacdd2406fede4d6ff5cb130b1758978cabb3 (diff)
New clang-format options
Diffstat (limited to 'kernel/network/arp.c')
-rw-r--r--kernel/network/arp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/network/arp.c b/kernel/network/arp.c
index 6e589ec..bd3cd24 100644
--- a/kernel/network/arp.c
+++ b/kernel/network/arp.c
@@ -46,8 +46,9 @@ void print_mac(const char *str, u8 *mac) {
kprintf("%s: ", str);
for (int i = 0; i < 6; i++) {
kprintf("%x", mac[i]);
- if (5 != i)
+ if (5 != i) {
kprintf(":");
+ }
}
kprintf("\n");
}
@@ -56,8 +57,9 @@ void print_ip(const char *str, const u8 *ip) {
kprintf("%s: ", str);
for (int i = 0; i < 4; i++) {
kprintf("%d", ip[i]);
- if (3 != i)
+ if (3 != i) {
kprintf(".");
+ }
}
kprintf("\n");
}
@@ -84,8 +86,9 @@ void send_arp_request(const u8 ip[4]) {
int get_mac_from_ip(const u8 ip[4], u8 mac[6]) {
for (int i = 0; i < 10; i++) {
- if (0 != memcmp(arp_table[i].ip, ip, sizeof(u8[4])))
+ if (0 != memcmp(arp_table[i].ip, ip, sizeof(u8[4]))) {
continue;
+ }
memcpy(mac, arp_table[i].mac, sizeof(u8[6]));
return 1;
}
@@ -93,8 +96,9 @@ int get_mac_from_ip(const u8 ip[4], u8 mac[6]) {
send_arp_request(ip);
// TODO: Maybe wait a bit?
for (int i = 0; i < 10; i++) {
- if (0 != memcmp(arp_table[i].ip, ip, sizeof(u8[4])))
+ if (0 != memcmp(arp_table[i].ip, ip, sizeof(u8[4]))) {
continue;
+ }
memcpy(mac, arp_table[i].mac, sizeof(u8[6]));
return 1;
}