Page MenuHomeFreeBSD

D50895.id157157.diff
No OneTemporary

D50895.id157157.diff

diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -131,10 +131,10 @@
static uint32_t syncookie_mac(struct in_conninfo *, tcp_seq, uint8_t,
uint8_t *, uintptr_t);
static tcp_seq syncookie_generate(struct syncache_head *, struct syncache *);
-static struct syncache
- *syncookie_lookup(struct in_conninfo *, struct syncache_head *,
- struct syncache *, struct tcphdr *, struct tcpopt *,
- struct socket *, uint16_t);
+static bool syncookie_expand(struct in_conninfo *,
+ const struct syncache_head *, struct syncache *,
+ struct tcphdr *, struct tcpopt *, struct socket *,
+ uint16_t);
static void syncache_pause(struct in_conninfo *);
static void syncache_unpause(void *);
static void syncookie_reseed(void *);
@@ -1112,7 +1112,8 @@
goto failed;
}
bzero(&scs, sizeof(scs));
- sc = syncookie_lookup(inc, sch, &scs, th, to, *lsop, port);
+ if (syncookie_expand(inc, sch, &scs, th, to, *lsop, port))
+ sc = &scs;
if (locked)
SCH_UNLOCK(sch);
if (sc == NULL) {
@@ -2251,8 +2252,8 @@
return (iss);
}
-static struct syncache *
-syncookie_lookup(struct in_conninfo *inc, struct syncache_head *sch,
+static bool
+syncookie_expand(struct in_conninfo *inc, const struct syncache_head *sch,
struct syncache *sc, struct tcphdr *th, struct tcpopt *to,
struct socket *lso, uint16_t port)
{
@@ -2282,7 +2283,7 @@
/* The recomputed hash matches the ACK if this was a genuine cookie. */
if ((ack & ~0xff) != (hash & ~0xff))
- return (NULL);
+ return (false);
/* Fill in the syncache values. */
sc->sc_flags = 0;
@@ -2343,7 +2344,7 @@
sc->sc_port = port;
TCPSTAT_INC(tcps_sc_recvcookie);
- return (sc);
+ return (true);
}
#ifdef INVARIANTS
@@ -2352,11 +2353,12 @@
struct syncache *sc, struct tcphdr *th, struct tcpopt *to,
struct socket *lso, uint16_t port)
{
- struct syncache scs, *scx;
+ struct syncache scs, *scx = NULL;
char *s;
bzero(&scs, sizeof(scs));
- scx = syncookie_lookup(inc, sch, &scs, th, to, lso, port);
+ if (syncookie_expand(inc, sch, &scs, th, to, lso, port))
+ scx = &scs;
if ((s = tcp_log_addrs(inc, th, NULL, NULL)) == NULL)
return (0);

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 25, 10:06 PM (2 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35501754
Default Alt Text
D50895.id157157.diff (2 KB)

Event Timeline