Closed michaelmangold closed 6 years ago
Hi,
problem is with defaultValue
because default values are not set when saving new item.
var firewallItem = new FirewallFilter()
{
Action = FirewallFilter.ActionType.Drop,
Chain = "forward",
Comment = "test-tcp",
DstAddress = "8.8.8.8",
DstPort = "53",
Protocol = "tcp",
SrcAddress = "1.1.1.1",
SrcPort = "22",
};
Connection.Save(firewallItem);
> /ip/firewall/filter/add
> =action=drop
> =chain=forward
> =comment=test-tcp
> =dst-address=8.8.8.8
> =dst-port=53
> =src-address=1.1.1.1
> =src-port=22
< !trap
< =message=failure: ports can be specified if proto is tcp or udp
Fix is easy - remove default value from attribute :-)
D
Hello, if I want to add a new FirewallFilter with Protocol = tcp it throws the following exception: ---> tik4net.TikCommandException: failure: ports can be specified if proto is tcp,udp,udp-lite,dccp,sctp
my FirewallFilter Object: (serialized to Json)
If Iam changing the Protocol from "tcp" to "udp" it will work.
I think the UnsetOnDefault is the Problem. I tried to set it to false but it doesn´t help. https://github.com/danikf/tik4net/blob/a7806a325cbd01c97e68d3070e6ae66af4f55337/tik4net.objects/Ip/Firewall/FirewallFilter.cs#L417