Skip to content

[security/tinc] Enable usage of no, one or several addresses per hosts#2110

Merged
AdSchellevis merged 2 commits into
opnsense:masterfrom
ElNounch:master
Nov 15, 2020
Merged

[security/tinc] Enable usage of no, one or several addresses per hosts#2110
AdSchellevis merged 2 commits into
opnsense:masterfrom
ElNounch:master

Conversation

@ElNounch
Copy link
Copy Markdown
Contributor

All three situations are legit, both for local and remote hosts.

@AdSchellevis AdSchellevis self-assigned this Nov 14, 2020
result.append('AddressFamily=any')
if 'address' in self._payload:
addresses = self._payload['address'].split(',')
for address in addresses:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can be simplified:

for address in self._payload['address'].split(','):

addresses isn't used anywhere else.

It's probably better to move the functionality to NetwConfObject. get_addresses() in which case you could iterate always over the get_addresses() and ditch the if as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Did so, but this part shouldn't have been, anyway...
Undone. Took care of your comment in next code block.

result.append('Address=%(address)s %(port)s'%self._payload)
if 'address' in self._payload:
addresses = self._payload['address'].split(',')
for address in addresses:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Was micmic of existing code for subnets...
Reworked both this way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ElNounch nice!

<ValidationMessage>Please specify a valid hostname.</ValidationMessage>
</hostname>
<extaddress type="TextField">
<Required>Y</Required>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we could also use a HostnameField in combination with a tokeniser in the form, in which case you wouldn't need to explain the split character.

Every generated config files last line ends with a newline
AdSchellevis added a commit that referenced this pull request Nov 15, 2020
@AdSchellevis AdSchellevis merged commit 35d329e into opnsense:master Nov 15, 2020
@AdSchellevis
Copy link
Copy Markdown
Member

@ElNounch did a small test on my end, looks good, I only added a new version number in 5dc2478 and merged the PR.

AdSchellevis pushed a commit that referenced this pull request Jan 14, 2021
In switch mode the subnet field is empty, thus the 'subnet' key does not exist in the '_payload' dictionary.
windgmbh pushed a commit to windgmbh/opnsense-plugins that referenced this pull request Feb 4, 2021
In switch mode the subnet field is empty, thus the 'subnet' key does not exist in the '_payload' dictionary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants