From ae33cc6557790a502a01b380b0926944ca2f3cfa Mon Sep 17 00:00:00 2001 From: Miguel Date: Wed, 26 Sep 2018 10:22:37 +0200 Subject: ntp and udp --- net/eth.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'net/eth.c') 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; +} + -- cgit v1.2.3