From b2eab395bb283b412e7bc8fef022ac06721b9a4e Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Sat, 8 Aug 2026 17:46:14 +0300 Subject: libnetlink: report the genl family id even when the group is not found genl_resolve_mcg() stored the resolved family id only after it had established that the family advertises multicast groups, so a caller that also needs the family id was left with nothing whenever the group lookup failed. Fill in fam_id as soon as it has been parsed. The return value is unchanged, so callers interested only in the group are unaffected. --- accel-pppd/libnetlink/genl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'accel-pppd/libnetlink') diff --git a/accel-pppd/libnetlink/genl.c b/accel-pppd/libnetlink/genl.c index 0c758077..8cdfce89 100644 --- a/accel-pppd/libnetlink/genl.c +++ b/accel-pppd/libnetlink/genl.c @@ -82,12 +82,14 @@ int __export genl_resolve_mcg(const char *family, const char *name, int *fam_id) goto out; } - if (!tb[CTRL_ATTR_MCAST_GROUPS]) - goto out; - + /* report the family id even if the group lookup below fails, the + * caller may still have use for it */ if (fam_id) *fam_id = *(uint16_t *)(RTA_DATA(tb[CTRL_ATTR_FAMILY_ID])); + if (!tb[CTRL_ATTR_MCAST_GROUPS]) + goto out; + parse_rtattr_nested(tb2, GENL_MAX_FAM_GRPS, tb[CTRL_ATTR_MCAST_GROUPS]); for (i = 1; i < GENL_MAX_FAM_GRPS; i++) { -- cgit v1.2.3