From eccfe69a5c486bfc7d7877d66d98e928c2191351 Mon Sep 17 00:00:00 2001 From: "Andrey V. Elsukov" Date: Tue, 12 May 2015 07:37:27 +0000 Subject: Add new socket ioctls SIOC[SG]TUNFIB to set FIB number of encapsulated packets on tunnel interfaces. Add support of these ioctls to gre(4), gif(4) and me(4) interfaces. For incoming packets M_SETFIB() should use if_fib value from ifnet structure, use proper value in gre(4) and me(4). Differential Revision: https://reviews.freebsd.org/D2462 No objection from: #network MFC after: 2 weeks Sponsored by: Yandex LLC --- sys/net/if_gif.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sys/net/if_gif.c') diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index cbcb50f7c61b..48a842a9dd93 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -920,6 +920,17 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif } break; + case SIOCGTUNFIB: + ifr->ifr_fib = sc->gif_fibnum; + break; + case SIOCSTUNFIB: + if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0) + break; + if (ifr->ifr_fib >= rt_numfibs) + error = EINVAL; + else + sc->gif_fibnum = ifr->ifr_fib; + break; case GIFGOPTS: options = sc->gif_options; error = copyout(&options, ifr->ifr_data, sizeof(options)); @@ -935,7 +946,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) else sc->gif_options = options; break; - default: error = EINVAL; break; -- cgit v1.2.3