Skip to content

Commit

Permalink
Merge pull request #712 from NethServer/issue671
Browse files Browse the repository at this point in the history
mwan: remove unsupported objects

Issue #671
  • Loading branch information
gsanchietti authored Aug 7, 2024
2 parents f56aa29 + f2d55ab commit bb5b6dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/ns-api/files/ns.mwan
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ from euci import EUci
from nethsec import mwan, utils, objects

def __filter_objects(e_uci: EUci, obj):
family = objects.get_info(e_uci, obj['id']).get('family', None)
if family and family == 'ipv6':
return False
if obj['type'] == 'host_set':
return objects.is_singleton_host_set(e_uci, obj['id'], allow_cidr=True)
return True
Expand Down Expand Up @@ -157,7 +160,7 @@ elif cmd == 'call':
print(json.dumps({'values': mwan.get_default_config(e_uci)}))
elif action == "list_object_suggestions":
ns_src = list(filter(lambda x: __filter_objects(e_uci, x), objects.list_objects(e_uci, include_domain_sets=False)))
ns_dst = list(filter(lambda x: __filter_objects(e_uci, x), objects.list_objects(e_uci, include_domain_sets=True)))
ns_dst = list(filter(lambda x: __filter_objects(e_uci, x), objects.list_objects(e_uci, include_domain_sets=False)))
print(json.dumps({"objects": {'ns_src': ns_src, 'ns_dst': ns_dst}}))

except KeyError as e:
Expand Down
7 changes: 3 additions & 4 deletions packages/ns-objects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,14 @@ Supported object types depends on the field:
- a static lease, a record of type `host` from `dhcp` db
- a dns record, a record of type `domain` from `dhcp` db
- a vpn user, a record of type `user` from `users` db with `openvpn_ipaddr`
- a singleton host set, a record of type `host` from `objects` db with only one IP address
- a singleton host set, a record of type `host` from `objects` db with only one IP address or CIDR

- `ns_dst` can be:

- a domain set object, a record of type `domain` from `objects` db
- a dns record, a record of type `domain` from `dhcp` db
- a host set object, a record of type `host` from `objects` db
- a vpn user, a record of type `user` from `users` db with `openvpn_ipaddr`
- a singleton host set, a record of type `host` from `objects` db with only one IP address
- a singleton host set, a record of type `host` from `objects` db with only one IP address or CIDR


Example of multiwan rule with domain set object inside `/etc/config/mwan3`:
Expand All @@ -448,4 +447,4 @@ DPI rules and exceptions can use the following object types:
- a vpn user, a record of type `user` from `users` db with `openvpn_ipaddr`- host set from `objects` db
- an host set, a record of type `host` from `objects` db

See [ns-dpi](../ns-dpi/) package for more details.
See [ns-dpi](../ns-dpi/) package for more details.
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.73
PKG_VERSION:=0.0.74
PKG_RELEASE:=1

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

0 comments on commit bb5b6dd

Please sign in to comment.