summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/Network/slirp/libalias
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Devices/Network/slirp/libalias')
-rw-r--r--src/VBox/Devices/Network/slirp/libalias/alias_dns.c2
-rw-r--r--src/VBox/Devices/Network/slirp/libalias/alias_mod.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/src/VBox/Devices/Network/slirp/libalias/alias_dns.c b/src/VBox/Devices/Network/slirp/libalias/alias_dns.c
index d255457a..d451d9c1 100644
--- a/src/VBox/Devices/Network/slirp/libalias/alias_dns.c
+++ b/src/VBox/Devices/Network/slirp/libalias/alias_dns.c
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Devices/Network/slirp/libalias/alias_mod.c b/src/VBox/Devices/Network/slirp/libalias/alias_mod.c
index 2c4fda33..4da99393 100644
--- a/src/VBox/Devices/Network/slirp/libalias/alias_mod.c
+++ b/src/VBox/Devices/Network/slirp/libalias/alias_mod.c
@@ -141,7 +141,7 @@ _attach_handler(PNATState pData, struct proto_handler *p)
_attach_handler(struct proto_handler *p)
#endif
{
- struct proto_handler *b = NULL;
+ struct proto_handler *b = NULL, *handler_chain_tail = NULL;
LIBALIAS_WLOCK_ASSERT();
LIST_FOREACH(b, &handler_chain, entries) {
@@ -153,10 +153,14 @@ _attach_handler(struct proto_handler *p)
LIST_INSERT_BEFORE(b, p, entries);
return (0);
}
+
+ /* If the conditions above do not work, we should keep the last
+ * element of the list in order to insert *p right after it. */
+ handler_chain_tail = b;
}
/* End of list or found right position, inserts here. */
- if (b)
- LIST_INSERT_AFTER(b, p, entries);
+ if (handler_chain_tail)
+ LIST_INSERT_AFTER(handler_chain_tail, p, entries);
else
LIST_INSERT_HEAD(&handler_chain, p, entries);
return (0);