free5gc / go-upf

Apache License 2.0
21 stars 38 forks source link

Separate N3 and N9 interfaces do not work if listed separately #35

Open yoursunny opened 1 year ago

yoursunny commented 1 year ago

In my environment, the UPF is expected to use separate network interfaces for N3 and N9 interfaces. The example UPF config allows two methods to write the configuration:

If there are multiple connection, set addr to 0.0.0.0 or list all the addresses

In the first method, I can write as:

gtpu:
  forwarder: 'gtp5g'
  ifList:
    - addr: '0.0.0.0'
      type: 'N3'

In the second method, I can write as:

gtpu:
  forwarder: 'gtp5g'
  ifList:
    - addr: '172.25.194.6'
      type: 'N3'
    - addr: '172.25.196.6'
      type: 'N9'

As tested, only the first method works. This is caused by forwarder.NewDriver only listens on the first configured IP address, and ignores other addresses in ifList: https://github.com/free5gc/go-upf/blob/efae7532f8f9ed081065cdaa0589b0c76d11b204/internal/forwarder/driver.go#L53-L58

Suggested solution is updating the example config, asking user to take the first method only.