cilium, daemon: fix device detection for default route
cilium, daemon: fix device detection for default route

I noticed on one of my test machines that the agent refuses to start up
when IPv6 and NodePort gets enabled:

  [...]
  level=info msg=" - !:pod-template-generation" subsys=labels-filter
  level=info msg=" - !:pod-template-hash" subsys=labels-filter
  level=info msg=" - !:controller-revision-hash" subsys=labels-filter
  level=info msg=" - !:annotation.*" subsys=labels-filter
  level=info msg=" - !:etcd_node" subsys=labels-filter
  level=info msg="Auto-enabling host reachable services for UDP and TCP as required by BPF NodePort." subsys=daemon
  level=fatal msg="BPF NodePort's external facing device could not be determined. Use --device to specify." error="Found (2) default routes" subsys=daemon
  #

Turns out in case of IPv6 the machine had the same route but different
MTU metric:

  # ip -6 r | grep default
  default via fe80::9a9b:cbff:fe05:1eae dev eno1 proto ra metric 100 mtu 1492 pref medium
  default via fe80::9a9b:cbff:fe05:1eae dev eno1 proto ra metric 1024 pref medium
  # ip -4 r | grep default
  default via 192.168.178.1 dev eno1 proto dhcp src 192.168.178.28 metric 100

Fix the detection to walk and check all ifindices wrt whether they are
equal, and if that is the case then proceed normally.

Signed-off-by: Daniel Borkmann <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@iogearbox.net>

michi-covalent/cilium,cilium/cilium,tklauser/cilium,tgraf/cilium,michi-covalent/cilium,tklauser/cilium,cilium-team/cilium,cilium/cilium,cilium/cilium,tgraf/cilium,tklauser/cilium,tklauser/cilium,tklauser/cilium,cilium/cilium,tgraf/cilium,tgraf/cilium,michi-covalent/cilium,cilium/cilium,tgraf/cilium,tgraf/cilium,cilium-team/cilium,michi-covalent/cilium,michi-covalent/cilium