[PATCH 2/5] virnetlink: Provide stub for virNetlinkBridgeVlanFilterSet()

Michal Privoznik via Devel posted 5 patches 3 months, 4 weeks ago
There is a newer version of this series
[PATCH 2/5] virnetlink: Provide stub for virNetlinkBridgeVlanFilterSet()
Posted by Michal Privoznik via Devel 3 months, 4 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

In virnetlink.c there are two sections: the first one when
building WITH_LIBNL support, the other that provides stubs for
functions declared in the corresponding header file when building
without netlink support. But the stub implementation for
virNetlinkBridgeVlanFilterSet() was missing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virnetlink.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 206646d9d7..2555457cd2 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -1344,6 +1344,17 @@ virNetlinkNewLink(const char *ifname G_GNUC_UNUSED,
 }
 
 
+int
+virNetlinkBridgeVlanFilterSet(const char *ifname G_GNUC_UNUSED,
+                              int cmd G_GNUC_UNUSED,
+                              const unsigned short fflags G_GNUC_UNUSED,
+                              const short vid G_GNUC_UNUSED,
+                              int *error G_GNUC_UNUSED)
+{
+    virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
+    return -1;
+}
+
 int
 virNetlinkGetNeighbor(void **nlData G_GNUC_UNUSED,
                       uint32_t src_pid G_GNUC_UNUSED,
-- 
2.49.0
Re: [PATCH 2/5] virnetlink: Provide stub for virNetlinkBridgeVlanFilterSet()
Posted by Peter Krempa via Devel 3 months, 4 weeks ago
On Mon, May 12, 2025 at 15:37:13 +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> In virnetlink.c there are two sections: the first one when
> building WITH_LIBNL support, the other that provides stubs for
> functions declared in the corresponding header file when building
> without netlink support. But the stub implementation for
> virNetlinkBridgeVlanFilterSet() was missing.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/util/virnetlink.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
> index 206646d9d7..2555457cd2 100644
> --- a/src/util/virnetlink.c
> +++ b/src/util/virnetlink.c
> @@ -1344,6 +1344,17 @@ virNetlinkNewLink(const char *ifname G_GNUC_UNUSED,
>  }
>  
>  
> +int
> +virNetlinkBridgeVlanFilterSet(const char *ifname G_GNUC_UNUSED,
> +                              int cmd G_GNUC_UNUSED,
> +                              const unsigned short fflags G_GNUC_UNUSED,

s/fflags/flags/

> +                              const short vid G_GNUC_UNUSED,
> +                              int *error G_GNUC_UNUSED)
> +{

Based on the usage I thin this function needs to still set error to 0.
All callers for now do that before calling but still the documentation
states that non-zero code means a netlink error, which is not the case
here.

> +    virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));

I wanted to complain that INTERNAL_ERROR is not appropriate; but it
seems that all the stubs in virnetlink.c have terrible errors.

> +    return -1;
> +}
> +
>  int
>  virNetlinkGetNeighbor(void **nlData G_GNUC_UNUSED,
>                        uint32_t src_pid G_GNUC_UNUSED,
> -- 
> 2.49.0
> 

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Re: [PATCH 2/5] virnetlink: Provide stub for virNetlinkBridgeVlanFilterSet()
Posted by Michal Prívozník via Devel 3 months, 4 weeks ago
On 5/13/25 09:53, Peter Krempa wrote:
> On Mon, May 12, 2025 at 15:37:13 +0200, Michal Privoznik via Devel wrote:
>> From: Michal Privoznik <mprivozn@redhat.com>
>>
>> In virnetlink.c there are two sections: the first one when
>> building WITH_LIBNL support, the other that provides stubs for
>> functions declared in the corresponding header file when building
>> without netlink support. But the stub implementation for
>> virNetlinkBridgeVlanFilterSet() was missing.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>>  src/util/virnetlink.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
>> index 206646d9d7..2555457cd2 100644
>> --- a/src/util/virnetlink.c
>> +++ b/src/util/virnetlink.c
>> @@ -1344,6 +1344,17 @@ virNetlinkNewLink(const char *ifname G_GNUC_UNUSED,
>>  }
>>  
>>  
>> +int
>> +virNetlinkBridgeVlanFilterSet(const char *ifname G_GNUC_UNUSED,
>> +                              int cmd G_GNUC_UNUSED,
>> +                              const unsigned short fflags G_GNUC_UNUSED,
> 
> s/fflags/flags/

No, this needs to be anything else but 'flags' otherwise our
sc_flags_usage syntax-check rule will complain. unusedflags perhaps?

> 
>> +                              const short vid G_GNUC_UNUSED,
>> +                              int *error G_GNUC_UNUSED)
>> +{
> 
> Based on the usage I thin this function needs to still set error to 0.
> All callers for now do that before calling but still the documentation
> states that non-zero code means a netlink error, which is not the case
> here.

Good point.

> 
>> +    virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
> 
> I wanted to complain that INTERNAL_ERROR is not appropriate; but it
> seems that all the stubs in virnetlink.c have terrible errors.

Indeed, I went with consistency over correctness.

> 
>> +    return -1;
>> +}
>> +
>>  int
>>  virNetlinkGetNeighbor(void **nlData G_GNUC_UNUSED,
>>                        uint32_t src_pid G_GNUC_UNUSED,
>> -- 
>> 2.49.0
>>
> 
> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
> 

Michal
Re: [PATCH 2/5] virnetlink: Provide stub for virNetlinkBridgeVlanFilterSet()
Posted by Peter Krempa via Devel 3 months, 4 weeks ago
On Tue, May 13, 2025 at 15:30:20 +0200, Michal Prívozník wrote:
> On 5/13/25 09:53, Peter Krempa wrote:
> > On Mon, May 12, 2025 at 15:37:13 +0200, Michal Privoznik via Devel wrote:
> >> From: Michal Privoznik <mprivozn@redhat.com>
> >>
> >> In virnetlink.c there are two sections: the first one when
> >> building WITH_LIBNL support, the other that provides stubs for
> >> functions declared in the corresponding header file when building
> >> without netlink support. But the stub implementation for
> >> virNetlinkBridgeVlanFilterSet() was missing.
> >>
> >> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> >> ---
> >>  src/util/virnetlink.c | 11 +++++++++++
> >>  1 file changed, 11 insertions(+)
> >>
> >> diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
> >> index 206646d9d7..2555457cd2 100644
> >> --- a/src/util/virnetlink.c
> >> +++ b/src/util/virnetlink.c
> >> @@ -1344,6 +1344,17 @@ virNetlinkNewLink(const char *ifname G_GNUC_UNUSED,
> >>  }
> >>  
> >>  
> >> +int
> >> +virNetlinkBridgeVlanFilterSet(const char *ifname G_GNUC_UNUSED,
> >> +                              int cmd G_GNUC_UNUSED,
> >> +                              const unsigned short fflags G_GNUC_UNUSED,
> > 
> > s/fflags/flags/
> 
> No, this needs to be anything else but 'flags' otherwise our
> sc_flags_usage syntax-check rule will complain. unusedflags perhaps?

Ah ... d'oh. I mentioned it just because some static analysis tool
complained about argument names differing between definition and
declaration;

Anyways 'unusedflags' would likely be preferrable.