Project

General

Profile

Actions

User story #3615

closed

IP search field with slash notation (subnet, mask, ip range)

Added by Fabrice FLORE-THÉBAULT over 11 years ago. Updated about 2 months ago.

Status:
Released
Priority:
2
Category:
Web - Nodes & inventories
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:
No

Description

Let's say you want to filter IP and match 192.168.0.0/24.

For this field, it would be nice to have a standard notation, like 192.168.0.0/24, wich makes more sense than a regex.

Resolution note: it ONLY works on the IP from node summary, not the ones in the network parts.


Related issues 1 (0 open1 closed)

Has duplicate Rudder - Enhancement #1200: Search for IP addresses included in a subnetResolvedActions
Actions #1

Updated by Nicolas CHARLES over 11 years ago

  • Project changed from 30 to Rudder
  • Category set to Web - Nodes & inventories
  • Target version set to 2.7.0~beta1

Yeah, agreed !

Actions #2

Updated by Nicolas PERRON over 11 years ago

  • Target version changed from 2.7.0~beta1 to 2.7.0~rc1
Actions #3

Updated by Nicolas PERRON over 11 years ago

  • Status changed from New to 8
  • Target version changed from 2.7.0~rc1 to Ideas (not version specific)
Actions #4

Updated by Benoît PECCATTE over 9 years ago

  • Status changed from 8 to New
Actions #5

Updated by François ARMAND 3 months ago

  • Target version changed from Ideas (not version specific) to 8.1.8
  • Regression set to No

It would be easy now that we have node fact to accept both IP and CIDR in the "equal" field of IP match.

Something like:

final case class NodeCriterionMatcherIpaddress(extractor: CoreNodeFact => Chunk[Cidr[IpAddress]])
    extends NodeCriterionOrderedValueMatcher[Cidr[IpAddress]] {
  override def parseNum(value: String):          Option[Cidr[IpAddress]] = Cidr.fromString(value).orElse(IpAddress.fromString(value).map(ip => Cidr(ip, 32)))
  override def serialise(a:    Cidr[IpAddress]): String                  = a.toString()
  val order: Ordering[Cidr[IpAddress]] = Ordering.String.on(_.toString())
  implicit val ser: Cidr[IpAddress] => String = serialise _

  override def matches(n: CoreNodeFact, comparator: CriterionComparator, value: String): IOResult[Boolean] = {
    comparator match {
      case Equals =>
        tryMatches(
          value,
          a =>
            MatchHolder[Cidr[IpAddress]](DebugInfo(Equals.id, Some(value)), extractor(n), _.exists(ip => a.contains(ip.address)))
        )
      case _      => super.matches(n, comparator, value)
    }
  }
}

// and in Node comparator, and other relevant places: 
    ObjectCriterion(
      OC_NODE,
      Chunk(
        ...
        Criterion(A_LIST_OF_IP, NodeIpListComparator, NodeCriterionMatcherIpaddress(_.ipAddresses.flatMap(ip => Cidr.fromString(ip.inet +"/32")))),
        ...
      )
    ),

(needs to be done for ipV4 and ipV6)

Actions #6

Updated by François ARMAND 3 months ago

  • Priority changed from N/A to To review
Actions #7

Updated by François ARMAND 3 months ago

  • Status changed from New to Pending technical review
  • Assignee set to Clark ANDRIANASOLO
  • Pull Request set to https://github.com/Normation/rudder/pull/5929
Actions #8

Updated by François ARMAND 2 months ago

  • Pull Request changed from https://github.com/Normation/rudder/pull/5929 to https://github.com/Normation/rudder/pull/5930
Actions #9

Updated by Anonymous 2 months ago

  • Status changed from Pending technical review to Pending release
Actions #10

Updated by François ARMAND 2 months ago

  • Target version changed from 8.1.8 to 8.2.0~rc1
Actions #11

Updated by François ARMAND 2 months ago

Actions #12

Updated by François ARMAND 2 months ago

  • Related to deleted (Enhancement #1200: Search for IP addresses included in a subnet)
Actions #13

Updated by François ARMAND 2 months ago

  • Has duplicate Enhancement #1200: Search for IP addresses included in a subnet added
Actions #14

Updated by Nicolas CHARLES 2 months ago

  • Priority changed from To review to 2
Actions #15

Updated by Vincent MEMBRÉ 2 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 8.2.0~rc1 which was released today.

Actions #16

Updated by François ARMAND about 2 months ago

  • Subject changed from IP search field with slash notation to IP search field with slash notation (subnet, mask, ip range)
  • Description updated (diff)
Actions

Also available in: Atom PDF