diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -244,6 +244,9 @@ pflog_logfile="/var/log/pflog" # where pflogd should store the logfile pflog_program="/sbin/pflogd" # where the pflogd program lives pflog_flags="" # additional flags for pflogd +dnctl_enable="NO" +dnctl_program="/sbin/dnctl" +dnctl_rules="/etc/dnctl.conf" ftpproxy_enable="NO" # Set to YES to enable ftp-proxy(8) for pf ftpproxy_flags="" # additional flags for ftp-proxy(8) pfsync_enable="NO" # Expose pf state to other hosts for syncing diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -216,7 +216,8 @@ .endif .if ${MK_IPFW} != "no" -CONFS+= ipfw +CONFS+= ipfw \ + dnctl .if ${MK_NETGRAPH} != "no" CONFS+= ipfw_netflow .endif diff --git a/libexec/rc/rc.d/dnctl b/libexec/rc/rc.d/dnctl new file mode 100755 --- /dev/null +++ b/libexec/rc/rc.d/dnctl @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: dnctl +# BEFORE: pf ipfw +# KEYWORD: nojailvnet + +. /etc/rc.subr + +name="dnctl" +desc="Dummynet packet queuing and scheduling" +rcvar="${name}_enable" +load_rc_config $name +start_cmd="${name}_start" +required_files="$dnctl_rules" +required_modules="dummynet" + +dnctl_start() +{ + startmsg -n "Enabling ${name}" + $dnctl_program "$dnctl_rules" + startmsg '.' +} + +run_rc_command $* diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c --- a/sbin/ipfw/main.c +++ b/sbin/ipfw/main.c @@ -682,7 +682,13 @@ } #endif - if (strcmp(av[0], "dnctl") == 0) + const char *dnctl_binary = "dnctl"; + const size_t binary_size = strlen(dnctl_binary); + const size_t my_size = strlen(av[0]); + if (strcmp(av[0], dnctl_binary) == 0 || \ + (my_size > binary_size && \ + av[0][my_size - binary_size - 1] == '/' && \ + strcmp(av[0] + my_size - binary_size, dnctl_binary))) g_co.prog = cmdline_prog_dnctl; else g_co.prog = cmdline_prog_ipfw;