configctl service reload all breaks ipfw/traffic shaping #8196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm not sure if this is the right fix but I present it here for discussion at least anyway.
At the same time as I noticed the other problem with
configctl service reload all
(#8194) I noticed that it broke my traffic shaping rules. Basically it ends up stopping/startingipfw
in such a way thatpf
andipfw
are applied in the wrong order.To reproduce:
Note that now
ipfw
is applied beforepf
on inbound. The result of this is that inbound traffic is traffic shaped byipfw
before being de-NATed bypf
and therefore a rule which allows bandwidth based on LAN IP doesn't work. The opposite similarly applies for outbound. I've only shown the IPv6 rules above for brevity but the IPv4 rules are also affected.Note that
sudo /etc/rc.d/ipfw stop; sudo /etc/rc.d/ipfw start
will also trigger the problem, it's not unique toconfigctl
.My proposed fix adds a script called after
ipfw
is stopped, to remove the first load marker file, so that the nextipfw
start is treated as a first load, andpf
is toggled on/off to set the order. However we also need to enableipfw
explicitly at that point, otherwise it is still disabled,/etc/rc.d/ipfw
only sets the enable flag after executing our rules script.As I say... maybe there is a better way to do this but I had a bit of a think and couldn't find anything obvious. There are no user defined hooks called by the rc script after it sets the sysctls for example, so I think forcing the enable flag might be needed here.