summaryrefslogtreecommitdiff
path: root/net/eth.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-26 10:22:37 +0200
committerMiguel <m.i@gmx.at>2018-09-26 10:22:37 +0200
commitae33cc6557790a502a01b380b0926944ca2f3cfa (patch)
treee72632052d1c6f6830c40d10d26c04b73aac74c6 /net/eth.c
parentdaf374435560861681c3e4d14a2d44141aa11abc (diff)
ntp and udp
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/eth.c b/net/eth.c
index 8b13789..780a89a 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -1 +1,25 @@
+#include "inet.h"
+#include "eth.h"
+#include "netdev.h"
+#include "lib/string/string.h"
+
+uint32_t eth_generic(struct netdev *dev, uint32_t ip, uint16_t type, uint8_t* pos,uint32_t *end)
+{
+ pos-=14;// we need 14 bytes for the eth header
+ struct eth_hdr *eth=pos;
+
+ // TODO: dmac from arp and routing tables.
+ eth->dmac[0]=0x90;
+ eth->dmac[1]=0x5c;
+ eth->dmac[2]=0x44;
+ eth->dmac[3]=0x2f;
+ eth->dmac[4]=0x9a;
+ eth->dmac[5]=0x40;
+
+ memcpy(eth->smac,dev->hwaddr,6);
+ eth->ethertype=htons(type);
+
+ return pos;
+}
+