Skip to content

Conversation

@pperiyasamy
Copy link
Contributor

In case of Layer 2 mode, it doesn't make sense to advertise service
load balancer ip on the interfaces which don't have ip configured.
This commit filers out those interfaces so that it won't be chosen
for sending or responding arp/ndp messages.

Signed-off-by: Periyasamy Palanisamy pepalani@redhat.com

}
if ipaddr.IP.To4() != nil || !ipaddr.IP.IsLinkLocalUnicast() {
continue
if ipaddr.IP.To4() != nil && (ifi.Flags&net.FlagBroadcast) != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Would it just check len (addrs) be enough to skip the interface?

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, checked offline. This is better as it takes into account the case where an interface is v4 or v6 only.

@fedepaol
Copy link
Member

Code aside, we need to understand if this is always the behaviour we want, or if we are cutting out corner case that are still working.

if ipaddr.IP.To4() != nil || !ipaddr.IP.IsLinkLocalUnicast() {
continue
if ipaddr.IP.To4() != nil && (ifi.Flags&net.FlagBroadcast) != 0 {
keepARP[ifi.Index] = true
Copy link
Member

Choose a reason for hiding this comment

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

you can continue here, and no need for the else below, just the if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes @fedepaol , done.

In case of Layer 2 mode, it doesn't make sense to advertise service
load balancer ip on the interfaces which don't have ip configured.
This commit filers out those interfaces so that it won't be chosen
for sending or responding arp/ndp  messages.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
@pperiyasamy pperiyasamy force-pushed the arp-valid-interface branch from 539bcee to 4f05c23 Compare April 29, 2022 12:37
@fedepaol
Copy link
Member

LGTM

@fedepaol fedepaol merged commit 9936f3b into metallb:main Apr 29, 2022
@pperiyasamy pperiyasamy deleted the arp-valid-interface branch April 29, 2022 14:38
fedepaol added a commit to fedepaol/metallb that referenced this pull request Jul 15, 2022
A regression introduced by
metallb#1347, we were adding records to
the keepNDP map regardless of the fact that a v6 address was present on
the interface.
Here we enforce the if checking that the ip is not v4.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
fedepaol added a commit that referenced this pull request Jul 15, 2022
A regression introduced by
#1347, we were adding records to
the keepNDP map regardless of the fact that a v6 address was present on
the interface.
Here we enforce the if checking that the ip is not v4.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
fedepaol added a commit to fedepaol/metallb that referenced this pull request Jul 15, 2022
A regression introduced by
metallb#1347, we were adding records to
the keepNDP map regardless of the fact that a v6 address was present on
the interface.
Here we enforce the if checking that the ip is not v4.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
fedepaol added a commit that referenced this pull request Jul 20, 2022
A regression introduced by
#1347, we were adding records to
the keepNDP map regardless of the fact that a v6 address was present on
the interface.
Here we enforce the if checking that the ip is not v4.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
novad03 pushed a commit to novad03/k8s-meta that referenced this pull request Nov 25, 2023
A regression introduced by
metallb/metallb#1347, we were adding records to
the keepNDP map regardless of the fact that a v6 address was present on
the interface.
Here we enforce the if checking that the ip is not v4.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants