mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 16:57:08 +00:00
fix: replace netfilter reset tcp option timestamp with nfqueue way
This commit is contained in:
parent
43d95183d9
commit
82c9d7ebc8
@ -87,12 +87,7 @@ func (s *Server) IptSetTTL(ipt *iptables.IPTables) error {
|
||||
}
|
||||
|
||||
func (s *Server) IptDelTCPTS(ipt *iptables.IPTables) error {
|
||||
err := ipt.Append(table, chain, RuleRstTimestamp...)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
err = ipt.Append(table, chain, RuleDelTCPTS...)
|
||||
err := ipt.Append(table, chain, RuleDelTCPTS...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -83,15 +83,6 @@ func (s *Server) NftDelTCPTS(tx *knftables.Transaction, table *knftables.Table)
|
||||
}
|
||||
tx.Add(chain)
|
||||
var rule *knftables.Rule
|
||||
if resetOptionAvailable() {
|
||||
rule = &knftables.Rule{
|
||||
Chain: chain.Name,
|
||||
Rule: knftables.Concat(
|
||||
"tcp option timestamp exists",
|
||||
"counter reset tcp option timestamp",
|
||||
),
|
||||
}
|
||||
} else {
|
||||
rule = &knftables.Rule{
|
||||
Chain: chain.Name,
|
||||
Rule: knftables.Concat(
|
||||
@ -99,7 +90,6 @@ func (s *Server) NftDelTCPTS(tx *knftables.Transaction, table *knftables.Table)
|
||||
fmt.Sprintf("counter queue num %d bypass", s.nfqServer.QueueNum),
|
||||
),
|
||||
}
|
||||
}
|
||||
tx.Add(rule)
|
||||
}
|
||||
|
||||
@ -122,7 +112,8 @@ func (s *Server) NftSetIP(tx *knftables.Transaction, table *knftables.Table) {
|
||||
tx.Add(rule)
|
||||
}
|
||||
|
||||
func resetOptionAvailable() bool {
|
||||
// unused currently
|
||||
func ResetOptionAvailable() bool {
|
||||
const TestName = "UA3F_TEST_RESET"
|
||||
table := &knftables.Table{
|
||||
Name: TestName,
|
||||
@ -130,7 +121,7 @@ func resetOptionAvailable() bool {
|
||||
}
|
||||
nft, err := knftables.New(table.Family, table.Name)
|
||||
if err != nil {
|
||||
slog.Error("resetOptionAvailable knftables.New", slog.Any("error", err))
|
||||
slog.Error("ResetOptionAvailable knftables.New", slog.Any("error", err))
|
||||
return false
|
||||
}
|
||||
tx := nft.NewTransaction()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user