summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>1999-09-10 15:27:34 +0000
committerRuslan Ermilov <ru@FreeBSD.org>1999-09-10 15:27:34 +0000
commit92da29a00df7e198966bfffd678b356e8317ddbd (patch)
tree2d61105ce4babaf6a45ce333a930ecd0525d2d1e
parent76e2530cfb099daabe31d736ca0ec8b7416723a7 (diff)
downloadsrc-test2-92da29a00df7e198966bfffd678b356e8317ddbd.tar.gz
src-test2-92da29a00df7e198966bfffd678b356e8317ddbd.zip
Notes
-rw-r--r--lib/libalias/alias.c20
-rw-r--r--sys/netinet/libalias/alias.c20
2 files changed, 22 insertions, 18 deletions
diff --git a/lib/libalias/alias.c b/lib/libalias/alias.c
index 38089120b5f6..9c072dfcfa20 100644
--- a/lib/libalias/alias.c
+++ b/lib/libalias/alias.c
@@ -118,7 +118,7 @@
TcpMonitorIn() -- These routines monitor TCP connections, and
TcpMonitorOut() delete a link when a connection is closed.
-These routines look for SYN, ACK and RST flags to determine when TCP
+These routines look for SYN, FIN and RST flags to determine when TCP
connections open and close. When a TCP connection closes, the data
structure containing packet aliasing information is deleted after
a timeout period.
@@ -140,12 +140,13 @@ TcpMonitorIn(struct ip *pip, struct alias_link *link)
switch (GetStateIn(link))
{
case ALIAS_TCP_STATE_NOT_CONNECTED:
- if (tc->th_flags & TH_SYN)
+ if (tc->th_flags & TH_RST)
+ SetStateIn(link, ALIAS_TCP_STATE_DISCONNECTED);
+ else if (tc->th_flags & TH_SYN)
SetStateIn(link, ALIAS_TCP_STATE_CONNECTED);
- /*FALLTHROUGH*/
+ break;
case ALIAS_TCP_STATE_CONNECTED:
- if (tc->th_flags & TH_FIN
- || tc->th_flags & TH_RST)
+ if (tc->th_flags & (TH_FIN | TH_RST))
SetStateIn(link, ALIAS_TCP_STATE_DISCONNECTED);
break;
}
@@ -161,12 +162,13 @@ TcpMonitorOut(struct ip *pip, struct alias_link *link)
switch (GetStateOut(link))
{
case ALIAS_TCP_STATE_NOT_CONNECTED:
- if (tc->th_flags & TH_SYN)
+ if (tc->th_flags & TH_RST)
+ SetStateOut(link, ALIAS_TCP_STATE_DISCONNECTED);
+ else if (tc->th_flags & TH_SYN)
SetStateOut(link, ALIAS_TCP_STATE_CONNECTED);
- /*FALLTHROUGH*/
+ break;
case ALIAS_TCP_STATE_CONNECTED:
- if (tc->th_flags & TH_FIN
- || tc->th_flags & TH_RST)
+ if (tc->th_flags & (TH_FIN | TH_RST))
SetStateOut(link, ALIAS_TCP_STATE_DISCONNECTED);
break;
}
diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c
index 38089120b5f6..9c072dfcfa20 100644
--- a/sys/netinet/libalias/alias.c
+++ b/sys/netinet/libalias/alias.c
@@ -118,7 +118,7 @@
TcpMonitorIn() -- These routines monitor TCP connections, and
TcpMonitorOut() delete a link when a connection is closed.
-These routines look for SYN, ACK and RST flags to determine when TCP
+These routines look for SYN, FIN and RST flags to determine when TCP
connections open and close. When a TCP connection closes, the data
structure containing packet aliasing information is deleted after
a timeout period.
@@ -140,12 +140,13 @@ TcpMonitorIn(struct ip *pip, struct alias_link *link)
switch (GetStateIn(link))
{
case ALIAS_TCP_STATE_NOT_CONNECTED:
- if (tc->th_flags & TH_SYN)
+ if (tc->th_flags & TH_RST)
+ SetStateIn(link, ALIAS_TCP_STATE_DISCONNECTED);
+ else if (tc->th_flags & TH_SYN)
SetStateIn(link, ALIAS_TCP_STATE_CONNECTED);
- /*FALLTHROUGH*/
+ break;
case ALIAS_TCP_STATE_CONNECTED:
- if (tc->th_flags & TH_FIN
- || tc->th_flags & TH_RST)
+ if (tc->th_flags & (TH_FIN | TH_RST))
SetStateIn(link, ALIAS_TCP_STATE_DISCONNECTED);
break;
}
@@ -161,12 +162,13 @@ TcpMonitorOut(struct ip *pip, struct alias_link *link)
switch (GetStateOut(link))
{
case ALIAS_TCP_STATE_NOT_CONNECTED:
- if (tc->th_flags & TH_SYN)
+ if (tc->th_flags & TH_RST)
+ SetStateOut(link, ALIAS_TCP_STATE_DISCONNECTED);
+ else if (tc->th_flags & TH_SYN)
SetStateOut(link, ALIAS_TCP_STATE_CONNECTED);
- /*FALLTHROUGH*/
+ break;
case ALIAS_TCP_STATE_CONNECTED:
- if (tc->th_flags & TH_FIN
- || tc->th_flags & TH_RST)
+ if (tc->th_flags & (TH_FIN | TH_RST))
SetStateOut(link, ALIAS_TCP_STATE_DISCONNECTED);
break;
}