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

Support for comments and more types #75

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

elfranne
Copy link
Contributor

@elfranne elfranne commented Jan 12, 2023

Pull Request (PR) description

Add support for comments (#5) and the types from the man page.

counters skbinfo markmask options are not implemented, they are boolean options. If anyone has any advice on how to implement that cleanly ...

example with using hiera data for bitmap:port:

data::from::hiera::ports:
  - 5005
  - 5006
  - 5007
  - 5008
  - 5009
  - 5010
  - 5023
  - 5027
  - 5028
  - 5031
  ipset::set { 'port-server1':
    set     => lookup('data::from::hiera::ports'),
    type    => 'bitmap:port',
    options => {
      range => '5000-6000',
    },
  }

If you want to limit to udp:

  ipset::set { 'port-server2':
    set     => lookup('data::from::hiera::ports').map |$value| { "udp:${value}" },
    type    => 'bitmap:port',
    options => {
      range => '5000-6000',
    },
  }

This was primarily implemented to be able to create non consecutive port lists as iptables only support a maximum of 15 ports with the --multiports and the XT_MULTI_PORTS compile setting source

Comment on lines +12 to +13
Optional[range] => String,
Optional[comment] => String,
Copy link
Member

Choose a reason for hiding this comment

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

can you make this a bit more strict? Are empty strings okay or should we enforce a minimal length?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Optional[range]    => Pattern[/^6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}-6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}$/],
Optional[comment]  => Pattern[/^(.*").*$/],

Port regex blatantly stolen from StackOverflow

According do documentation only " is an illegal character in the comment.

@bastelfreak bastelfreak added the enhancement New feature or request label Jan 15, 2023
types/set/array.pp Outdated Show resolved Hide resolved
@bastelfreak
Copy link
Member

thanks for the PR. can you please add some unit tests as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants