diff options
| author | Miguel <m.i@gmx.at> | 2018-09-26 10:22:37 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-26 10:22:37 +0200 |
| commit | ae33cc6557790a502a01b380b0926944ca2f3cfa (patch) | |
| tree | e72632052d1c6f6830c40d10d26c04b73aac74c6 /net/eth.c | |
| parent | daf374435560861681c3e4d14a2d44141aa11abc (diff) | |
ntp and udp
Diffstat (limited to 'net/eth.c')
| -rw-r--r-- | net/eth.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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; +} + |
