Page MenuHomeFreeBSD

loopback route needs RTF_PINNED flag
ClosedPublic

Authored by eugen_grosbein.net on Oct 20 2017, 8:57 PM.

Details

Summary

When IP address is being added to an interface, a kernel installs loopback route.

Such route to local address created with ifa_maintain_loopback_route() function in https://svnweb.freebsd.org/base/head/sys/net/if.c?annotate=323170#l1711 misess RTF_PINNED flag, so that it cannot override possibly existing route to that address added
by a routing daemon. EEXIST is returned in such case.

This error is then propagated back to userland ioctl SIOCAIFADD breaking
interface configuration sequence. See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223129
for real world example.

Test Plan
  1. Use 'route get' command to make sure that loopback routes miss PINNED flag.
  2. Apply the patch, rebuild and reinstall the kernel.
  3. Reboot the system then use 'route get' command again to check for PINNED flag set for loopback routes.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gnn accepted this revision.Nov 3 2017, 5:33 PM
This revision is now accepted and ready to land.Nov 3 2017, 5:33 PM

I suspect this will also address PR 222647.

This revision was automatically updated to reflect the committed changes.