LINUX.ORG.RU

История изменений

Исправление post-factum, (текущая версия) :

@vel @mky

Похоже, что вот так фурычит:

tc filter add dev ${LAN} parent ffff: protocol ip flower src_ip 192.168.1.55 ip_proto udp dst_port 123 action pedit munge offset 24 u16 set 0x38 pipe csum ip and udp

Если допустить, что опций IP нет, то длина UDP будет по offset’у 24.

Что думаете? Случайно заработало, или я правильно высчитал?

# tc -s filter ls dev enp3s2 ingress
filter parent ffff: protocol ip pref 49152 flower chain 0
filter parent ffff: protocol ip pref 49152 flower chain 0 handle 0x1
  eth_type ipv4
  ip_proto udp
  src_ip 192.168.1.55
  dst_port 123
  not_in_hw
        action order 1:  pedit action pipe keys 1
         index 1 ref 1 bind 1 installed 252 sec used 15 sec firstused 252 sec
         key #0  at 24: val 00380000 mask 0000ffff
        Action statistics:
        Sent 480 bytes 5 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

        action order 2: csum (iph, udp) action pass
        index 1 ref 1 bind 1 installed 252 sec used 15 sec firstused 252 sec
        Action statistics:
        Sent 480 bytes 5 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

Исходная версия post-factum, :

@vel @mky

Похоже, что вот так фурычит:

tc filter add dev ${LAN} parent ffff: protocol ip flower src_ip 192.168.1.55 ip_proto udp dst_port 123 action pedit munge offset 24 u16 set 0x38 pipe csum ip and udp

Если допустить, что опций IP нет, то длина UDP будет по offset’у 24.

Что думаете? Случайно заработало, или я правильно высчитал?