Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167856817
D35144.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
798 B
Referenced Files
None
Subscribers
None
D35144.diff
View Options
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -341,11 +341,15 @@
free(formatstr);
}
+/* Skip sorting for interfaces with more IP addresses than this limit */
+#define IFADDR_SORT_LIMIT 32
+
static struct ifaddrs *
sortifaddrs(struct ifaddrs *list,
int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *),
struct ifa_queue *q)
{
+ int count;
struct ifaddrs *right, *temp, *last, *result, *next, *tail;
right = list;
@@ -358,7 +362,10 @@
if (!list || !list->ifa_next)
return (list);
+ count = 0;
while (temp && temp->ifa_next) {
+ if (count++ >= IFADDR_SORT_LIMIT)
+ return (list);
last = right;
right = right->ifa_next;
temp = temp->ifa_next->ifa_next;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 1:12 AM (19 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37260258
Default Alt Text
D35144.diff (798 B)
Attached To
Mode
D35144: [ifconfig] Prevent extensive cycles spent on sorting IP adresses
Attached
Detach File
Event Timeline
Log In to Comment