diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-08 17:46:14 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-08 17:46:14 +0300 |
| commit | b2eab395bb283b412e7bc8fef022ac06721b9a4e (patch) | |
| tree | 09ae3c51a83cf92e2358a0295e9885f4c6b92713 | |
| parent | af009c87b41ea1bb594d68e53d46ca050057e2db (diff) | |
| download | accel-ppp-b2eab395bb283b412e7bc8fef022ac06721b9a4e.tar.gz accel-ppp-b2eab395bb283b412e7bc8fef022ac06721b9a4e.zip | |
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.
| -rw-r--r-- | accel-pppd/libnetlink/genl.c | 8 |
1 files changed, 5 insertions, 3 deletions
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++) { |
