mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 16:57:08 +00:00
feat: ignore zero ipid packet
This commit is contained in:
parent
420311ca0c
commit
9de776f21b
@ -32,7 +32,7 @@ func (s *Server) nftSetup() error {
|
|||||||
s.NftHookTCPSyn(tx, s.Nftable)
|
s.NftHookTCPSyn(tx, s.Nftable)
|
||||||
}
|
}
|
||||||
if s.cfg.SetIPID {
|
if s.cfg.SetIPID {
|
||||||
s.NftSetIP(tx, s.Nftable)
|
s.NftHookIP(tx, s.Nftable)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := nft.Run(context.TODO(), tx); err != nil {
|
if err := nft.Run(context.TODO(), tx); err != nil {
|
||||||
@ -135,7 +135,7 @@ func (s *Server) NftHookTCPSyn(tx *knftables.Transaction, table *knftables.Table
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) NftSetIP(tx *knftables.Transaction, table *knftables.Table) {
|
func (s *Server) NftHookIP(tx *knftables.Transaction, table *knftables.Table) {
|
||||||
chain := &knftables.Chain{
|
chain := &knftables.Chain{
|
||||||
Name: "HELPER_QUEUE",
|
Name: "HELPER_QUEUE",
|
||||||
Table: table.Name,
|
Table: table.Name,
|
||||||
@ -143,15 +143,25 @@ func (s *Server) NftSetIP(tx *knftables.Transaction, table *knftables.Table) {
|
|||||||
Hook: knftables.PtrTo(knftables.PostroutingHook),
|
Hook: knftables.PtrTo(knftables.PostroutingHook),
|
||||||
Priority: knftables.PtrTo(knftables.ManglePriority),
|
Priority: knftables.PtrTo(knftables.ManglePriority),
|
||||||
}
|
}
|
||||||
rule := &knftables.Rule{
|
tx.Add(chain)
|
||||||
|
|
||||||
|
if s.cfg.SetTCPInitialWindow || s.cfg.DelTCPTimestamp {
|
||||||
|
tx.Add(&knftables.Rule{
|
||||||
|
Chain: chain.Name,
|
||||||
|
Rule: knftables.Concat(
|
||||||
|
"tcp flags syn",
|
||||||
|
fmt.Sprintf("counter queue num %d bypass", s.nfqServer.QueueNum),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
tx.Add(&knftables.Rule{
|
||||||
Chain: chain.Name,
|
Chain: chain.Name,
|
||||||
Rule: knftables.Concat(
|
Rule: knftables.Concat(
|
||||||
|
"ip id != 0",
|
||||||
"meta l4proto tcp",
|
"meta l4proto tcp",
|
||||||
fmt.Sprintf("counter queue num %d bypass", s.nfqServer.QueueNum),
|
fmt.Sprintf("counter queue num %d bypass", s.nfqServer.QueueNum),
|
||||||
),
|
),
|
||||||
}
|
})
|
||||||
tx.Add(chain)
|
|
||||||
tx.Add(rule)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// unused currently
|
// unused currently
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user