[PATCH 0/2] virnetdev: Fix regression in setting VLAN tag

*** BLURB HERE *** Michal Prívozník (2): virNetDevSetVfMac: Fix error message on invalid args virnetdev: Fix regression in setting VLAN tag src/util/virnetdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.35.1

If virNetDevSetVfMac() is called with either @macaddr or @allowRetry arguments NULL an error is reported, because this is considered invalid use. However, the error message is not informative as it could be. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/util/virnetdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 1c15a475fa..5e60bf068f 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1642,7 +1642,9 @@ virNetDevSetVfMac(const char *ifname, int vf, }; if (macaddr == NULL || allowRetry == NULL) { - virReportError(EINVAL, "%s", _("Invalid parameters: %d")); + virReportError(EINVAL, + _("Invalid parameters macaddr=%p allowRetry=%p"), + macaddr, allowRetry); return -EINVAL; } -- 2.35.1

In the past, we did set VLAN tag on <interface type='direct'/>. However, during rewrite (v8.1.0-rc1~191) virNetDevSetVfConfig() was changed and a condition that was responsible for calling a function that sets VLAN tag was changed accidentally resulting in VLAN tag not being set anymore. However, because of other changes in the same patchset, it may happen that @adminMac is NULL (this is to work around yet another broken SRIOV driver), and thus we must refrain from setting MAC and have to set VLAN tag only. Fixes: 73961771a1cfec3c0f43caec9d117d2fbcc7af39 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075383 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/util/virnetdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 5e60bf068f..93f836cd92 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1682,7 +1682,8 @@ virNetDevSetVfConfig(const char *ifname, { int ret = -1; - if ((ret = virNetDevSetVfMac(ifname, vf, macaddr, allowRetry)) < 0) + if (macaddr && + (ret = virNetDevSetVfMac(ifname, vf, macaddr, allowRetry)) < 0) return ret; if ((ret = virNetDevSetVfVlan(ifname, vf, vlanid)) < 0) return ret; @@ -2365,7 +2366,7 @@ virNetDevSetNetConfig(const char *linkdev, int vf, } } - if (adminMAC) { + if (adminMAC || vlanTag) { /* Set vlanTag and admin MAC using an RTM_SETLINK request sent to * PFdevname+VF#, if mac != NULL this will set the "admin MAC" via * the PF, *not* the actual VF MAC - the admin MAC only takes -- 2.35.1

On 4/22/22 14:15, Michal Privoznik wrote:
*** BLURB HERE ***
Michal Prívozník (2): virNetDevSetVfMac: Fix error message on invalid args virnetdev: Fix regression in setting VLAN tag
src/util/virnetdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Polite ping. Michal

On a Friday in 2022, Michal Privoznik wrote:
*** BLURB HERE ***
Michal Prívozník (2): virNetDevSetVfMac: Fix error message on invalid args virnetdev: Fix regression in setting VLAN tag
src/util/virnetdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (3)
-
Ján Tomko
-
Michal Privoznik
-
Michal Prívozník