tc: use rel path for tc

This commit is contained in:
Tim Niemeyer 2018-04-02 18:32:04 +02:00
parent 833be39f73
commit fd74179fbb
1 changed files with 5 additions and 5 deletions

10
tc.c
View File

@ -31,7 +31,7 @@ extern const char *g_interface;
void tc_add_qdisc_ingress()
{
char cmd[2048];
snprintf(cmd, 2048, "/sbin/tc qdisc add dev %s ingress", g_interface);
snprintf(cmd, 2048, "tc qdisc add dev %s ingress", g_interface);
log_debug("CMD: %s\n", cmd);
system(cmd);
}
@ -39,7 +39,7 @@ void tc_add_qdisc_ingress()
void tc_del_qdisc_ingress()
{
char cmd[2048];
snprintf(cmd, 2048, "/sbin/tc qdisc del dev %s ingress", g_interface);
snprintf(cmd, 2048, "tc qdisc del dev %s ingress", g_interface);
log_debug("CMD: %s\n", cmd);
system(cmd);
}
@ -47,7 +47,7 @@ void tc_del_qdisc_ingress()
void tc_block_all()
{
char cmd[2048];
snprintf(cmd, 2048, "/sbin/tc filter add dev %s protocol all parent ffff: prio 65535 basic match \"u32(u16 0x4305 0xffff at -2)\" flowid :1 action drop", g_interface);
snprintf(cmd, 2048, "tc filter add dev %s protocol all parent ffff: prio 65535 basic match \"u32(u16 0x4305 0xffff at -2)\" flowid :1 action drop", g_interface);
log_debug("CMD: %s\n", cmd);
system(cmd);
}
@ -55,7 +55,7 @@ void tc_block_all()
void tc_allow_mac(const uint8_t mac[])
{
char cmd[2048];
snprintf(cmd, 2048, "/sbin/tc filter add dev %s protocol all parent ffff: prio 99 "
snprintf(cmd, 2048, "tc filter add dev %s protocol all parent ffff: prio 99 "
"basic match \"u32(u32 0x%2x%2x%2x%2x 0xffffffff at -8)\" "
"and \"u32(u16 0x%2x%2x 0xffff at -4)\" flowid :1 action pass",
g_interface, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
@ -66,7 +66,7 @@ void tc_allow_mac(const uint8_t mac[])
void tc_disallow_mac(const uint8_t mac[])
{
char cmd[2048];
snprintf(cmd, 2048, "/sbin/tc filter delete dev %s protocol all parent ffff: prio 99 "
snprintf(cmd, 2048, "tc filter delete dev %s protocol all parent ffff: prio 99 "
"basic match \"u32(u32 0x%2x%2x%2x%2x 0xffffffff at -8)\" "
"and \"u32(u16 0x%2x%2x 0xffff at -4)\" flowid :1 action pass",
g_interface, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);