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

Added support for ACL entry netmask set with non-contiguous bits #1143

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

Conversation

Pull-eckermann
Copy link

@Pull-eckermann Pull-eckermann commented Jun 28, 2024

Added support for ACL entry netmask set with non-contiguous bits

This pull resquest is being created in the context of issue 1082

In the current OpenConfig, configuration of source-address and destination-address leaves in the /oc-acl:acl/acl-sets/acl-set/acl-entries/acl-entry/ipv4/config (or ipv6) xpath are only supported with netmasks that are left-contiguous, cause this leaves are defined with type oc-inet:ipv4-prefix or oc-inet:ipv6-prefix, which only allows CIDR mask format.

The contiguous mask is applicable when assigning an IP address to an interface, or while adding routes. However, it does not necessarily need to be contiguos for ACLs. ACL's should be capable of filtering based on any kinds of masks. This way multiple non consecutive ranges of networks can be covered in one shot.

Change Scope

  • Changed type of source-address and destination-address leaves (ipv4 and ipv6) to oc-inet:ipv4/6-address. Also created new leaves to represent the netmask for each address, allowing CIDR format or wildcard bits.
  • Type of source and destination address were changed but this change is backwards compatible.

Platform Implementations

  • For CISCO, documentatin of this type of configuration can be found here in "Wildcard Mask for Addresses in an Access List" section. Also, in the file (Cisco-IOS-XE-acl.yang)[https://github.com/YangModels/yang/blob/main/vendor/cisco/xe/1791/Cisco-IOS-XE-acl.yang] there is an example in grouping ipv4-acl-src-dst-addr-port-grouping, line 1019, were ipv4-address and mask are separated in two leaves.
  • Ipinfusiuon OcNOS implements this in the yang ipi-acl-types.yang with the typedef acl_any_ipv4_src_addr_t (line 244), as a union.
  • JUNO OS from Junyper also have support to this, docs can be found here in "Understanding Wildcard Addresses" section.
  • FortiOS from Fortinet also have support to this and an example is found in this page.
  • Huawei documentation about this can be found here in Table 1-4.

- Change type of ipv4 and ipv6 source and destinations address to oc-inet:ipv4-address.
- Creation of source/destination-address-mask leaves to alow wildcard masks
Creation of ipv4-prefix-mask-type and ipv6-prefix-mask-type.
@Pull-eckermann Pull-eckermann requested a review from a team as a code owner June 28, 2024 18:27
@Pull-eckermann Pull-eckermann changed the title Acl contribution Added support for ACL entry netmask set with non-contiguous bits Jun 28, 2024
@wenovus
Copy link
Contributor

wenovus commented Jun 28, 2024

/gcbrun

@OpenConfigBot
Copy link

OpenConfigBot commented Jun 28, 2024

No major YANG version changes in commit a3504f9

@LimeHat
Copy link

LimeHat commented Jun 28, 2024

I'd prefer to see new leafs added instead of changing the existing source-address/destination-address.

Changing the type is a major, breaking change and, in my opinion, is not warranted in this case.

Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

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

Thanks for the PR and the research to show support on different platforms -- one note, the fact that platforms use two leaves to express address and mask does not imply that they support wildcard matches, so I'd prefer to keep these as two separate configurable entities.

+1 to comments in the thread from @LimeHat about how we implement the change -- see comments below too.

release/models/acl/openconfig-packet-match-types.yang Outdated Show resolved Hide resolved
release/models/acl/openconfig-packet-match-types.yang Outdated Show resolved Hide resolved
release/models/acl/openconfig-packet-match-types.yang Outdated Show resolved Hide resolved
Add sugestions of the reviewer:
- Remove braking change
- Add two new leaves to be used in the case of non-wildcard matches that cannot be expressed by a CIDR mask.
Deleting the changes as the typedef is not needed anymore.
@Pull-eckermann
Copy link
Author

@LimeHat @robshakir Breaking change removed and implemented the sugested changes. Two new leaves were added to the specific case that is of concern.

@dplore
Copy link
Member

dplore commented Jul 16, 2024

/gcbrun

leaf masked-source-address {
type oc-inet:ipv4-address;
description
"Source IPv4 address used with a mask.";
Copy link

Choose a reason for hiding this comment

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

I would recommend adding more detailed descriptions to these leafs, namely:

  1. indicate that masked-source-address and source-mask are always used together, but mutually exclusive with source-address
  2. indicate that source-address is the preferred method of configuring ACLs as suggested by @robshakir

Copy link
Author

Choose a reason for hiding this comment

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

Done in the last commit.

"Source IPv4 address used with a mask.";
}

leaf destination-source-mask {
Copy link

Choose a reason for hiding this comment

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

destination or source?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in the last commit.

leaf destination-source-mask {
type oc-inet:ipv4-address;
description
"Source IPv4 address mask.";
Copy link

Choose a reason for hiding this comment

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

Please specify that this is a wildcard mask. Maybe even better to add wildcard to the name of the leaf.

Copy link
Author

Choose a reason for hiding this comment

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

Done in the last commit.

leaf destination-address-mask {
type oc-inet:ipv4-address;
description
"Destination IPv4 address mask.";
Copy link

Choose a reason for hiding this comment

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

Please specify that this is a wildcard mask. Maybe even better to add wildcard to the name of the leaf.

Copy link
Author

Choose a reason for hiding this comment

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

Done in the last commit.

- Changed the name of leaves source-address-mask and destination-address-mask to source-wildcard-mask and destination-wildcard-mask.
- Increase specification ot the description of masked-source-address and masked-destination-address leaves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

6 participants