summaryrefslogtreecommitdiff
path: root/net/netdev.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-25 12:43:03 +0200
committerMiguel <m.i@gmx.at>2018-09-25 12:43:03 +0200
commit112ca29a3bb2ab38693943ed33ee51f4fd7d2d81 (patch)
treec843051f9291ebe2de6e603c45d924d843d35ea4 /net/netdev.c
parent2ba77c01a33c3454aeed42d5394dd5ccede10851 (diff)
arp replies working!
Diffstat (limited to 'net/netdev.c')
-rw-r--r--net/netdev.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/netdev.c b/net/netdev.c
new file mode 100644
index 0000000..3acd7a4
--- /dev/null
+++ b/net/netdev.c
@@ -0,0 +1,16 @@
+#include <stdint.h>
+#include "inet.h"
+#include "eth.h"
+#include "netdev.h"
+#include "lib/string/string.h"
+
+void netdev_transmit(struct netdev *dev, struct eth_hdr *hdr, uint16_t ethertype, int len, unsigned char *dst)
+{
+ hdr->ethertype = htons(ethertype);
+ memcpy(hdr->smac, dev->hwaddr, 6);
+ memcpy(hdr->dmac, dst, 6);
+
+ len += sizeof(struct eth_hdr);
+
+ dev->transmit(hdr,len);
+}