Page MenuHomeFreeBSD

D30570.diff
No OneTemporary

D30570.diff

diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c
--- a/sys/netinet/libalias/alias_db.c
+++ b/sys/netinet/libalias/alias_db.c
@@ -401,6 +401,13 @@
void SctpShowAliasStats(struct libalias *la);
+static u_int
+StartPartialIn(u_short alias_port, int link_type)
+{
+ return (link_type == LINK_PPTP) ? 0
+ : (alias_port % LINK_PARTIAL_SIZE);
+}
+
static u_int
StartPointIn(struct in_addr alias_addr,
u_short alias_port,
@@ -1036,8 +1043,13 @@
LIST_INSERT_HEAD(&la->linkTableOut[start_point], lnk, list_out);
/* Set up pointers for input lookup table */
- start_point = StartPointIn(alias_addr, lnk->alias_port, link_type);
- LIST_INSERT_HEAD(&la->linkTableIn[start_point], lnk, list_in);
+ if (lnk->flags & LINK_PARTIALLY_SPECIFIED) {
+ start_point = StartPartialIn(lnk->alias_port, link_type);
+ LIST_INSERT_HEAD(&la->linkPartialIn[start_point], lnk, list_in);
+ } else {
+ start_point = StartPointIn(alias_addr, lnk->alias_port, link_type);
+ LIST_INSERT_HEAD(&la->linkTableIn[start_point], lnk, list_in);
+ }
/* Include the element into the housekeeping list */
TAILQ_INSERT_TAIL(&la->checkExpire, lnk, list_expire);
@@ -1213,8 +1225,6 @@
if (!(flags_in & LINK_PARTIALLY_SPECIFIED)) {
LIST_FOREACH(lnk, &la->linkTableIn[start_point], list_in) {
INGUARD;
- if (lnk->flags & LINK_PARTIALLY_SPECIFIED)
- continue;
if (lnk->dst_addr.s_addr == dst_addr.s_addr
&& lnk->dst_port == dst_port) {
CleanupLink(la, &lnk);
@@ -1224,28 +1234,44 @@
}
}
}
- }
- LIST_FOREACH(lnk, &la->linkTableIn[start_point], list_in) {
- int flags;
+ } else {
+ LIST_FOREACH(lnk, &la->linkTableIn[start_point], list_in) {
+ int flags = flags_in & LINK_PARTIALLY_SPECIFIED;
- INGUARD;
- flags = flags_in | lnk->flags;
- if ((flags & LINK_UNKNOWN_DEST_ADDR)
- && (flags & LINK_UNKNOWN_DEST_PORT)) {
- if (lnk_unknown_all == NULL)
+ INGUARD;
+ if (flags == LINK_PARTIALLY_SPECIFIED &&
+ lnk_unknown_all == NULL)
lnk_unknown_all = lnk;
- } else if (flags & LINK_UNKNOWN_DEST_ADDR) {
- if (lnk->dst_port == dst_port) {
- if (lnk_unknown_dst_addr == NULL)
- lnk_unknown_dst_addr = lnk;
- }
- } else if (flags & LINK_UNKNOWN_DEST_PORT) {
- if (lnk->dst_addr.s_addr == dst_addr.s_addr) {
- if (lnk_unknown_dst_port == NULL)
- lnk_unknown_dst_port = lnk;
+ if (flags == LINK_UNKNOWN_DEST_ADDR &&
+ lnk->dst_port == dst_port &&
+ lnk_unknown_dst_addr == NULL)
+ lnk_unknown_dst_addr = lnk;
+ if (flags == LINK_UNKNOWN_DEST_PORT &&
+ lnk->dst_addr.s_addr == dst_addr.s_addr) {
+ lnk_unknown_dst_port = lnk;
+ break;
}
}
}
+
+ start_point = StartPartialIn(alias_port, link_type);
+ LIST_FOREACH(lnk, &la->linkPartialIn[start_point], list_in) {
+ int flags = (flags_in | lnk->flags) & LINK_PARTIALLY_SPECIFIED;
+
+ INGUARD;
+ if (flags == LINK_PARTIALLY_SPECIFIED &&
+ lnk_unknown_all == NULL)
+ lnk_unknown_all = lnk;
+ if (flags == LINK_UNKNOWN_DEST_ADDR &&
+ lnk->dst_port == dst_port &&
+ lnk_unknown_dst_addr == NULL)
+ lnk_unknown_dst_addr = lnk;
+ if (flags == LINK_UNKNOWN_DEST_PORT &&
+ lnk->dst_addr.s_addr == dst_addr.s_addr) {
+ lnk_unknown_dst_port = lnk;
+ break;
+ }
+ }
#undef INGUARD
if (lnk_unknown_dst_port != NULL)
@@ -1612,12 +1638,10 @@
struct in_addr alias_addr,
u_int16_t dst_call_id)
{
- u_int i;
struct alias_link *lnk;
LIBALIAS_LOCK_ASSERT(la);
- i = StartPointIn(alias_addr, 0, LINK_PPTP);
- LIST_FOREACH(lnk, &la->linkTableIn[i], list_in)
+ LIST_FOREACH(lnk, &la->linkPartialIn[0], list_in)
if (lnk->link_type == LINK_PPTP &&
lnk->dst_addr.s_addr == dst_addr.s_addr &&
lnk->alias_addr.s_addr == alias_addr.s_addr &&
@@ -2447,6 +2471,8 @@
LIST_INIT(&la->linkTableOut[i]);
for (i = 0; i < LINK_TABLE_IN_SIZE; i++)
LIST_INIT(&la->linkTableIn[i]);
+ for (i = 0; i < LINK_PARTIAL_SIZE; i++)
+ LIST_INIT(&la->linkPartialIn[i]);
TAILQ_INIT(&la->checkExpire);
#ifdef _KERNEL
AliasSctpInit(la);
diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h
--- a/sys/netinet/libalias/alias_local.h
+++ b/sys/netinet/libalias/alias_local.h
@@ -68,6 +68,7 @@
/* Sizes of input and output link tables */
#define LINK_TABLE_OUT_SIZE 4001
#define LINK_TABLE_IN_SIZE 4001
+#define LINK_PARTIAL_SIZE 401
#define GET_ALIAS_PORT -1
#define GET_ALIAS_ID GET_ALIAS_PORT
@@ -94,6 +95,7 @@
* output lookup tables. */
LIST_HEAD (, alias_link) linkTableOut[LINK_TABLE_OUT_SIZE];
LIST_HEAD (, alias_link) linkTableIn[LINK_TABLE_IN_SIZE];
+ LIST_HEAD (, alias_link) linkPartialIn[LINK_PARTIAL_SIZE];
/* HouseKeeping */
TAILQ_HEAD (, alias_link) checkExpire;
/* Link statistics */

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 6:11 PM (9 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15744907
Default Alt Text
D30570.diff (4 KB)

Event Timeline