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

rule: add support for dport/sport #511

Merged
merged 1 commit into from
Feb 10, 2020

Conversation

chendotjs
Copy link
Contributor

This PR adds ability equivalent to ip rule add dport xxx-xxx sport xxx table main

@@ -40,3 +42,14 @@ func NewRule() *Rule {
Flow: -1,
}
}

// RulePortRange creates rule sport/dport range.
func NewRulePortRange(start, end uint16) *RulePortRange {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not making this a method of Rule structure ?

(r *Rule) AddPortRange(start, end uint16)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review @aboch
(r *Rule) AddPortRange(start, end uint16) may need another parameter to specify it's a Src or a Dst port range, which might add more complexity.
IMO, current fields of Rule structure is assigned by users manually, so NewRulePortRange is enough.

@aboch
Copy link
Collaborator

aboch commented Feb 9, 2020

@chendotjs pls rebase

@chendotjs
Copy link
Contributor Author

@aboch done

@aboch
Copy link
Collaborator

aboch commented Feb 10, 2020

LGTM

@aboch aboch merged commit a2e8781 into vishvananda:master Feb 10, 2020
MrHohn added a commit to MrHohn/netlink that referenced this pull request Aug 26, 2021
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
MrHohn added a commit to MrHohn/netlink that referenced this pull request Aug 26, 2021
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
MrHohn added a commit to MrHohn/netlink that referenced this pull request Sep 30, 2021
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
MrHohn added a commit to MrHohn/netlink that referenced this pull request Jan 12, 2022
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
glazychev-art pushed a commit to glazychev-art/netlink that referenced this pull request Jan 18, 2022
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
vishvananda pushed a commit that referenced this pull request Jan 18, 2022
This is similar to #511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
cyberys pushed a commit to cyberys/netlink that referenced this pull request Apr 5, 2022
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
cjmakes pushed a commit to cjmakes/netlink that referenced this pull request Jun 29, 2022
This is similar to vishvananda#511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
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.

2 participants