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

Allowing optional addresses in mwan rules #674

Merged
merged 4 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions packages/ns-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6134,23 +6134,27 @@ Example response:

```json
{
"values": [
{
"label": "Default Rule",
"name": "ns_default_rule",
"policy": {
"label": "Default",
"name": "ns_default"
},
"protocol": "all",
"source_address": "1.1.1.1/30",
"destination_address": "10.0.0.1/20",
"sticky": false
}
]
"values": [
{
"label": "Default Rule",
"name": "ns_default_rule",
"policy": {
"label": "Default",
"name": "ns_default"
},
"protocol": "all",
"source_address": "1.1.1.1/30",
"destination_address": "10.0.0.1/20",
"sticky": false
}
]
}
```

Beware, additional field `ns_src` and `ns_dst` with a `id` representing the firewall object might be present in the
response, they are the object replacement of `source_address` and `destination_address` respectively, consider them with
higher priority over the other fields.

Note: field `protocol`, `source_address` and `destination_address` can be missing from the response, in that case
consider them to be set as `any`.

Expand All @@ -6171,6 +6175,8 @@ Parameters:
- `destination_address`: destination address to be used, can be a single IP, a CIDR or empty for `any`
- `destination_port`: destination port to be used, can be a single port, a range or empty for `any`
- `sticky`: Allow traffic from the same source IP address within the timeout limit to use same wan interface as prior session (Boolean default false)
- `ns_src`: source address object id, will override `source_address`
- `ns_dst`: destination address object id, will override `destination_address`

Example response:

Expand Down Expand Up @@ -6236,6 +6242,8 @@ Parameters:
- `destination_address`: destination address to be used, can be a single IP, a CIDR or empty for `any`
- `destination_port`: destination port to be used, can be a single port, a range or empty for `any`
- `sticky`: Allow traffic from the same source IP address within the timeout limit to use same wan interface as prior session (Boolean default false)
- `ns_src`: source address object id, will override `source_address`
- `ns_dst`: destination address object id, will override `destination_address`

Example response:

Expand Down
8 changes: 4 additions & 4 deletions packages/ns-api/files/ns.mwan
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ elif cmd == 'call':
data['name'],
data['policy'],
data['protocol'],
data['source_address'],
data.get('source_address'),
data['source_port'],
data['destination_address'],
data.get('destination_address'),
data['destination_port'],
data['sticky'],
data.get('ns_src'),
Expand All @@ -123,9 +123,9 @@ elif cmd == 'call':
data['policy'],
data['label'],
data['protocol'],
data['source_address'],
data.get('source_address'),
data['source_port'],
data['destination_address'],
data.get('destination_address'),
data['destination_port'],
data['sticky'],
data.get('ns_src'),
Expand Down
2 changes: 1 addition & 1 deletion packages/ns-api/files/ns.objects
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ elif cmd == 'call':
e_uci = EUci()
try:
if action == 'list-domain-sets':
print(json.dumps({'values': objects.list_domain_sets(e_uci)}))
print(json.dumps({'values': objects.list_objects(e_uci, include_host_sets=False, expand=True)}))
elif action == 'list-hosts':
print(json.dumps({'values': objects.list_objects(e_uci, include_domain_sets=False, expand=True)}))
else:
Expand Down
2 changes: 1 addition & 1 deletion packages/python3-nethsec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=python3-nethsec
PKG_VERSION:=0.0.70
PKG_VERSION:=0.0.71
PKG_RELEASE:=1

PKG_MAINTAINER:=Giacomo Sanchietti <giacomo.sanchietti@nethesis.it>
Expand Down
Loading