fatal_error "Duplicate INTERFACE ($device)" if $tcdevices{$device};
449
451
fatal_error "Invalid INTERFACE name ($device)" if $device =~ /[:+]/;
463
465
}
464
466
}
465
467
466
$bandwidth = rate_to_kbit( $bandwidth );
468
$in_bandwidth = rate_to_kbit( $in_bandwidth );
467
469
468
470
emit "if interface_is_up $physical; then";
469
471
471
473
472
474
emit ( "${dev}_exists=Yes",
473
475
"qt \$TC qdisc del dev $physical root",
474
"qt \$TC qdisc del dev $physical ingress\n"
476
"qt \$TC qdisc del dev $physical ingress\n"
475
477
);
476
478
477
479
emit ( "run_tc qdisc add dev $physical handle ffff: ingress",
478
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${bandwidth}kbit burst 10k drop flowid :1\n"
479
) if $bandwidth;
480
480
"run_tc filter add dev $physical parent ffff: protocol all prio 10 u32 match ip src 0.0.0.0/0 police rate ${in_bandwidth}kbit burst 10k drop flowid :1\n"