
Hi Joe,
On Wed, Mar 28, 2012 at 12:42 PM, Joe Hershberger joe.hershberger@ni.comwrote:
Signed-off-by: Joe Hershberger joe.hershberger@ni.com Cc: Joe Hershberger joe.hershberger@gmail.com Cc: Simon Glass sjg@chromium.org Cc: Mike Frysinger vapier@gentoo.org
Changes for v2:
- Split apart from "Un-typedef variables in net"
- Renamed structs from *_t to *_hdr since they are nolonger types
include/net.h | 6 ++++-- net/net.c | 2 +- net/ping.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/net.h b/include/net.h index 937a99e..538eb86 100644 --- a/include/net.h +++ b/include/net.h @@ -297,7 +297,7 @@ struct ARP_hdr { /* Codes for NOT_REACH */ #define ICMP_NOT_REACH_PORT 3 /* Port unreachable */
-typedef struct icmphdr { +struct ICMP_hdr {
struct icmp_hdr might be better?
uchar type;
uchar code; ushort checksum;
@@ -313,8 +313,10 @@ typedef struct icmphdr { } frag; uchar data[0]; } un; -} ICMP_t; +};
+#define ICMP_HDR_SIZE (sizeof(struct ICMP_hdr)) +#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE)
/*
- Maximum packet size; used to allocate packet storage.
diff --git a/net/net.c b/net/net.c index 76df737..f8ec623 100644 --- a/net/net.c +++ b/net/net.c @@ -827,7 +827,7 @@ static inline struct IP_UDP_hdr *NetDefragment(struct IP_UDP_hdr *ip, int *lenp) static void receive_icmp(struct IP_UDP_hdr *ip, int len, IPaddr_t src_ip, struct Ethernet_hdr *et) {
ICMP_t *icmph = (ICMP_t *)&ip->udp_src;
struct ICMP_hdr *icmph = (struct ICMP_hdr *)&(ip->udp_src);
I don't think you need to add the second lot of brackets.
switch (icmph->type) { case ICMP_REDIRECT:
diff --git a/net/ping.c b/net/ping.c index e7fa64e..27fca6a 100644 --- a/net/ping.c +++ b/net/ping.c @@ -100,7 +100,7 @@ void ping_start(void)
void ping_receive(struct Ethernet_hdr *et, struct IP_UDP_hdr *ip, int len) {
ICMP_t *icmph = (ICMP_t *)&(ip->udp_src);
struct ICMP_hdr *icmph = (struct ICMP_hdr *)&(ip->udp_src);
Same here.
IPaddr_t src_ip; switch (icmph->type) {
-- 1.6.0.2
Regards, Simon