aboutsummaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2021-01-23 09:37:22 +0000
committerKristof Provost <kp@FreeBSD.org>2021-01-25 18:58:22 +0000
commitdcd1e41f0cbcb8f7ec5f7a891a690be959bc1ea8 (patch)
tree298af2eabbf09d1a0edf7f3e430281169da8a8a0 /sbin/pfctl
parent27b2aa49385dc39959f772b76abec1601d4b9ab2 (diff)
downloadsrc-dcd1e41f0cbcb8f7ec5f7a891a690be959bc1ea8.tar.gz
src-dcd1e41f0cbcb8f7ec5f7a891a690be959bc1ea8.zip
pfctl: FreeBSD now supports DIOCGIFSPEED
There's no need for a special case here to work around the lack of DIOCGIFSPEED. That was introduced in FreeBSD in c1aedfcbd9896401f637bc815ba4e51dca107f6f. Reported by: jmg@ Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28305
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/pfctl_altq.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index f23fe057f703..6541c031c75e 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -98,11 +98,7 @@ static int gsc_add_seg(struct gen_sc *, double, double, double,
double);
static double sc_x2y(struct service_curve *, double);
-#ifdef __FreeBSD__
-u_int64_t getifspeed(int, char *);
-#else
u_int32_t getifspeed(char *);
-#endif
u_long getifmtu(char *);
int eval_queue_opts(struct pf_altq *, struct node_queue_opt *,
u_int64_t);
@@ -317,11 +313,7 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa, struct node_queue_bw *bw,
if (bw->bw_absolute > 0)
pa->ifbandwidth = bw->bw_absolute;
else
-#ifdef __FreeBSD__
- if ((rate = getifspeed(pf->dev, pa->ifname)) == 0) {
-#else
if ((rate = getifspeed(pa->ifname)) == 0) {
-#endif
fprintf(stderr, "interface %s does not know its bandwidth, "
"please specify an absolute bandwidth\n",
pa->ifname);
@@ -1254,26 +1246,6 @@ rate2str(double rate)
return (buf);
}
-#ifdef __FreeBSD__
-/*
- * XXX
- * FreeBSD does not have SIOCGIFDATA.
- * To emulate this, DIOCGIFSPEED ioctl added to pf.
- */
-u_int64_t
-getifspeed(int pfdev, char *ifname)
-{
- struct pf_ifspeed io;
-
- bzero(&io, sizeof io);
- if (strlcpy(io.ifname, ifname, IFNAMSIZ) >=
- sizeof(io.ifname))
- errx(1, "getifspeed: strlcpy");
- if (ioctl(pfdev, DIOCGIFSPEED, &io) == -1)
- err(1, "DIOCGIFSPEED");
- return (io.baudrate);
-}
-#else
u_int32_t
getifspeed(char *ifname)
{
@@ -1291,7 +1263,6 @@ getifspeed(char *ifname)
err(1, "SIOCGIFDATA");
return ((u_int32_t)ifrdat.ifi_baudrate);
}
-#endif
u_long
getifmtu(char *ifname)