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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Mar 2021 16:35:56 +0000 (17:35 +0100)
commitc80504c2b0cfcb8443247a7d87651625e6b65efc
tree14bb66055412ac23d0f29aff9d1018140cc46d85
parent31d29f21f80feef38bc568cdd3f08397209eef5f
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 )

(cherry picked from commit f8f5b8d864d3d034dbbfb84fdad4f2cbeb7790f9)
src/resolve/resolved-varlink.c