forked from Imagelibrary/rtems
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>.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
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>
|
2011-02-24 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* libnetworking/netinet/in_systm.h,
|
* libnetworking/netinet/in_systm.h,
|
||||||
|
|||||||
@@ -40,25 +40,28 @@
|
|||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/malloc.h>
|
|
||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
#include <sys/protosw.h>
|
#include <sys/protosw.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
#include <net/if_types.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
|
||||||
#define _IP_VHL
|
#define _IP_VHL
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/in_pcb.h>
|
||||||
#include <netinet/in_systm.h>
|
#include <netinet/in_systm.h>
|
||||||
#include <netinet/in_var.h>
|
#include <netinet/in_var.h>
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/ip_icmp.h>
|
#include <netinet/ip_icmp.h>
|
||||||
#include <netinet/ip_var.h>
|
#include <netinet/ip_var.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <netinet/tcp_var.h>
|
||||||
|
#include <netinet/tcpip.h>
|
||||||
#include <netinet/icmp_var.h>
|
#include <netinet/icmp_var.h>
|
||||||
|
|
||||||
#ifdef IPSEC
|
#ifdef IPSEC
|
||||||
@@ -96,7 +99,6 @@ static int icmpallecho = 1;
|
|||||||
SYSCTL_INT(_net_inet_icmp, OID_AUTO, allecho, CTLFLAG_RW, &icmpallecho,
|
SYSCTL_INT(_net_inet_icmp, OID_AUTO, allecho, CTLFLAG_RW, &icmpallecho,
|
||||||
0, "");
|
0, "");
|
||||||
|
|
||||||
/* #define ICMPPRINTFS 1 */
|
|
||||||
#ifdef ICMPPRINTFS
|
#ifdef ICMPPRINTFS
|
||||||
int icmpprintfs = 0;
|
int icmpprintfs = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -254,7 +256,7 @@ icmp_input(struct mbuf *m, int off)
|
|||||||
goto freeit;
|
goto freeit;
|
||||||
}
|
}
|
||||||
i = hlen + min(icmplen, ICMP_ADVLENMIN);
|
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++;
|
icmpstat.icps_tooshort++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -466,10 +468,11 @@ icmp_input(struct mbuf *m, int off)
|
|||||||
}
|
}
|
||||||
ia = (struct in_ifaddr *)ifaof_ifpforaddr(
|
ia = (struct in_ifaddr *)ifaof_ifpforaddr(
|
||||||
(struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif);
|
(struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif);
|
||||||
if (ia == 0)
|
if (ia == NULL)
|
||||||
break;
|
break;
|
||||||
if (ia->ia_ifp == 0)
|
if (ia->ia_ifp == NULL) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
icp->icmp_type = ICMP_MASKREPLY;
|
icp->icmp_type = ICMP_MASKREPLY;
|
||||||
icp->icmp_mask = ia->ia_sockmask.sin_addr.s_addr;
|
icp->icmp_mask = ia->ia_sockmask.sin_addr.s_addr;
|
||||||
if (ip->ip_src.s_addr == 0) {
|
if (ip->ip_src.s_addr == 0) {
|
||||||
@@ -717,7 +720,10 @@ icmp_send(struct mbuf *m, struct mbuf *opts)
|
|||||||
RTFREE(ro.ro_rt);
|
RTFREE(ro.ro_rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
n_time
|
/*
|
||||||
|
* Return milliseconds since 00:00 GMT in network format.
|
||||||
|
*/
|
||||||
|
uint32_t
|
||||||
iptime(void)
|
iptime(void)
|
||||||
{
|
{
|
||||||
struct timeval atv;
|
struct timeval atv;
|
||||||
|
|||||||
@@ -54,22 +54,22 @@ struct icmp_ra_addr {
|
|||||||
* Structure of an icmp header.
|
* Structure of an icmp header.
|
||||||
*/
|
*/
|
||||||
struct icmp {
|
struct icmp {
|
||||||
u_char icmp_type; /* type of message, see below */
|
u_char icmp_type; /* type of message, see below */
|
||||||
u_char icmp_code; /* type sub code */
|
u_char icmp_code; /* type sub code */
|
||||||
u_short icmp_cksum; /* ones complement cksum of struct */
|
u_short icmp_cksum; /* ones complement cksum of struct */
|
||||||
union {
|
union {
|
||||||
u_char ih_pptr; /* ICMP_PARAMPROB */
|
u_char ih_pptr; /* ICMP_PARAMPROB */
|
||||||
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
|
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
|
||||||
struct ih_idseq {
|
struct ih_idseq {
|
||||||
n_short icd_id;
|
uint16_t icd_id; /* network format */
|
||||||
n_short icd_seq;
|
uint16_t icd_seq; /* network format */
|
||||||
} ih_idseq;
|
} ih_idseq;
|
||||||
int ih_void;
|
int ih_void;
|
||||||
|
|
||||||
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
|
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
|
||||||
struct ih_pmtu {
|
struct ih_pmtu {
|
||||||
n_short ipm_void;
|
uint16_t ipm_void; /* network format */
|
||||||
n_short ipm_nextmtu;
|
uint16_t ipm_nextmtu; /* network format */
|
||||||
} ih_pmtu;
|
} ih_pmtu;
|
||||||
|
|
||||||
struct ih_rtradv {
|
struct ih_rtradv {
|
||||||
@@ -90,16 +90,20 @@ struct icmp {
|
|||||||
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
|
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
|
||||||
union {
|
union {
|
||||||
struct id_ts { /* ICMP Timestamp */
|
struct id_ts { /* ICMP Timestamp */
|
||||||
n_time its_otime; /* Originate */
|
/*
|
||||||
n_time its_rtime; /* Receive */
|
* The next 3 fields are in network format,
|
||||||
n_time its_ttime; /* Transmit */
|
* milliseconds since 00:00 GMT
|
||||||
|
*/
|
||||||
|
uint32_t its_otime; /* Originate */
|
||||||
|
uint32_t its_rtime; /* Receive */
|
||||||
|
uint32_t its_ttime; /* Transmit */
|
||||||
} id_ts;
|
} id_ts;
|
||||||
struct id_ip {
|
struct id_ip {
|
||||||
struct ip idi_ip;
|
struct ip idi_ip;
|
||||||
/* options and then 64 bits of data */
|
/* options and then 64 bits of data */
|
||||||
} id_ip;
|
} id_ip;
|
||||||
struct icmp_ra_addr id_radv;
|
struct icmp_ra_addr id_radv;
|
||||||
u_int32_t id_mask;
|
u_int32_t id_mask;
|
||||||
char id_data[1];
|
char id_data[1];
|
||||||
} icmp_dun;
|
} icmp_dun;
|
||||||
#define icmp_otime icmp_dun.id_ts.its_otime
|
#define icmp_otime icmp_dun.id_ts.its_otime
|
||||||
@@ -120,7 +124,7 @@ struct icmp {
|
|||||||
* ip header length.
|
* ip header length.
|
||||||
*/
|
*/
|
||||||
#define ICMP_MINLEN 8 /* abs minimum */
|
#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_MASKLEN 12 /* address mask */
|
||||||
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
|
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
|
||||||
#ifndef _IP_VHL
|
#ifndef _IP_VHL
|
||||||
|
|||||||
@@ -44,6 +44,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __BSD_VISIBLE
|
#ifdef __BSD_VISIBLE
|
||||||
|
#include <netinet/tcp_timer.h> /* TCPT_NTIMERS */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tcp control block, one per tcp; fields:
|
* Tcp control block, one per tcp; fields:
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user