summaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-25 14:23:36 -0400
committerIan Moffett <ian@osmora.org>2025-09-25 14:23:36 -0400
commitafcdcf6ae6d95eb828733994c7de30f8ab095dcc (patch)
treee45ee28dc7bff6da7ab0d5f6a3e2b27c6ac36aa8 /src/link
parent25872d593fc4f9d2845ef6f676ce4ec3d55e9aac (diff)
dgram: Add support for data reception
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/link')
-rw-r--r--src/link/if_ether.c15
-rw-r--r--src/link/link_subr.c2
2 files changed, 6 insertions, 11 deletions
diff --git a/src/link/if_ether.c b/src/link/if_ether.c
index 48b4f19..6043810 100644
--- a/src/link/if_ether.c
+++ b/src/link/if_ether.c
@@ -32,15 +32,6 @@
#include <string.h>
#include "if_ether.h"
-/*
- * Using the protocol ID 0xFD for testing,
- * see RFC 3692
- */
-#define PROTO_ID 0xFD
-
-/* 48-bit mask for MAC addresses */
-#define MAC_MASK 0xFFFFFFFFFFFF
-
int
ether_load_route(mac_addr_t src, mac_addr_t dest, struct ether_hdr *res)
{
@@ -65,6 +56,10 @@ ether_load_route(mac_addr_t src, mac_addr_t dest, struct ether_hdr *res)
res->dest[3] = (dest >> 16) & 0xFF;
res->dest[4] = (dest >> 8) & 0xFF;
res->dest[5] = dest & 0xFF;
- res->proto = PROTO_ID;
+
+ /* Setup the protocl ID */
+ res->proto = 0;
+ res->proto |= (PROTO_ID & 0xFF) << 8;
+ res->proto |= (PROTO_ID >> 8) & 0xFF;
return 0;
}
diff --git a/src/link/link_subr.c b/src/link/link_subr.c
index d1a977d..297e720 100644
--- a/src/link/link_subr.c
+++ b/src/link/link_subr.c
@@ -50,7 +50,7 @@ onet_open(const char *iface, struct onet_link *res)
}
/* Open a raw socket */
- res->sockfd = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW);
+ res->sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (res->sockfd < 0) {
return res->sockfd;
}