Currently we have only undocumented ability to set different FIB number for packets that tunneling interfaces encapsulate. It can be done on interface cloning with setfib(1):
# setfib 1 ifconfig gre0 create
To change FIB number we should recreate interface. And it seems there is no way to determine the configured value.
This patch add SIOCGTUNFIB and SIOCSTUNFIB ioctls to get and set FIB number via ifconfig(8). Also it add support of these ioctls to gre(4), gif(4) and me(4) interfaces.
Also there are two similar fixes for gre(4) and me(4) - use if_fib value from ifnet structure to set FIB number for incoming packets.