Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet constify, comments.
details: https://anonhg.NetBSD.org/src/rev/e5aeb7a1ac3b
branches: trunk
changeset: 779827:e5aeb7a1ac3b
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Jun 21 10:31:45 2012 +0000
description:
constify, comments.
no functional changes.
diffstat:
sys/netinet/in_pcb.c | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diffs (66 lines):
diff -r 5fab57fca0e1 -r e5aeb7a1ac3b sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c Thu Jun 21 10:30:47 2012 +0000
+++ b/sys/netinet/in_pcb.c Thu Jun 21 10:31:45 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.141 2012/03/22 20:34:38 drochner Exp $ */
+/* $NetBSD: in_pcb.c,v 1.142 2012/06/21 10:31:45 yamt 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.141 2012/03/22 20:34:38 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.142 2012/06/21 10:31:45 yamt Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -806,8 +806,9 @@
{
struct inpcbhead *head;
struct inpcb_hdr *inph;
- struct inpcb *inp, *match = 0;
- int matchwild = 3, wildcard;
+ struct inpcb *match = NULL;
+ int matchwild = 3;
+ int wildcard;
u_int16_t lport = lport_arg;
if (vp)
@@ -815,12 +816,23 @@
head = INPCBHASH_PORT(table, lport);
LIST_FOREACH(inph, head, inph_lhash) {
- inp = (struct inpcb *)inph;
+ struct inpcb * const inp = (struct inpcb *)inph;
+
if (inp->inp_af != AF_INET)
continue;
-
if (inp->inp_lport != lport)
continue;
+ /*
+ * check if inp's faddr and laddr match with ours.
+ * our faddr is considered null.
+ * count the number of wildcard matches. (0 - 2)
+ *
+ * null null match
+ * A null wildcard match
+ * null B wildcard match
+ * A B non match
+ * A A match
+ */
wildcard = 0;
if (!in_nullhost(inp->inp_faddr))
wildcard++;
@@ -837,6 +849,9 @@
}
if (wildcard && !lookup_wildcard)
continue;
+ /*
+ * prefer an address with less wildcards.
+ */
if (wildcard < matchwild) {
match = inp;
matchwild = wildcard;
Home |
Main Index |
Thread Index |
Old Index