+// SPDX-License-Identifier: GPL-2.0-or-later
/* Socket union related function.
* Copyright (c) 1997, 98 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
if (su->sa.sa_family == AF_INET6
&& IN6_IS_ADDR_V4MAPPED(&su->sin6.sin6_addr)) {
- memset(&sin, 0, sizeof(struct sockaddr_in));
+ memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = su->sin6.sin6_port;
memcpy(&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4);
ret = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof(on));
if (ret < 0) {
- flog_err(EC_LIB_SOCKET,
- "can't set sockopt SO_REUSEADDR to socket %d", sock);
+ flog_err(
+ EC_LIB_SOCKET,
+ "can't set sockopt SO_REUSEADDR to socket %d errno=%d: %s",
+ sock, errno, safe_strerror(errno));
return -1;
}
return 0;
return 0;
}
-/*
- * This function called setsockopt(.., TCP_CORK,...)
- * Which on linux is a no-op since it is enabled by
- * default and on BSD it uses TCP_NOPUSH to do
- * the same thing( which it was not configured to
- * use). This cleanup of the api occurred on 8/1/17
- * I imagine if after more than 1 year of no-one
- * complaining, and a major upgrade release we
- * can deprecate and remove this function call
- */
-int sockopt_cork(int sock, int onoff)
-{
- return 0;
-}
-
int sockopt_minttl(int family, int sock, int minttl)
{
#ifdef IP_MINTTL
sockunion_normalise_mapped(su);
return su;
}
+
+ flog_err(
+ EC_LIB_SOCKET,
+ "Unexpected AFI received(%d) for sockunion_getsockname call for fd: %d",
+ name.sa.sa_family, fd);
return NULL;
}
sockunion_normalise_mapped(su);
return su;
}
+
+ flog_err(
+ EC_LIB_SOCKET,
+ "Unexpected AFI received(%d) for sockunion_getpeername call for fd: %d",
+ name.sa.sa_family, fd);
return NULL;
}