Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On MAC OSX dnctl plr applied to interface but disregards target-addr and target-proto filters #82

Open
jonmadsen opened this issue Jun 12, 2023 · 0 comments

Comments

@jonmadsen
Copy link

I am not familiar with the internals of dnctl and how it configures the packet loss rate, but what I am finding is that if I set the packet loss rate the target-addr (src-ip, dst-ip) portion of the filter is ignored. For example if I set the plr to 100%, I cannot ping the localhost. See the following snippet:

➜ ~ ping 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.089 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.096 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.108 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.115 ms ^C --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.089/0.102/0.115/0.010 ms ➜ ~ sudo ./go/bin/comcast --device=utun0 --latency=250 --target-bw=100 --packet-loss=100% --target-addr=10.169.99.196 --target-proto=tcp,udp,icmp sudo pfctl -E (cat /etc/pf.conf && echo "dummynet-anchor \"mop\"" && echo "anchor \"mop\"") | sudo pfctl -f - echo $'dummynet in all pipe 1' | sudo pfctl -a mop -f - sudo dnctl pipe 1 config delay 250ms bw 100Kbit/s plr 1.0000 mask src-ip 10.169.99.196 proto tcp sudo dnctl pipe 1 config delay 250ms bw 100Kbit/s plr 1.0000 mask src-ip 10.169.99.196 proto udp sudo dnctl pipe 1 config delay 250ms bw 100Kbit/s plr 1.0000 mask src-ip 10.169.99.196 proto icmp sudo dnctl pipe 1 config delay 250ms bw 100Kbit/s plr 1.0000 mask dst-ip 10.169.99.196 proto tcp sudo dnctl pipe 1 config delay 250ms bw 100Kbit/s plr 1.0000 mask dst-ip 10.169.99.196 proto udp sudo dnctl pipe 1 config delay 250ms bw 100Kbit/s plr 1.0000 mask dst-ip 10.169.99.196 proto icmp Packet rules setup... Run sudo pfctl -sa | grep -i enabledto double check Run./go/bin/comcast --stop` to reset
➜ ~ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
^C
--- 127.0.0.1 ping statistics ---
6 packets transmitted, 0 packets received, 100.0% packet loss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant