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

"CreatePortRule" the protocol parameter is not taken into account #48

Open
nicojail opened this issue Aug 24, 2021 · 3 comments
Open

"CreatePortRule" the protocol parameter is not taken into account #48

nicojail opened this issue Aug 24, 2021 · 3 comments
Assignees

Comments

@nicojail
Copy link

Hello,
with this code :

IFirewallRule firewallRule = FirewallManager.Instance.CreatePortRule (@" "+ ruleName +" ", FirewallAction.Allow, port, FirewallProtocol.UDP);

the protocol is always in TCP.

See screenshot

ErrorProtocol

Thanks

@falahati
Copy link
Owner

falahati commented Oct 1, 2021

Works alright with version 2, will try version 1 later but this means that if you upgrade to v2 you probably won't have this problem anymore anyway:

image

@nicojail
Copy link
Author

nicojail commented Oct 1, 2021

I already use WindowsFirewallHelper.2.1.4.81.
I use CreatePortRule without the FirewallProfile parameter

@jsandv
Copy link

jsandv commented Mar 8, 2022

Same issue:
Temp solution:

                var rule = FirewallManager.Instance.CreatePortRule(
                    ruleName,
                    FirewallAction.Allow,
                    (ushort)port,
                    udp ? FirewallProtocol.UDP : FirewallProtocol.TCP // this one will not kick in
                );
                //TODO Remove when lib is fixed
                rule.Protocol = udp ? FirewallProtocol.UDP : FirewallProtocol.TCP;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants