Date: Tue, 14 Feb 2012 11:37:04 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r231670 - projects/multi-fibv6/head/contrib/netcat Message-ID: <201202141137.q1EBb4hQ096283@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Tue Feb 14 11:37:04 2012 New Revision: 231670 URL: http://svn.freebsd.org/changeset/base/231670 Log: Switch from setfib(2) moving the process to a different FIB to setsockopt(2) with SO_SETFIB to only tag the socket with the right FIB. That way either setfib(1) or nc -V can be used depending on what wants to be achieved. This also allows nc to be used for simple regression testing of either feature. Sponsored by: Cisco Systems, Inc. Modified: projects/multi-fibv6/head/contrib/netcat/netcat.c Modified: projects/multi-fibv6/head/contrib/netcat/netcat.c ============================================================================== --- projects/multi-fibv6/head/contrib/netcat/netcat.c Tue Feb 14 11:24:24 2012 (r231669) +++ projects/multi-fibv6/head/contrib/netcat/netcat.c Tue Feb 14 11:37:04 2012 (r231670) @@ -605,8 +605,10 @@ remote_connect(const char *host, const c #endif if (rtableid) { - if (setfib(rtableid) == -1) - err(1, "setfib"); + if (setsockopt(s, SOL_SOCKET, SO_SETFIB, &rtableid, + sizeof(rtableid)) == -1) + err(1, "setsockopt(.., SO_SETFIB, %u, ..)", + rtableid); } /* Bind to a local port or source address if specified. */ @@ -678,8 +680,11 @@ local_listen(char *host, char *port, str continue; if (rtableid) { - if (setfib(rtableid) == -1) - err(1, "setfib"); + ret = setsockopt(s, SOL_SOCKET, SO_SETFIB, &rtableid, + sizeof(rtableid)); + if (ret == -1) + err(1, "setsockopt(.., SO_SETFIB, %u, ..)", + rtableid); } ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202141137.q1EBb4hQ096283>