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

BSD: Check MASTER/BACKUP of link-local addresses configured in AdvRASrcAddress #162

Open
znerol opened this issue Dec 11, 2021 · 4 comments
Assignees

Comments

@znerol
Copy link

znerol commented Dec 11, 2021

In HA setups as outlined in this post, radvd is concurrently running on multiple routers. RAs are only sent out on an interface iff the link local address configured via AdvRASrcAddress is present on the specified interface.

This works well on Linux because Keepalived makes sure that the virtual link-local address is configured on one node only. In BSD/CARP however, a virtual CARP address is always configured on all nodes. It is just flagged with MASTER/BACKUP.

Running radvd on multiple BSD routers in aforementioned HA mode currently results in all routers (primary as well as backups) sending out RAs regardless of their current HA role.

In order to resolve this issue, radvd needs to be extended to respect MASTER/BACKUP flags on virtual link-local address on BSDs and only send out RAs iff an address configured via AdvRASrcAddress is flagged as MASTER.

Related issues in pfSense:

@znerol znerol changed the title Check MASTER/BACKUP of link-local addresses configured in AdvRASrcAddress BSD: Check MASTER/BACKUP of link-local addresses configured in AdvRASrcAddress Dec 11, 2021
@stappersg stappersg removed their assignment Dec 12, 2021
@robbat2
Copy link
Member

robbat2 commented Dec 15, 2021

Do you have good examples of how to check those flags in BSD? I'd never run into them before today.

It does strike me as a good extension to VRRP, making the kernel aware of the address state, but this would be BSD-specific changes to guard w/ ifdefs.

@sjorge
Copy link

sjorge commented Dec 15, 2021

I actually found this issue today because I was trying to figure out how to get the failover node to not announce...

I'm not really a C or derivatives programmer but I was messing around with ppp_thing which is a PPPoE client that works over CARP that shares a session between nodes.

Not sure how useful this or if the BSD3-clause source license of ppp_thing is even compatible with radvd, but the check to see if the host is the CARP master seem to be here: https://github.com/russor/ppp_thing/blob/main/ppp_thing.c#L148

@robbat2
Copy link
Member

robbat2 commented Dec 15, 2021

That just tries to put routes via netlink and assumes if they succeed that it's using CARP and it's MASTER, which i'm not sure is safe.

@znerol
Copy link
Author

znerol commented Dec 15, 2021

Disclaimer, I am not a BSD developer.. Please take the following analysis with a grain of salt.

Two steps are necessary to check the state of a given address.

  1. Extract ifi_vhid from the ifa_data field of a given struct ifaddrs. Example:
	/* Set the vhid */
	if (ifa->ifa_data) {
		addr->vhid = ((struct if_data *)ifa->ifa_data)->ifi_vhid;
	}
  1. Compare that with info retrieved using the SIOCGVH ioctl. See ifconfig_carp_get_info and carp_status.

All of this is implemented in libifconfig in FreeBSD.

OpenBSD seems to be using the same mechanism (SIOCGVH) but doesn't have those methods extracted to a library. Everything is implemented directly in ifconfig.c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants