summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2011-02-24 14:57:34 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2011-02-24 14:57:34 +0000
commitee7f2f7bcc468caeda77c0de0defd0d5f6cdaa18 (patch)
tree05943ac52680a6cc59bef2a4fd611571387e6306 /cpukit
parent2011-02-24 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-ee7f2f7bcc468caeda77c0de0defd0d5f6cdaa18.tar.bz2
2011-02-24 Ralf Corsépius <ralf.corsepius@rtems.org>
* libnetworking/netinet/ip_icmp.c, libnetworking/netinet/ip_icmp.h: Misc. changes from FreeBSD. * libnetworking/netinet/tcp_var.h: Include <netinet/tcp_timer.h>.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog6
-rw-r--r--cpukit/libnetworking/netinet/ip_icmp.c20
-rw-r--r--cpukit/libnetworking/netinet/ip_icmp.h28
-rw-r--r--cpukit/libnetworking/netinet/tcp_var.h2
4 files changed, 37 insertions, 19 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 5903110450..e10ee89366 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,11 @@
2011-02-24 Ralf Corsépius <ralf.corsepius@rtems.org>
+ * libnetworking/netinet/ip_icmp.c, libnetworking/netinet/ip_icmp.h:
+ Misc. changes from FreeBSD.
+ * libnetworking/netinet/tcp_var.h: Include <netinet/tcp_timer.h>.
+
+2011-02-24 Ralf Corsépius <ralf.corsepius@rtems.org>
+
* libnetworking/netinet/in_systm.h,
libnetworking/netinet/tcp_debug.c,
libnetworking/netinet/tcp_debug.h, libnetworking/netinet/tcp_seq.h,
diff --git a/cpukit/libnetworking/netinet/ip_icmp.c b/cpukit/libnetworking/netinet/ip_icmp.c
index 8c3c0f97d0..1bcd648f66 100644
--- a/cpukit/libnetworking/netinet/ip_icmp.c
+++ b/cpukit/libnetworking/netinet/ip_icmp.c
@@ -40,25 +40,28 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/kernel.h>
-#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if.h>
+#include <net/if_types.h>
#include <net/route.h>
#define _IP_VHL
#include <netinet/in.h>
+#include <netinet/in_pcb.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/ip_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_var.h>
+#include <netinet/tcpip.h>
#include <netinet/icmp_var.h>
#ifdef IPSEC
@@ -96,7 +99,6 @@ static int icmpallecho = 1;
SYSCTL_INT(_net_inet_icmp, OID_AUTO, allecho, CTLFLAG_RW, &icmpallecho,
0, "");
-/* #define ICMPPRINTFS 1 */
#ifdef ICMPPRINTFS
int icmpprintfs = 0;
#endif
@@ -254,7 +256,7 @@ icmp_input(struct mbuf *m, int off)
goto freeit;
}
i = hlen + min(icmplen, ICMP_ADVLENMIN);
- if (m->m_len < i && (m = m_pullup(m, i)) == 0) {
+ if (m->m_len < i && (m = m_pullup(m, i)) == NULL) {
icmpstat.icps_tooshort++;
return;
}
@@ -466,10 +468,11 @@ icmp_input(struct mbuf *m, int off)
}
ia = (struct in_ifaddr *)ifaof_ifpforaddr(
(struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif);
- if (ia == 0)
+ if (ia == NULL)
break;
- if (ia->ia_ifp == 0)
+ if (ia->ia_ifp == NULL) {
break;
+ }
icp->icmp_type = ICMP_MASKREPLY;
icp->icmp_mask = ia->ia_sockmask.sin_addr.s_addr;
if (ip->ip_src.s_addr == 0) {
@@ -717,7 +720,10 @@ icmp_send(struct mbuf *m, struct mbuf *opts)
RTFREE(ro.ro_rt);
}
-n_time
+/*
+ * Return milliseconds since 00:00 GMT in network format.
+ */
+uint32_t
iptime(void)
{
struct timeval atv;
diff --git a/cpukit/libnetworking/netinet/ip_icmp.h b/cpukit/libnetworking/netinet/ip_icmp.h
index 1a763de365..655e687b62 100644
--- a/cpukit/libnetworking/netinet/ip_icmp.h
+++ b/cpukit/libnetworking/netinet/ip_icmp.h
@@ -54,22 +54,22 @@ struct icmp_ra_addr {
* Structure of an icmp header.
*/
struct icmp {
- u_char icmp_type; /* type of message, see below */
- u_char icmp_code; /* type sub code */
- u_short icmp_cksum; /* ones complement cksum of struct */
+ u_char icmp_type; /* type of message, see below */
+ u_char icmp_code; /* type sub code */
+ u_short icmp_cksum; /* ones complement cksum of struct */
union {
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
- n_short icd_id;
- n_short icd_seq;
+ uint16_t icd_id; /* network format */
+ uint16_t icd_seq; /* network format */
} ih_idseq;
int ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
- n_short ipm_void;
- n_short ipm_nextmtu;
+ uint16_t ipm_void; /* network format */
+ uint16_t ipm_nextmtu; /* network format */
} ih_pmtu;
struct ih_rtradv {
@@ -90,16 +90,20 @@ struct icmp {
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union {
struct id_ts { /* ICMP Timestamp */
- n_time its_otime; /* Originate */
- n_time its_rtime; /* Receive */
- n_time its_ttime; /* Transmit */
+ /*
+ * The next 3 fields are in network format,
+ * milliseconds since 00:00 GMT
+ */
+ uint32_t its_otime; /* Originate */
+ uint32_t its_rtime; /* Receive */
+ uint32_t its_ttime; /* Transmit */
} id_ts;
struct id_ip {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
struct icmp_ra_addr id_radv;
- u_int32_t id_mask;
+ u_int32_t id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
@@ -120,7 +124,7 @@ struct icmp {
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
-#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMP_TSLEN (8 + 3 * sizeof (uint32_t)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
#ifndef _IP_VHL
diff --git a/cpukit/libnetworking/netinet/tcp_var.h b/cpukit/libnetworking/netinet/tcp_var.h
index aea40f694e..12fab1995c 100644
--- a/cpukit/libnetworking/netinet/tcp_var.h
+++ b/cpukit/libnetworking/netinet/tcp_var.h
@@ -44,6 +44,8 @@
*/
#ifdef __BSD_VISIBLE
+#include <netinet/tcp_timer.h> /* TCPT_NTIMERS */
+
/*
* Tcp control block, one per tcp; fields:
*/