summaryrefslogtreecommitdiff
path: root/net/eth.c
blob: fedcda596cdb02091ccacf6d7f57c843906711da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "net_sys.h"
#include "inet.h"
#include "eth.h"
#include "netdev.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;
}