問題描述
tcng ‑ 匹配“if”語句中的端口範圍 (tcng ‑ match port range in "if" statement)
Hi I need to match a specified port range (say from 16384 to 32768) with tcng in order to give traffic outgoing from this ports an higher priority.
Example file:
#include "fields.tc"
dev "eth0" {
egress {
class(<$voip>) if ip_proto == IPPROTO_UDP && udp_sport == ...;
class(<$other>) if 1;
prio {
$voip = class(1) {
fifo();
}
$other = class(2) {
fifo();
}
}
}
}
What should I do? Thanks in advance.
‑‑‑‑‑
參考解法
方法 1:
looks like a simple "udp_sport >= 16384 && udp_sport <= 32768" works. at least in tcng version 10b. so write it like this:
#include "fields.tc"
dev "eth0" {
egress {
class(<$voip>) if ip_proto == IPPROTO_UDP && udp_sport >= 16384 && udp_sport <= 32768;
class(<$other>) if 1;
prio {
$voip = class(1) {
fifo();
}
$other = class(2) {
fifo();
}
}
}
}