<sys/socket.h>, <netinet/{in,tcp,udp,udp_var}.h>

. add sa_len to sockaddr, sin_len to sockaddr_in
	. rename SCM_CREDENTIALS to SCM_CREDS
	. retire PF_FILE (same as PF_UNIX)

Change-Id: Id3ec63fe2556fc7ceb48de8ad4e80736df3ddfc7
This commit is contained in:
Ben Gras
2013-12-06 15:56:45 +01:00
committed by Lionel Sambuc
parent dda632a24f
commit 01624e6f86
14 changed files with 365 additions and 104 deletions

View File

@@ -1,5 +1,5 @@
INCSDIR= /usr/include/netinet
INCS+= in.h tcp.h
INCS+= in.h tcp.h in_systm.h ip.h
.include <bsd.kinc.mk>

View File

@@ -1,4 +1,4 @@
/* $NetBSD: in.h,v 1.86 2009/09/14 10:36:50 degroote Exp $ */
/* $NetBSD: in.h,v 1.87 2012/06/22 14:54:35 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -234,14 +234,6 @@ struct in_addr {
/*
* Socket address, internet style.
*/
#ifdef __minix
struct sockaddr_in
{
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
};
#else /* !__minix */
struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
@@ -249,11 +241,9 @@ struct sockaddr_in {
struct in_addr sin_addr;
__int8_t sin_zero[8];
};
#endif /* !__minix */
#define INET_ADDRSTRLEN 16
#ifndef __minix
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
@@ -269,13 +259,11 @@ struct ip_opts {
__int8_t ip_opts[40]; /* actually variable in size */
#endif
};
#endif /* __minix */
/*
* Options for use with [gs]etsockopt at the IP level.
* First word of comment is data type; bool is stored in int.
*/
#ifndef __minix
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
#define IP_HDRINCL 2 /* int; header is included with data */
#define IP_TOS 3 /* int; IP type of service and preced. */
@@ -287,10 +275,9 @@ struct ip_opts {
#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
#endif /* !__minix */
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
#ifndef __minix
#define IP_PORTALGO 18 /* int; port selection algo (rfc6056) */
#define IP_PORTRANGE 19 /* int; range to use for ephemeral port */
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
#define IP_ERRORMTU 21 /* int; get MTU of last xmit = EMSGSIZE */
@@ -299,16 +286,13 @@ struct ip_opts {
#endif
#define IP_RECVTTL 23 /* bool; receive IP TTL w/dgram */
#define IP_MINTTL 24 /* minimum TTL for packet or drop */
#endif /* !__minix */
#ifndef __minix
/*
* Defaults and limits for options
*/
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
#endif /* !__minix */
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
@@ -318,7 +302,6 @@ struct ip_mreq {
struct in_addr imr_interface; /* local IP address of interface */
};
#ifndef __minix
/*
* Argument for IP_PORTRANGE:
* - which range to search when port is unspecified at bind() or connect()
@@ -502,14 +485,12 @@ struct ip_mreq {
{ "stats", CTLTYPE_STRUCT }, \
}
#endif /* _NETBSD_SOURCE */
#endif /* __minix */
/* INET6 stuff */
#define __KAME_NETINET_IN_H_INCLUDED_
#include <netinet6/in6.h>
#undef __KAME_NETINET_IN_H_INCLUDED_
#ifndef __minix
#ifdef _KERNEL
/*
* in_cksum_phdr:
@@ -617,6 +598,5 @@ sockaddr_in_alloc(const struct in_addr *addr, in_port_t port, int flags)
return sa;
}
#endif /* _KERNEL */
#endif /* __minix */
#endif /* !_NETINET_IN_H_ */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: tcp.h,v 1.28 2007/12/25 18:33:47 perry Exp $ */
/* $NetBSD: tcp.h,v 1.30 2012/01/07 20:20:22 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -37,29 +37,30 @@
#include <sys/featuretest.h>
#if defined(_NETBSD_SOURCE)
#include <sys/types.h>
typedef u_int32_t tcp_seq;
typedef uint32_t tcp_seq;
/*
* TCP header.
* Per RFC 793, September, 1981.
* Updated by RFC 3168, September, 2001.
*/
struct tcphdr {
u_int16_t th_sport; /* source port */
u_int16_t th_dport; /* destination port */
uint16_t th_sport; /* source port */
uint16_t th_dport; /* destination port */
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
#if BYTE_ORDER == LITTLE_ENDIAN
/*LINTED non-portable bitfields*/
u_int8_t th_x2:4, /* (unused) */
uint8_t th_x2:4, /* (unused) */
th_off:4; /* data offset */
#endif
#if BYTE_ORDER == BIG_ENDIAN
/*LINTED non-portable bitfields*/
u_int8_t th_off:4, /* data offset */
uint8_t th_off:4, /* data offset */
th_x2:4; /* (unused) */
#endif
u_int8_t th_flags;
uint8_t th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
@@ -68,9 +69,9 @@ struct tcphdr {
#define TH_URG 0x20
#define TH_ECE 0x40
#define TH_CWR 0x80
u_int16_t th_win; /* window */
u_int16_t th_sum; /* checksum */
u_int16_t th_urp; /* urgent pointer */
uint16_t th_win; /* window */
uint16_t th_sum; /* checksum */
uint16_t th_urp; /* urgent pointer */
} __packed;
#define TCPOPT_EOL 0
@@ -115,5 +116,18 @@ struct tcphdr {
* User-settable options (used with setsockopt).
*/
#define TCP_NODELAY 1 /* don't delay send to coalesce packets */
#define TCP_MAXSEG 2 /* set maximum segment size */
#define TCP_KEEPIDLE 3
#ifdef notyet
#define TCP_NOPUSH 4 /* reserved for FreeBSD compat */
#endif
#define TCP_KEEPINTVL 5
#define TCP_KEEPCNT 6
#define TCP_KEEPINIT 7
#ifdef notyet
#define TCP_NOOPT 8 /* reserved for FreeBSD compat */
#endif
#define TCP_MD5SIG 0x10 /* use MD5 digests (RFC2385) */
#define TCP_CONGCTL 0x20 /* selected congestion control */
#endif /* !_NETINET_TCP_H_ */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: udp.h,v 1.15 2012/01/07 20:20:12 christos Exp $ */
/* $NetBSD: udp.h,v 1.16 2012/06/22 14:54:35 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -48,7 +48,6 @@ struct udphdr {
/* socket options for UDP */
#define UDP_ENCAP 100
#define UDP_RFC6056ALGO 200
/* Encapsulation types */
#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: udp_var.h,v 1.37 2011/09/24 17:18:17 christos Exp $ */
/* $NetBSD: udp_var.h,v 1.38 2012/06/22 14:54:35 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -75,7 +75,6 @@ struct udpiphdr {
#define UDPCTL_RECVSPACE 3 /* default recv buffer */
#define UDPCTL_LOOPBACKCKSUM 4 /* do UDP checksum on loopback */
#define UDPCTL_STATS 5 /* UDP statistics */
#define UDPCTL_RFC6056 6 /* RFC 6056 algorithm selection */
#define UDPCTL_MAXID 7
#define UDPCTL_NAMES { \
@@ -85,7 +84,6 @@ struct udpiphdr {
{ "recvspace", CTLTYPE_INT }, \
{ "do_loopback_cksum", CTLTYPE_INT }, \
{ "stats", CTLTYPE_STRUCT }, \
{ "rfc6056", CTLTYPE_INT }, \
}
#ifdef _KERNEL