im = AF_MAX - 1; + lim = AF_MAX; } else /* dump only one table */ i = lim = af; diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 810ed219df27..fac174e01efd 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -960,7 +960,7 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp, /* pre-2.6.19 Linux API compatibility */ if (attrs.rtm_table > 0 && attrs.rta_table == 0) attrs.rta_table = attrs.rtm_table; - 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); } @@ -1023,7 +1023,7 @@ rtnl_handle_delroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (ESRCH); } - 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); } @@ -1046,7 +1046,7 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * if (error != 0) return (error); - 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 index ce6fe421d44b..b2afc735a383 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -271,9 +271,7 @@ struct accept_filter_arg { #define AF_INET6_SDP 42 /* OFED Socket Direct Protocol ipv6 */ #define AF_HYPERV 43 /* HyperV sockets */ #define AF_DIVERT 44 /* divert(4) */ - -#define AF_MAX 45 - +#define AF_MAX 44 /* * When allocating a new AF_ constant, please only allocate * even numbered constants for FreeBSD until 134 as odd numbered AF_