resolved: suppress ifindex info in varlink JSON responses if zero
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Feb 2021 17:43:55 +0000 (18:43 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Feb 2021 23:17:10 +0000 (00:17 +0100)
commitf8f5b8d864d3d034dbbfb84fdad4f2cbeb7790f9
tree2d1fb04da785e039e7d931cae19f8b731e1eaa96
parent9c09454dcee06283fc429ffef9f14ac354074f5f
resolved: suppress ifindex info in varlink JSON responses if zero

If we don't have ifindex info, don't set the field for it.

We already do that for parsed IP address replies, let's do it for all
cases: it's a bit nicer to suppress the ifindex prop if it doesn't apply
than to pass it invalid.

This is the other side of #18482, i.e. fixes things so that the parser
doesn't get tripped up by this.

(This too makes a problem go away we should track down properly, i.e.
figure out how the ifindex got lost in
https://github.com/systemd/systemd/pull/17823#issuecomment-742439422 )
src/resolve/resolved-varlink.c