Move IP header flags from tcp.h to ip.h and rename IP_FLAGS vs TCPFLAGS. The problem fixed here is that there IP flags were not available when TCP was disabled. The IP flags are used in ICMP and IGFMP

This commit is contained in:
Gregory Nutt
2014-11-17 17:16:46 -06:00
parent fd236ee641
commit c64cb19861
5 changed files with 18 additions and 18 deletions
+13 -7
View File
@@ -64,18 +64,24 @@
****************************************************************************/ ****************************************************************************/
/* Values for the IP protocol field */ /* Values for the IP protocol field */
#define IP_PROTO_ICMP 1 #define IP_PROTO_ICMP 1
#define IP_PROTO_IGMP 2 #define IP_PROTO_IGMP 2
#define IP_PROTO_TCP 6 #define IP_PROTO_TCP 6
#define IP_PROTO_UDP 17 #define IP_PROTO_UDP 17
#define IP_PROTO_ICMP6 58 #define IP_PROTO_ICMP6 58
/* Flag bits in 16-bit flags + fragment offset IPv4 header field */
#define IP_FLAG_RESERVED 0x8000
#define IP_FLAG_DONTFRAG 0x4000
#define IP_FLAG_MOREFRAGS 0x2000
/* Header sizes */ /* Header sizes */
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
# define IP_HDRLEN 40 /* Size of IP header */ # define IP_HDRLEN 40 /* Size of IP header */
#else #else
# define IP_HDRLEN 20 /* Size of IP header */ # define IP_HDRLEN 20 /* Size of IP header */
#endif #endif
/**************************************************************************** /****************************************************************************
-6
View File
@@ -95,12 +95,6 @@
# define TCP_STOPPED 0x10 /* Bit 4: stopped */ # define TCP_STOPPED 0x10 /* Bit 4: stopped */
/* Bit 5-7: Unused, but not available */ /* Bit 5-7: Unused, but not available */
/* Flag bits in 16-bit flags+ipoffset IPv4 TCP header field */
#define TCPFLAG_RESERVED 0x8000
#define TCPFLAG_DONTFRAG 0x4000
#define TCPFLAG_MOREFRAGS 0x2000
/* TCP header sizes */ /* TCP header sizes */
#define TCP_HDRLEN 20 /* Size of TCP header */ #define TCP_HDRLEN 20 /* Size of TCP header */
+1 -1
View File
@@ -112,7 +112,7 @@
/* IP fragment re-assembly */ /* IP fragment re-assembly */
#define IP_MF 0x20 #define IP_MF 0x20 /* See IP_FLAG_MOREFRAGS */
#define TCP_REASS_BUFSIZE (NET_DEV_MTU(dev) - NET_LL_HDRLEN(dev)) #define TCP_REASS_BUFSIZE (NET_DEV_MTU(dev) - NET_LL_HDRLEN(dev))
#define TCP_REASS_LASTFRAG 0x01 #define TCP_REASS_LASTFRAG 0x01
+2 -2
View File
@@ -136,8 +136,8 @@ void icmp_send(FAR struct net_driver_s *dev, FAR net_ipaddr_t *destaddr)
++g_ipid; ++g_ipid;
picmp->ipid[0] = g_ipid >> 8; picmp->ipid[0] = g_ipid >> 8;
picmp->ipid[1] = g_ipid & 0xff; picmp->ipid[1] = g_ipid & 0xff;
picmp->ipoffset[0] = TCPFLAG_DONTFRAG >> 8; picmp->ipoffset[0] = IP_FLAG_DONTFRAG >> 8;
picmp->ipoffset[1] = TCPFLAG_DONTFRAG & 0xff; picmp->ipoffset[1] = IP_FLAG_DONTFRAG & 0xff;
picmp->ttl = IP_TTL; picmp->ttl = IP_TTL;
picmp->proto = IP_PROTO_ICMP; picmp->proto = IP_PROTO_ICMP;
+2 -2
View File
@@ -150,8 +150,8 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group,
++g_ipid; ++g_ipid;
IGMPBUF->ipid[0] = g_ipid >> 8; IGMPBUF->ipid[0] = g_ipid >> 8;
IGMPBUF->ipid[1] = g_ipid & 0xff; IGMPBUF->ipid[1] = g_ipid & 0xff;
IGMPBUF->ipoffset[0] = TCPFLAG_DONTFRAG >> 8; IGMPBUF->ipoffset[0] = IP_FLAG_DONTFRAG >> 8;
IGMPBUF->ipoffset[1] = TCPFLAG_DONTFRAG & 0xff; IGMPBUF->ipoffset[1] = IP_FLAG_DONTFRAG & 0xff;
IGMPBUF->ttl = IGMP_TTL; IGMPBUF->ttl = IGMP_TTL;
IGMPBUF->proto = IP_PROTO_IGMP; IGMPBUF->proto = IP_PROTO_IGMP;