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

[dev.icinga.com #10354] New method: cidr_match() #3481

Closed
icinga-migration opened this issue Oct 13, 2015 · 6 comments
Closed

[dev.icinga.com #10354] New method: cidr_match() #3481

icinga-migration opened this issue Oct 13, 2015 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10354

Created by tgelf on 2015-10-13 11:47:39 +00:00

Assignee: gbeutner
Status: Resolved (closed on 2015-10-14 12:45:45 +00:00)
Target Version: 2.3.11
Last Update: 2015-10-15 09:59:23 +00:00 (in Redmine)

Backport?: Already backported
Include in Changelog: 1

A method cidr_match() would allow us to assign services based on network ranges in CIDR notation. That could be a very handsome feature.

Examples

cidr_match("192.168.128.0/23", host.address)
cidr_match("2002::/32", host.address6)
cidr_match("2002::192.168.0.16/125", host.address6)
cidr_match("2002:1234::/127", host.address)

I'd prefer to see one single method for IPv4 and IPv6 addresses. Alternatively an additional cidr6_match() would also be fine. In either case, decimal notation for the last four bytes should be allowed. Functions should gracefully return false in case a non-IP string is given, but give a parse error in case of an invalid CIDR notation.

Thanks,
Thomas

Changesets

2015-10-14 08:14:01 +00:00 by (unknown) 06a0f18

Implement the cidr_match function

fixes #10354

2015-10-14 10:12:54 +00:00 by tgelf 21c48e8

Improve error handling in cidr_match function

refs #10354

2015-10-14 10:23:59 +00:00 by tgelf 29188a4

Improve error handling in cidr_match function

refs #10354

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>

2015-10-14 10:24:03 +00:00 by (unknown) 14e37a0

Update AUTHORS

refs #10354

2015-10-15 09:58:56 +00:00 by (unknown) bb93489

Implement the cidr_match function

fixes #10354

2015-10-15 09:59:05 +00:00 by tgelf dc92e26

Improve error handling in cidr_match function

refs #10354

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>

2015-10-15 09:59:12 +00:00 by (unknown) a64279d

Update AUTHORS

refs #10354

Relations:

@icinga-migration
Copy link
Author

Updated by Anonymous on 2015-10-14 08:15:03 +00:00

  • Status changed from New to Resolved
  • Done % changed from 0 to 100

Applied in changeset 06a0f18.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-10-14 08:21:41 +00:00

  • Category set to libbase

  • Target Version set to 2.4.0

    Icinga (version: v2.3.0-652-g06a0f18)
    <1> => cidr_match("127.0.0.0/8", "127.28.59.109")
    true
    <2> => cidr_match("::ffff:0.0.0.0/96", "81.95.1.82")
    true
    <3> => cidr_match("2000::/3", "2a01:4a0:44:118::2")
    true
    4> => cidr_match("192.168.2.36/24", "192.168.2.1")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Error while evaluating expression: Masked-off bits must all be zero.
    <5> => cidr_match("2000:/3", "2a01:4a0:44:118::2")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Error while evaluating expression: Invalid IP address specified.
    <6> => cidr_match("2000::/3", null)
    false
    7> => cidr_match("2000::/3", "foo")
    false

@icinga-migration
Copy link
Author

Updated by tgelf on 2015-10-14 10:16:33 +00:00

  • Status changed from Resolved to Assigned

@gunnar: thanks for you help, please check and merge feature/cidr-match-10354 :-)

Cheers,
Thomas

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-10-14 12:45:45 +00:00

  • Status changed from Assigned to Resolved

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-10-15 09:45:26 +00:00

  • Duplicated set to 9162

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-10-15 09:59:23 +00:00

  • Target Version changed from 2.4.0 to 2.3.11
  • Backport? changed from TBD to Yes

@icinga-migration icinga-migration added enhancement New feature or request libbase labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.3.11 milestone Jan 17, 2017
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

No branches or pull requests

1 participant