diff options
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; +} + |
