Skip to content

Commit 72472e5

Browse files
committed
carp: retire ioctl(2) API
All supported stable branches use netlink(4) API to configure carp(4). The deleted code also has kernel stack leak vulnerability, that requires extra effort to fix. Reviewed by: pouria, kp Differential Revision: https://reviews.freebsd.org/D55804
1 parent 7e68af7 commit 72472e5

File tree

6 files changed

+133
-352
lines changed

6 files changed

+133
-352
lines changed

sbin/ifconfig/carp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,13 @@ setcarp_callback(if_ctx *ctx, void *arg __unused)
156156
if (carpr_vrrp_adv_inter != 0)
157157
carpr.carpr_vrrp_adv_inter = carpr_vrrp_adv_inter;
158158

159-
if (ifconfig_carp_set_info(lifh, ctx->ifname, &carpr))
160-
err(1, "SIOCSVH");
159+
if (ifconfig_carp_set_info(lifh, ctx->ifname, &carpr)) {
160+
if (ifconfig_err_errtype(lifh) == OTHER)
161+
err(1, "%s: %s", __func__,
162+
strerror(ifconfig_err_errno(lifh)));
163+
else
164+
err(1, "%s: %d", __func__, ifconfig_err_errtype(lifh));
165+
}
161166
}
162167

163168
static void

share/man/man4/carp.4

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525
.\" SUCH DAMAGE.
2626
.\"
27-
.Dd April 12, 2024
27+
.Dd March 11, 2026
2828
.Dt CARP 4
2929
.Os
3030
.Sh NAME
@@ -71,10 +71,7 @@ and
7171
.Cm advskew
7272
are put inside CARP advertisements.
7373
These values can be configured using
74-
.Xr ifconfig 8 ,
75-
or through the
76-
.Dv SIOCSVH
77-
.Xr ioctl 2 .
74+
.Xr ifconfig 8 .
7875
.Pp
7976
CARP defaults to using multicast messages, but can be configured to unicast
8077
announcements to peers using the
@@ -88,10 +85,7 @@ and
8885
Note that TTL verification is disabled if the peer address is not a multicast
8986
address.
9087
These values can be configured using
91-
.Xr ifconfig 8 ,
92-
or through the
93-
.Dv SIOCSPEER
94-
.Xr ioctl 2 .
88+
.Xr ifconfig 8 .
9589
.Pp
9690
.Xr carp 4
9791
can be configured to use either the non-standard CARP protocol, or VRRPv3 (RFC 5798).

sys/net/if.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ int (*carp_master_p)(struct ifaddr *);
248248
int (*carp_forus_p)(struct ifnet *ifp, u_char *dhost);
249249
int (*carp_output_p)(struct ifnet *ifp, struct mbuf *m,
250250
const struct sockaddr *sa);
251-
int (*carp_ioctl_p)(struct ifreq *, u_long, struct thread *);
252251
int (*carp_attach_p)(struct ifaddr *, int);
253252
void (*carp_detach_p)(struct ifaddr *, bool);
254253
#endif
@@ -2923,15 +2922,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td)
29232922
error = if_getgroupmembers(req);
29242923
goto out_noref;
29252924
}
2926-
#if defined(INET) || defined(INET6)
2927-
case SIOCSVH:
2928-
case SIOCGVH:
2929-
if (carp_ioctl_p == NULL)
2930-
error = EPROTONOSUPPORT;
2931-
else
2932-
error = (*carp_ioctl_p)(ifr, cmd, td);
2933-
goto out_noref;
2934-
#endif
29352925
}
29362926

29372927
ifp = ifunit_ref(ifr->ifr_name);

0 commit comments

Comments
 (0)