wcarhart wcarhart - 4 months ago 20
Android Question

Simulating poor network connections in Busybox

I am writing a script to simulate poor network connections for an Android device using Busybox. In Bash, I am using

tc
and
netem
to simulate packet loss, specific latencies, etc., but these are not available in Busybox. I know that Busybox has
iptables
available, but it does not offer as much functionality as
netem
. I have a few questions:


  1. How do you suggest simulating poor network connections in Busybox? I have done quite a bit of research and haven't found anyone who has tried testing slow connections to a device with Busybox.

  2. Is there a way to compile
    netem
    for Busybox, and could you point me in the right direction to get started with that if it is possible?

  3. Is there a way to simulate specific latencies, packet loss, corruption, and duplication with
    iptables
    , as is possible with
    netem
    ?



Thanks.

Answer

You can find tc (as well as other network utilities) in busybox/networking.

Check https://github.com/mozilla-b2g/busybox/blob/master/networking/tc.c

It's not clear form your question if you are doing it on an android device or on another device. In any case, you may have to recompile busybox for your target if tc is not enabled.

Comments