Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165138654
D58597.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D58597.diff
View Options
diff --git a/lib/libifconfig/libifconfig.c b/lib/libifconfig/libifconfig.c
--- a/lib/libifconfig/libifconfig.c
+++ b/lib/libifconfig/libifconfig.c
@@ -81,7 +81,7 @@
if (h == NULL) {
return (NULL);
}
- for (int i = 0; i <= AF_MAX; i++) {
+ for (int i = 0; i < AF_MAX; i++) {
h->sockets[i] = -1;
}
@@ -92,7 +92,7 @@
ifconfig_close(ifconfig_handle_t *h)
{
- for (int i = 0; i <= AF_MAX; i++) {
+ for (int i = 0; i < AF_MAX; i++) {
if (h->sockets[i] != -1) {
(void)close(h->sockets[i]);
}
diff --git a/lib/libifconfig/libifconfig_internal.c b/lib/libifconfig/libifconfig_internal.c
--- a/lib/libifconfig/libifconfig_internal.c
+++ b/lib/libifconfig/libifconfig_internal.c
@@ -78,7 +78,7 @@
ifconfig_socket(ifconfig_handle_t *h, const int addressfamily, int *s)
{
- if (addressfamily > AF_MAX) {
+ if (addressfamily >= AF_MAX) {
h->error.errtype = SOCKET;
h->error.errcode = EINVAL;
return (-1);
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -146,7 +146,7 @@
saddr = (struct sockaddr *) (np + 1);
if ((error = copyin(argp->ex_addr, saddr, argp->ex_addrlen)))
goto out;
- if (saddr->sa_family == AF_UNSPEC || saddr->sa_family > AF_MAX) {
+ if (saddr->sa_family == AF_UNSPEC || saddr->sa_family >= AF_MAX) {
error = EINVAL;
vfs_mount_error(mp, "Invalid saddr->sa_family: %d");
goto out;
diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c
--- a/sys/net/route/nhop_ctl.c
+++ b/sys/net/route/nhop_ctl.c
@@ -1339,7 +1339,7 @@
struct nhop_iter iter = { .fibnum = ifp->if_fib, .wlock = true };
bool nhops_changed;
- for (iter.family = 1; iter.family <= AF_MAX; iter.family++) {
+ for (iter.family = 1; iter.family < AF_MAX; iter.family++) {
/*
* By tracking nhop changes, we avoid redundant nhgrp
* recompilation triggered by multiple events.
diff --git a/sys/net/route/route_ddb.c b/sys/net/route/route_ddb.c
--- a/sys/net/route/route_ddb.c
+++ b/sys/net/route/route_ddb.c
@@ -174,7 +174,7 @@
i = lim = addr;
else {
i = 1;
- lim = AF_MAX;
+ lim = AF_MAX - 1;
}
for (; i <= lim; i++) {
diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c
--- a/sys/net/route/route_helpers.c
+++ b/sys/net/route/route_helpers.c
@@ -183,7 +183,7 @@
continue;
}
- for (int i = 1; i <= AF_MAX; i++)
+ for (int i = 1; i < AF_MAX; i++)
rib_walk_ext(fibnum, i, wlock, wa_f, hook_f, arg);
}
}
@@ -205,7 +205,7 @@
continue;
}
- for (int i = 1; i <= AF_MAX; i++)
+ for (int i = 1; i < AF_MAX; i++)
rib_walk_del(fibnum, i, filter_f, arg, 0);
}
}
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -2623,7 +2623,7 @@
} else if (namelen != 3)
return ((namelen < 3) ? EISDIR : ENOTDIR);
af = name[0];
- if (af > AF_MAX)
+ if (af >= AF_MAX)
return (EINVAL);
bzero(&w, sizeof(w));
w.w_op = name[1];
@@ -2647,7 +2647,7 @@
case NET_RT_FLAGS:
if (af == 0) { /* dump all tables */
i = 1;
- lim = AF_MAX;
+ lim = AF_MAX - 1;
} else /* dump only one table */
i = lim = af;
diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c
--- a/sys/netlink/route/rt.c
+++ b/sys/netlink/route/rt.c
@@ -1053,7 +1053,7 @@
}
old_linux_compat(&attrs);
- if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) {
+ if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family >= AF_MAX) {
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
return (EINVAL);
}
@@ -1120,7 +1120,7 @@
}
old_linux_compat(&attrs);
- if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) {
+ if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family >= AF_MAX) {
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
return (EINVAL);
}
@@ -1144,7 +1144,7 @@
return (error);
old_linux_compat(&attrs);
- if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) {
+ if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family >= AF_MAX) {
NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
return (EINVAL);
}
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -272,7 +272,9 @@
#define AF_HYPERV 43 /* HyperV sockets */
#define AF_DIVERT 44 /* divert(4) */
#define AF_IPFWLOG 46
-#define AF_MAX 46
+
+#define AF_MAX 47
+
/*
* When allocating a new AF_ constant, please only allocate
* even numbered constants for FreeBSD until 134 as odd numbered AF_
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 7, 8:46 AM (5 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36157374
Default Alt Text
D58597.diff (4 KB)
Attached To
Mode
D58597: sys/socket.h: Fix AF_MAX
Attached
Detach File
Event Timeline
Log In to Comment