From 74c402a2a3899028bd010ca79461f68fac80d293 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 17 Jul 2002 17:08:48 +0000 Subject: 2002-07-17 Jay Monkman * netinet/in.h, netinet/ip.h, netinet/ip_var.h, netinet/tcp.h: Modified to added packed attribute.o --- c/src/exec/libnetworking/ChangeLog | 4 ++++ c/src/exec/libnetworking/netinet/in.h | 4 ++-- c/src/exec/libnetworking/netinet/ip.h | 11 ++++++----- c/src/exec/libnetworking/netinet/ip_var.h | 17 +++++++++-------- c/src/exec/libnetworking/netinet/tcp.h | 14 +++++++------- cpukit/libnetworking/ChangeLog | 4 ++++ cpukit/libnetworking/netinet/in.h | 4 ++-- cpukit/libnetworking/netinet/ip.h | 11 ++++++----- cpukit/libnetworking/netinet/ip_var.h | 17 +++++++++-------- cpukit/libnetworking/netinet/tcp.h | 14 +++++++------- 10 files changed, 56 insertions(+), 44 deletions(-) diff --git a/c/src/exec/libnetworking/ChangeLog b/c/src/exec/libnetworking/ChangeLog index 22d61a0fe3..e7ad37920c 100644 --- a/c/src/exec/libnetworking/ChangeLog +++ b/c/src/exec/libnetworking/ChangeLog @@ -1,3 +1,7 @@ +2002-07-17 Jay Monkman + + * netinet/in.h, netinet/ip.h, netinet/ip_var.h, netinet/tcp.h: + Modified to added packed attribute.o 2002-07-05 Ralf Corsepius * configure.ac: RTEMS_TOP(../..). diff --git a/c/src/exec/libnetworking/netinet/in.h b/c/src/exec/libnetworking/netinet/in.h index 36d2d4e867..7cc4709697 100644 --- a/c/src/exec/libnetworking/netinet/in.h +++ b/c/src/exec/libnetworking/netinet/in.h @@ -204,12 +204,12 @@ * have a fit if we use. */ #define IPPORT_RESERVEDSTART 600 - +#define BYTE_PACK __attribute__((packed)) /* * Internet address (a structure for historical reasons) */ struct in_addr { - u_long s_addr; + u_long s_addr BYTE_PACK; }; /* diff --git a/c/src/exec/libnetworking/netinet/ip.h b/c/src/exec/libnetworking/netinet/ip.h index e7f824ca6f..e6be7d305d 100644 --- a/c/src/exec/libnetworking/netinet/ip.h +++ b/c/src/exec/libnetworking/netinet/ip.h @@ -64,17 +64,18 @@ struct ip { #endif #endif /* not _IP_VHL */ u_char ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ + u_short ip_len BYTE_PACK; /* total length */ + u_short ip_id BYTE_PACK; /* identification */ + u_short ip_off BYTE_PACK; /* fragment offset field */ #define IP_RF 0x8000 /* reserved fragment flag */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ u_char ip_ttl; /* time to live */ u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ + u_short ip_sum BYTE_PACK; /* checksum */ + struct in_addr ip_src BYTE_PACK; /* source address */ + struct in_addr ip_dst BYTE_PACK; /* dest address */ }; #ifdef _IP_VHL diff --git a/c/src/exec/libnetworking/netinet/ip_var.h b/c/src/exec/libnetworking/netinet/ip_var.h index cc7908e9a3..38e7896c4a 100644 --- a/c/src/exec/libnetworking/netinet/ip_var.h +++ b/c/src/exec/libnetworking/netinet/ip_var.h @@ -41,10 +41,11 @@ * Overlay for ip header used by other protocols (tcp, udp). */ struct ipovly { - caddr_t ih_next, ih_prev; /* for protocol sequence q's */ + caddr_t ih_next BYTE_PACK; + caddr_t ih_prev BYTE_PACK; /* for protocol sequence q's */ u_char ih_x1; /* (unused) */ u_char ih_pr; /* protocol */ - u_short ih_len; /* protocol length */ + u_short ih_len BYTE_PACK; /* protocol length */ struct in_addr ih_src; /* source internet address */ struct in_addr ih_dst; /* destination internet address */ }; @@ -59,12 +60,12 @@ struct ipq { struct ipq *next,*prev; /* to other reass headers */ u_char ipq_ttl; /* time for reass q to live */ u_char ipq_p; /* protocol of this fragment */ - u_short ipq_id; /* sequence id for reassembly */ + u_short ipq_id BYTE_PACK; /* sequence id for reassembly */ struct ipasfrag *ipq_next,*ipq_prev; /* to ip headers of fragments */ struct in_addr ipq_src,ipq_dst; #ifdef IPDIVERT - u_short ipq_divert; /* divert protocol port */ + u_short ipq_divert BYTE_PACK; /* divert protocol port */ #endif }; @@ -85,12 +86,12 @@ struct ipasfrag { u_char ipf_mff; /* XXX overlays ip_tos: use low bit * to avoid destroying tos; * copied from (ip_off&IP_MF) */ - u_short ip_len; - u_short ip_id; - u_short ip_off; + u_short ip_len BYTE_PACK; + u_short ip_id BYTE_PACK; + u_short ip_off BYTE_PACK; u_char ip_ttl; u_char ip_p; - u_short ip_sum; + u_short ip_sum BYTE_PACK; struct ipasfrag *ipf_next; /* next fragment */ struct ipasfrag *ipf_prev; /* previous fragment */ }; diff --git a/c/src/exec/libnetworking/netinet/tcp.h b/c/src/exec/libnetworking/netinet/tcp.h index 3585917aa3..131d8011cf 100644 --- a/c/src/exec/libnetworking/netinet/tcp.h +++ b/c/src/exec/libnetworking/netinet/tcp.h @@ -45,10 +45,10 @@ typedef u_long tcp_cc; /* connection count per rfc1644 */ * Per RFC 793, September, 1981. */ struct tcphdr { - u_short th_sport; /* source port */ - u_short th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ + u_short th_sport BYTE_PACK; /* source port */ + u_short th_dport BYTE_PACK; /* destination port */ + tcp_seq th_seq BYTE_PACK; /* sequence number */ + tcp_seq th_ack BYTE_PACK; /* acknowledgement number */ #if BYTE_ORDER == LITTLE_ENDIAN u_char th_x2:4, /* (unused) */ th_off:4; /* data offset */ @@ -66,9 +66,9 @@ struct tcphdr { #define TH_URG 0x20 #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) - u_short th_win; /* window */ - u_short th_sum; /* checksum */ - u_short th_urp; /* urgent pointer */ + u_short th_win BYTE_PACK; /* window */ + u_short th_sum BYTE_PACK; /* checksum */ + u_short th_urp BYTE_PACK; /* urgent pointer */ }; #define TCPOPT_EOL 0 diff --git a/cpukit/libnetworking/ChangeLog b/cpukit/libnetworking/ChangeLog index 22d61a0fe3..e7ad37920c 100644 --- a/cpukit/libnetworking/ChangeLog +++ b/cpukit/libnetworking/ChangeLog @@ -1,3 +1,7 @@ +2002-07-17 Jay Monkman + + * netinet/in.h, netinet/ip.h, netinet/ip_var.h, netinet/tcp.h: + Modified to added packed attribute.o 2002-07-05 Ralf Corsepius * configure.ac: RTEMS_TOP(../..). diff --git a/cpukit/libnetworking/netinet/in.h b/cpukit/libnetworking/netinet/in.h index 36d2d4e867..7cc4709697 100644 --- a/cpukit/libnetworking/netinet/in.h +++ b/cpukit/libnetworking/netinet/in.h @@ -204,12 +204,12 @@ * have a fit if we use. */ #define IPPORT_RESERVEDSTART 600 - +#define BYTE_PACK __attribute__((packed)) /* * Internet address (a structure for historical reasons) */ struct in_addr { - u_long s_addr; + u_long s_addr BYTE_PACK; }; /* diff --git a/cpukit/libnetworking/netinet/ip.h b/cpukit/libnetworking/netinet/ip.h index e7f824ca6f..e6be7d305d 100644 --- a/cpukit/libnetworking/netinet/ip.h +++ b/cpukit/libnetworking/netinet/ip.h @@ -64,17 +64,18 @@ struct ip { #endif #endif /* not _IP_VHL */ u_char ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ + u_short ip_len BYTE_PACK; /* total length */ + u_short ip_id BYTE_PACK; /* identification */ + u_short ip_off BYTE_PACK; /* fragment offset field */ #define IP_RF 0x8000 /* reserved fragment flag */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ u_char ip_ttl; /* time to live */ u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ + u_short ip_sum BYTE_PACK; /* checksum */ + struct in_addr ip_src BYTE_PACK; /* source address */ + struct in_addr ip_dst BYTE_PACK; /* dest address */ }; #ifdef _IP_VHL diff --git a/cpukit/libnetworking/netinet/ip_var.h b/cpukit/libnetworking/netinet/ip_var.h index cc7908e9a3..38e7896c4a 100644 --- a/cpukit/libnetworking/netinet/ip_var.h +++ b/cpukit/libnetworking/netinet/ip_var.h @@ -41,10 +41,11 @@ * Overlay for ip header used by other protocols (tcp, udp). */ struct ipovly { - caddr_t ih_next, ih_prev; /* for protocol sequence q's */ + caddr_t ih_next BYTE_PACK; + caddr_t ih_prev BYTE_PACK; /* for protocol sequence q's */ u_char ih_x1; /* (unused) */ u_char ih_pr; /* protocol */ - u_short ih_len; /* protocol length */ + u_short ih_len BYTE_PACK; /* protocol length */ struct in_addr ih_src; /* source internet address */ struct in_addr ih_dst; /* destination internet address */ }; @@ -59,12 +60,12 @@ struct ipq { struct ipq *next,*prev; /* to other reass headers */ u_char ipq_ttl; /* time for reass q to live */ u_char ipq_p; /* protocol of this fragment */ - u_short ipq_id; /* sequence id for reassembly */ + u_short ipq_id BYTE_PACK; /* sequence id for reassembly */ struct ipasfrag *ipq_next,*ipq_prev; /* to ip headers of fragments */ struct in_addr ipq_src,ipq_dst; #ifdef IPDIVERT - u_short ipq_divert; /* divert protocol port */ + u_short ipq_divert BYTE_PACK; /* divert protocol port */ #endif }; @@ -85,12 +86,12 @@ struct ipasfrag { u_char ipf_mff; /* XXX overlays ip_tos: use low bit * to avoid destroying tos; * copied from (ip_off&IP_MF) */ - u_short ip_len; - u_short ip_id; - u_short ip_off; + u_short ip_len BYTE_PACK; + u_short ip_id BYTE_PACK; + u_short ip_off BYTE_PACK; u_char ip_ttl; u_char ip_p; - u_short ip_sum; + u_short ip_sum BYTE_PACK; struct ipasfrag *ipf_next; /* next fragment */ struct ipasfrag *ipf_prev; /* previous fragment */ }; diff --git a/cpukit/libnetworking/netinet/tcp.h b/cpukit/libnetworking/netinet/tcp.h index 3585917aa3..131d8011cf 100644 --- a/cpukit/libnetworking/netinet/tcp.h +++ b/cpukit/libnetworking/netinet/tcp.h @@ -45,10 +45,10 @@ typedef u_long tcp_cc; /* connection count per rfc1644 */ * Per RFC 793, September, 1981. */ struct tcphdr { - u_short th_sport; /* source port */ - u_short th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ + u_short th_sport BYTE_PACK; /* source port */ + u_short th_dport BYTE_PACK; /* destination port */ + tcp_seq th_seq BYTE_PACK; /* sequence number */ + tcp_seq th_ack BYTE_PACK; /* acknowledgement number */ #if BYTE_ORDER == LITTLE_ENDIAN u_char th_x2:4, /* (unused) */ th_off:4; /* data offset */ @@ -66,9 +66,9 @@ struct tcphdr { #define TH_URG 0x20 #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) - u_short th_win; /* window */ - u_short th_sum; /* checksum */ - u_short th_urp; /* urgent pointer */ + u_short th_win BYTE_PACK; /* window */ + u_short th_sum BYTE_PACK; /* checksum */ + u_short th_urp BYTE_PACK; /* urgent pointer */ }; #define TCPOPT_EOL 0 -- cgit v1.2.3