diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2012-02-14 11:37:04 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2012-02-14 11:37:04 +0000 |
commit | aaf04b7cb637af9400e6b9ae1bd531ef828a7c82 (patch) | |
tree | 467c90046a772dd028236d7492688187d2e6d10f /contrib | |
parent | 9836132cd1049b4c261fc131f720b1d17977ffa2 (diff) | |
download | src-aaf04b7cb637af9400e6b9ae1bd531ef828a7c82.tar.gz src-aaf04b7cb637af9400e6b9ae1bd531ef828a7c82.zip |
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.
Notes
Notes:
svn path=/projects/multi-fibv6/head/; revision=231670
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/netcat/netcat.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/contrib/netcat/netcat.c b/contrib/netcat/netcat.c index 9b9017d6e611..bee0fa6be2ce 100644 --- a/contrib/netcat/netcat.c +++ b/contrib/netcat/netcat.c @@ -605,8 +605,10 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) #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, struct addrinfo hints) 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)); |