Module Name: src
Committed By: ozaki-r
Date: Fri Nov 4 09:03:20 UTC 2022
Modified Files:
src/sys/netinet: in.c in_pcb.c in_pcb.h
src/sys/netinet6: in6_pcb.c
Log Message:
inpcb: use in_port_t for port numbers
To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/netinet/in.c
cvs rdiff -u -r1.197 -r1.198 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.75 -r1.76 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.175 -r1.176 src/sys/netinet6/in6_pcb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.243 src/sys/netinet/in.c:1.244
--- src/sys/netinet/in.c:1.243 Tue Sep 20 02:23:37 2022
+++ src/sys/netinet/in.c Fri Nov 4 09:03:20 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in.c,v 1.243 2022/09/20 02:23:37 knakahara Exp $ */
+/* $NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.243 2022/09/20 02:23:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $");
#include "arp.h"
@@ -1861,7 +1861,7 @@ in_selectsrc(struct sockaddr_in *sin, st
ia = ifatoia(ifa);
}
if (ia == NULL) {
- u_int16_t fport = sin->sin_port;
+ in_port_t fport = sin->sin_port;
struct ifaddr *ifa;
int s;
Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.197 src/sys/netinet/in_pcb.c:1.198
--- src/sys/netinet/in_pcb.c:1.197 Fri Nov 4 09:02:38 2022
+++ src/sys/netinet/in_pcb.c Fri Nov 4 09:03:20 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $ */
+/* $NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -187,7 +187,7 @@ inpcb_init(struct inpcbtable *table, int
table->inpt_connecthashtbl = hashinit(connecthashsize, HASH_LIST, true,
&table->inpt_connecthash);
table->inpt_lastlow = IPPORT_RESERVEDMAX;
- table->inpt_lastport = (u_int16_t)anonportmax;
+ table->inpt_lastport = (in_port_t)anonportmax;
RUN_ONCE(&control, inpcb_poolinit);
}
@@ -268,8 +268,8 @@ inpcb_set_port(struct sockaddr_in *sin,
{
struct inpcbtable *table = inp->inp_table;
struct socket *so = inp->inp_socket;
- u_int16_t *lastport;
- u_int16_t lport = 0;
+ in_port_t *lastport;
+ in_port_t lport = 0;
enum kauth_network_req req;
int error;
@@ -744,7 +744,7 @@ inpcb_notify(struct inpcbtable *table, s
{
struct inpcbhead *head;
struct inpcb *inp;
- u_int16_t fport = fport_arg, lport = lport_arg;
+ in_port_t fport = fport_arg, lport = lport_arg;
int nmatch;
if (in_nullhost(faddr) || notify == 0)
@@ -926,7 +926,7 @@ inpcb_lookup_local(struct inpcbtable *ta
struct inpcb *match = NULL;
int matchwild = 3;
int wildcard;
- u_int16_t lport = lport_arg;
+ in_port_t lport = lport_arg;
if (vp)
vp->valid = 0;
@@ -1034,7 +1034,7 @@ inpcb_lookup(struct inpcbtable *table,
{
struct inpcbhead *head;
struct inpcb *inp;
- u_int16_t fport = fport_arg, lport = lport_arg;
+ in_port_t fport = fport_arg, lport = lport_arg;
if (vp)
vp->valid = 0;
@@ -1080,7 +1080,7 @@ inpcb_lookup_bound(struct inpcbtable *ta
{
struct inpcbhead *head;
struct inpcb *inp;
- u_int16_t lport = lport_arg;
+ in_port_t lport = lport_arg;
head = INPCBHASH_BIND(table, laddr, lport);
LIST_FOREACH(inp, head, inp_hash) {
Index: src/sys/netinet/in_pcb.h
diff -u src/sys/netinet/in_pcb.h:1.75 src/sys/netinet/in_pcb.h:1.76
--- src/sys/netinet/in_pcb.h:1.75 Fri Nov 4 09:01:53 2022
+++ src/sys/netinet/in_pcb.h Fri Nov 4 09:03:20 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.h,v 1.75 2022/11/04 09:01:53 ozaki-r Exp $ */
+/* $NetBSD: in_pcb.h,v 1.76 2022/11/04 09:03:20 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -101,8 +101,8 @@ struct inpcb {
struct inpcbtable *inp_table;
struct inpcbpolicy *inp_sp; /* security policy */
struct route inp_route; /* placeholder for routing entry */
- u_int16_t inp_fport; /* foreign port */
- u_int16_t inp_lport; /* local port */
+ in_port_t inp_fport; /* foreign port */
+ in_port_t inp_lport; /* local port */
int inp_flags; /* generic IP/datagram flags */
struct mbuf *inp_options; /* IP options */
bool inp_bindportonsend;
@@ -232,8 +232,8 @@ struct inpcbtable {
u_long inpt_porthash;
u_long inpt_bindhash;
u_long inpt_connecthash;
- u_int16_t inpt_lastport;
- u_int16_t inpt_lastlow;
+ in_port_t inpt_lastport;
+ in_port_t inpt_lastlow;
struct vestigial_hooks *vestige;
};
Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.175 src/sys/netinet6/in6_pcb.c:1.176
--- src/sys/netinet6/in6_pcb.c:1.175 Fri Nov 4 09:01:53 2022
+++ src/sys/netinet6/in6_pcb.c Fri Nov 4 09:03:20 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.175 2022/11/04 09:01:53 ozaki-r Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.176 2022/11/04 09:03:20 ozaki-r Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.175 2022/11/04 09:01:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.176 2022/11/04 09:03:20 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -134,7 +134,7 @@ in6pcb_init(struct inpcbtable *table, in
{
inpcb_init(table, bindhashsize, connecthashsize);
- table->inpt_lastport = (u_int16_t)ip6_anonportmax;
+ table->inpt_lastport = (in_port_t)ip6_anonportmax;
}
/*
@@ -606,7 +606,7 @@ in6pcb_notify(struct inpcbtable *table,
struct inpcb *inp;
struct sockaddr_in6 sa6_src;
const struct sockaddr_in6 *sa6_dst;
- u_int16_t fport = fport_arg, lport = lport_arg;
+ in_port_t fport = fport_arg, lport = lport_arg;
int errno;
int nmatch = 0;
u_int32_t flowinfo;
@@ -836,7 +836,7 @@ in6pcb_lookup_local(struct inpcbtable *t
struct inpcbhead *head;
struct inpcb *inp, *match = NULL;
int matchwild = 3, wildcard;
- u_int16_t lport = lport_arg;
+ in_port_t lport = lport_arg;
if (vp)
vp->valid = 0;
@@ -1047,7 +1047,7 @@ in6pcb_lookup(struct inpcbtable *table,
{
struct inpcbhead *head;
struct inpcb *inp;
- u_int16_t fport = fport_arg, lport = lport_arg;
+ in_port_t fport = fport_arg, lport = lport_arg;
if (vp)
vp->valid = 0;
@@ -1091,7 +1091,7 @@ in6pcb_lookup_bound(struct inpcbtable *t
{
struct inpcbhead *head;
struct inpcb *inp;
- u_int16_t lport = lport_arg;
+ in_port_t lport = lport_arg;
#ifdef INET
struct in6_addr zero_mapped;
#endif