netifd: iprule add sport and dport
Maintainer: @nbd, @robimarko
I was missing the ip rules for `sport` and `dport` in netifd and although I have a working C knowledge, I have little netlink knowledge and it is the first time I looked into netifd but after some research I could come up with a working patch to implement `option sport` and `option dport`.
I hope you can have a look and implement these useful options.
Run tested: Dynalink DL-WRX36 (ipq8074) running Main Snapshot r29276-
963d320086 20-apr-2025
Example 1 sport:
```
config rule
option src '192.168.9.23/32'
option sport '1194'
option lookup 'main'
```
Result:
```
root@DL-WRX36:~# ip ru
0: from all lookup local
1: from 192.168.9.23 sport 1194 lookup main
```
Example 2 sport range:
```
config rule
option src '192.168.9.23/32'
option sport '1194-1195'
option lookup 'main'
```
Result:
```
root@DL-WRX36:~# ip ru
0: from all lookup local
1: from 192.168.9.23 sport 1194-1195 lookup main
```
Example 3 dport:
```
config rule
option src '192.168.9.23/32'
option dport '1294'
option lookup 'main'
```
Result:
```
root@DL-WRX36:~# ip ru
0: from all lookup local
1: from 192.168.9.23 dport 1294 lookup main
```
Example 4 dport range:
```
config rule
option src '192.168.9.23/32'
option dport '1294-1295'
option lookup 'main'
```
Result:
```
root@DL-WRX36:~# ip ru
0: from all lookup local
1: from 192.168.9.23 dport 1294-1295 lookup main
```
Example 5 sport dport:
```
config rule
option src '192.168.9.23/32'
option sport '1194-1195'
option dport '1294-1295'
option lookup 'main'
```
Result:
```
root@DL-WRX36:~# ip ru
0: from all lookup local
1: from 192.168.9.23 sport 1194-1195 dport 1294-1295 lookup main
```
Signed-off-by: Erik Conijn <[email protected]>
Link: https://github.com/openwrt/netifd/pull/47
Signed-off-by: Robert Marko <[email protected]>