apernet / OpenGFW

OpenGFW is a flexible, easy-to-use, open source implementation of GFW (Great Firewall of China) on Linux
https://gfw.dev/
Mozilla Public License 2.0
9.72k stars 733 forks source link

feat: netlink queueNum/table config options #147

Closed kpetku closed 2 weeks ago

kpetku commented 2 months ago

OpenGFW currently hard codes the netlink table name and queue number which causes conflict errors such as could not bind to requested queue 100: netlink receive: operation not permitted when running multiple instances of the application on the same host using different rulesets.

This pull request exposes configuration options that allow the user to set a unique table name and queueNum if they want to run multiple instances, for example:

io:
  queueSize: 1024
  table: 'opengfw2' # use a unique table if you want to run multiple instances
  queueNum: 102 # use a unique queue if you want to run multiple instances
  local: true # set to false if you want to run OpenGFW on FORWARD chain

Setting a unique table name will help prevent one instance from removing another already running application's rules when it exits.