diff --git a/src/add-ons/kernel/network/core/misc.c b/src/add-ons/kernel/network/core/misc.c index a7039edac9..27d96dc2b0 100644 --- a/src/add-ons/kernel/network/core/misc.c +++ b/src/add-ons/kernel/network/core/misc.c @@ -8,7 +8,7 @@ #endif #include "net_misc.h" -#include "sys/socket.h" +#include /* Basically use dump_ to see the address plus message on a line, * print_ to simply have the address printed with nothing else... diff --git a/src/add-ons/kernel/network/protocols/icmp/icmp.c b/src/add-ons/kernel/network/protocols/icmp/icmp.c index 0c83dcd62e..5578bf3e79 100644 --- a/src/add-ons/kernel/network/protocols/icmp/icmp.c +++ b/src/add-ons/kernel/network/protocols/icmp/icmp.c @@ -1,22 +1,22 @@ /* icmp.c */ - #ifndef _KERNEL_MODE #include #include #endif +#include #include "net_misc.h" -#include "sys/socket.h" -#include "netinet/in_systm.h" -#include "netinet/ip.h" -#include "netinet/ip_icmp.h" +#include +#include +#include +#include #include "protocols.h" #include "sys/protosw.h" #include "sys/domain.h" -#include "netinet/icmp_var.h" -#include "netinet/in_var.h" -#include "net/if.h" +#include +#include +#include #include "core_module.h" #include "net_module.h" @@ -43,18 +43,18 @@ static struct route icmprt; static void dump_icmp(struct mbuf *buf) { struct ip *ip = mtod(buf, struct ip *); - struct icmp *ic = (struct icmp*)((caddr_t)ip + (ip->hl * 4)); + struct icmp *ic = (struct icmp*)((caddr_t)ip + (ip->ip_hl * 4)); printf("ICMP: "); switch (ic->icmp_type) { - case ICMP_ECHORQST: + case ICMP_ECHO: printf ("Echo request\n"); break; - case ICMP_ECHORPLY: + case ICMP_ECHOREPLY: printf("echo reply\n"); break; default: - printf("?? type = %d\n", ic->type); + printf("?? type = %d\n", ic->icmp_type); } } #endif diff --git a/src/add-ons/kernel/network/protocols/ipv4/ipv4.c b/src/add-ons/kernel/network/protocols/ipv4/ipv4.c index c3b0d64fa0..753087742f 100644 --- a/src/add-ons/kernel/network/protocols/ipv4/ipv4.c +++ b/src/add-ons/kernel/network/protocols/ipv4/ipv4.c @@ -65,7 +65,17 @@ struct route ipforward_rt; //int ipv4_output(struct mbuf *, struct mbuf *, struct route *, int, void *); #if SHOW_DEBUG -static void dump_ipv4_header(struct mbuf *buf) + +void +dump_ipv4_addr(char *msg, void *ad) +{ + uint8 *b = (uint8*)ad; + printf("%s %d.%d.%d.%d\n", msg, b[0], b[1], b[2], b[3]); +} + + +static void +dump_ipv4_header(struct mbuf *buf) { struct ip *ip = mtod(buf, struct ip *); @@ -629,7 +639,7 @@ void ipv4_input(struct mbuf *m, int hdrlen) struct ipq *fp; #if SHOW_DEBUG - dump_ipv4_header(buf); + dump_ipv4_header(m); #endif if (!m) return; diff --git a/src/add-ons/kernel/network/protocols/udp/udp.c b/src/add-ons/kernel/network/protocols/udp/udp.c index 436e0efc4f..0d6d04148e 100644 --- a/src/add-ons/kernel/network/protocols/udp/udp.c +++ b/src/add-ons/kernel/network/protocols/udp/udp.c @@ -3,21 +3,21 @@ #ifndef _KERNEL_MODE #include -#include #endif +#include #include "net_misc.h" #include "protocols.h" -#include "netinet/in_systm.h" -#include "netinet/in_var.h" -#include "netinet/in_pcb.h" -#include "netinet/ip.h" +#include +#include +#include +#include #include "sys/domain.h" #include "sys/protosw.h" -#include "netinet/ip_var.h" -#include "netinet/udp.h" -#include "netinet/udp_var.h" -#include "netinet/ip_icmp.h" +#include +#include +#include +#include #include "core_module.h" #include "net_module.h" @@ -51,9 +51,10 @@ static void dump_udp(struct mbuf *buf) struct udphdr *udp = (struct udphdr*)((caddr_t)ip + (ip->ip_hl * 4)); printf("udp_header :\n"); - printf(" : src_port : %d\n", ntohs(udp->src_port)); - printf(" : dst_port : %d\n", ntohs(udp->dst_port)); - printf(" : udp length : %d bytes\n", ntohs(udp->length)); + printf(" : src_port : %d\n", ntohs(udp->uh_sport)); + printf(" : dst_port : %d\n", ntohs(udp->uh_dport)); + printf(" : udp length : %d bytes\n", ntohs(udp->uh_ulen)); + printf(" : udp sum : %d\n", ntohs(udp->uh_sum)); } #endif /* SHOW_DEBUG */