Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netifd: iprule add sport #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

netifd: iprule add sport #41

wants to merge 1 commit into from

Conversation

egc112
Copy link

@egc112 egc112 commented Dec 4, 2024

I was missing the ip rule for sport 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. But if you decide to implement it, it needs careful review as I might have overlooked something and/or there might be a better/more efficient way to implement this.

Compile tested on DL-WRX36 (ipq8074) running Main Snapshot

Example 1:

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 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

Signed-off-by: Erik Conijn [email protected]

I was missing the ip rule for `sport` 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`.
But if you decide to implement it, it needs careful review as I might have overlooked something and/or there might be a better/more efficient way to implement this.

Compile tested on DL-WRX36 (ipq8074) running Main Snapshot

Example 1:
```
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  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
```

Signed-off-by: Erik Conijn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant