diff options
| author | Miguel <m.i@gmx.at> | 2018-09-25 20:46:52 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-25 20:46:52 +0200 |
| commit | b58e7bc7cb8ce4fc6f824761ac8ef3920e7dfcc1 (patch) | |
| tree | d760847e65ac231e5a18a9051af15eac12ff071d /net/ipv4.c | |
| parent | 112ca29a3bb2ab38693943ed33ee51f4fd7d2d81 (diff) | |
working on icmp ping reply
Diffstat (limited to 'net/ipv4.c')
| -rw-r--r-- | net/ipv4.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/ipv4.c b/net/ipv4.c new file mode 100644 index 0000000..aa8502e --- /dev/null +++ b/net/ipv4.c @@ -0,0 +1,20 @@ +#include "inet.h" +#include "ipv4.h" +#include "eth.h" +#include "log.h" +#include "icmp.h" + +bool ipv4_incoming(struct netdev *dev,struct eth_hdr *hdr) +{ + struct ipv4_hdr *ipv4=hdr->payload; + klog("ipv4 incoming with checksum: 0x%04X",ntohs(ipv4->csum)); + ipv4->csum=0; + klog("expected checksum: 0x%04X",checksum(ipv4,ntohs(ipv4->len))); + klog("ipv4 header len=%d",ipv4->ihl); + if(ipv4->proto==IPV4_P_ICMP) + { + icmp_incoming(dev,((uint32_t *)ipv4)+ipv4->ihl,ntohs(ipv4->len)-ipv4->ihl*4); + } + + return true; +} |
