2 * Copyright (c) 2015, Facebook, Inc.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
10 #include <folly/wangle/acceptor/SocketOptions.h>
12 #include <netinet/tcp.h>
13 #include <sys/socket.h>
17 AsyncSocket::OptionMap filterIPSocketOptions(
18 const AsyncSocket::OptionMap& allOptions,
19 const int addrFamily) {
20 AsyncSocket::OptionMap opts;
22 if (addrFamily == AF_INET) {
23 exclude = IPPROTO_IPV6;
24 } else if (addrFamily == AF_INET6) {
27 LOG(FATAL) << "Address family " << addrFamily << " was not IPv4 or IPv6";
30 for (const auto& opt: allOptions) {
31 if (opt.first.level != exclude) {
32 opts[opt.first] = opt.second;