Skip to content

Commit 9d9485d

Browse files
authored
Merge pull request #18860 from opensourcerouting/build-config-h-20250521
build: the great war against `config.h`, issue 0 of ∞
2 parents 19d25c3 + e7c6e86 commit 9d9485d

17 files changed

+87
-358
lines changed

bgpd/bgp_bmp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,8 +2645,7 @@ static void bmp_active_connect(struct bmp_active *ba)
26452645
}
26462646

26472647

2648-
res = sockunion_connect(ba->socket, &ba->addrs[ba->addrpos],
2649-
htons(ba->port), 0);
2648+
res = sockunion_connect(ba->socket, &ba->addrs[ba->addrpos], htons(ba->port));
26502649
switch (res) {
26512650
case connect_error:
26522651
zlog_warn("bmp[%s]: failed to connect to %pSU:%d",

bgpd/bgp_network.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@ enum connect_result bgp_connect(struct peer_connection *connection)
793793

794794
assert(!CHECK_FLAG(connection->thread_flags, PEER_THREAD_WRITES_ON));
795795
assert(!CHECK_FLAG(connection->thread_flags, PEER_THREAD_READS_ON));
796-
ifindex_t ifindex = 0;
797796

798797
if (peer->bgp->router_id.s_addr == INADDR_ANY) {
799798
peer->last_reset = PEER_DOWN_ROUTER_ID_ZERO;
@@ -880,19 +879,14 @@ enum connect_result bgp_connect(struct peer_connection *connection)
880879
return connect_error;
881880
}
882881

883-
if (peer->conf_if || peer->ifname)
884-
ifindex = ifname2ifindex(peer->conf_if ? peer->conf_if
885-
: peer->ifname,
886-
peer->bgp->vrf_id);
887-
888882
if (bgp_debug_neighbor_events(peer))
889883
zlog_debug("%s [Event] Connect start to %s fd %d", peer->host,
890884
peer->host, connection->fd);
891885

892886
/* Connect to the remote peer. */
893887
enum connect_result res;
894888

895-
res = sockunion_connect(connection->fd, &connection->su, htons(peer->port), ifindex);
889+
res = sockunion_connect(connection->fd, &connection->su, htons(peer->port));
896890

897891
if (connection->su_remote)
898892
sockunion_free(connection->su_remote);

bgpd/bgp_zebra.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -911,18 +911,6 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote,
911911
if (shared_network_original != peer->shared_network)
912912
bgp_peer_bfd_update_source(peer);
913913

914-
/* KAME stack specific treatment. */
915-
#ifdef KAME
916-
if (IN6_IS_ADDR_LINKLOCAL(&nexthop->v6_global)
917-
&& IN6_LINKLOCAL_IFINDEX(nexthop->v6_global)) {
918-
SET_IN6_LINKLOCAL_IFINDEX(nexthop->v6_global, 0);
919-
}
920-
if (IN6_IS_ADDR_LINKLOCAL(&nexthop->v6_local)
921-
&& IN6_LINKLOCAL_IFINDEX(nexthop->v6_local)) {
922-
SET_IN6_LINKLOCAL_IFINDEX(nexthop->v6_local, 0);
923-
}
924-
#endif /* KAME */
925-
926914
/* If we have identified the local interface, there is no error for now.
927915
*/
928916
return v6_ll_avail;

configure.ac

Lines changed: 34 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,14 +1130,15 @@ dnl -------------------------
11301130
dnl Check other header files.
11311131
dnl -------------------------
11321132
AC_CHECK_HEADERS([stropts.h sys/ksym.h \
1133-
linux/version.h asm/types.h endian.h sys/endian.h])
1133+
linux/version.h asm/types.h sys/endian.h])
1134+
1135+
AC_CHECK_HEADER([endian.h], [], [
1136+
AC_MSG_ERROR([missing endian.h])
1137+
])
11341138

11351139
AC_CHECK_LIB([atomic], [main], [LIBS="$LIBS -latomic"], [], [])
11361140

1137-
ac_stdatomic_ok=false
1138-
AC_DEFINE([FRR_AUTOCONF_ATOMIC], [1], [did autoconf checks for atomic funcs])
11391141
AC_CHECK_HEADER([stdatomic.h],[
1140-
11411142
AC_MSG_CHECKING([whether _Atomic qualifier works])
11421143
AC_LINK_IFELSE([AC_LANG_SOURCE([[
11431144
#include <stdatomic.h>
@@ -1151,52 +1152,7 @@ int main(int argc, char **argv) {
11511152
ac_stdatomic_ok=true
11521153
], [
11531154
AC_MSG_RESULT([no])
1154-
])
1155-
])
1156-
1157-
AS_IF([$ac_stdatomic_ok], [true], [
1158-
AC_MSG_CHECKING([for __atomic_* builtins])
1159-
AC_LINK_IFELSE([AC_LANG_SOURCE([[
1160-
int main(int argc, char **argv) {
1161-
volatile int i = 1;
1162-
__atomic_store_n (&i, 0, __ATOMIC_RELEASE);
1163-
return __atomic_load_n (&i, __ATOMIC_ACQUIRE);
1164-
}
1165-
]])], [
1166-
AC_DEFINE([HAVE___ATOMIC], [1], [found __atomic builtins])
1167-
AC_MSG_RESULT([yes])
1168-
], [
1169-
AC_MSG_RESULT([no])
1170-
1171-
dnl FreeBSD 9 has a broken stdatomic.h where _Atomic doesn't work
1172-
AC_MSG_CHECKING([for __sync_* builtins])
1173-
AC_LINK_IFELSE([AC_LANG_SOURCE([[
1174-
int main(int argc, char **argv) {
1175-
volatile int i = 1;
1176-
__sync_fetch_and_sub (&i, 1);
1177-
return __sync_val_compare_and_swap (&i, 0, 1);
1178-
}
1179-
]])], [
1180-
AC_DEFINE([HAVE___SYNC], [1], [found __sync builtins])
1181-
AC_MSG_RESULT([yes])
1182-
1183-
AC_MSG_CHECKING([for __sync_swap builtin])
1184-
AC_LINK_IFELSE([AC_LANG_SOURCE([[
1185-
int main(int argc, char **argv) {
1186-
volatile int i = 1;
1187-
return __sync_swap (&i, 2);
1188-
}
1189-
]])], [
1190-
AC_DEFINE([HAVE___SYNC_SWAP], 1, [found __sync_swap builtin])
1191-
AC_MSG_RESULT([yes])
1192-
], [
1193-
AC_MSG_RESULT([no])
1194-
])
1195-
1196-
], [
1197-
AC_MSG_RESULT([no])
1198-
AC_MSG_FAILURE([stdatomic.h unavailable and $CC has neither __atomic nor __sync builtins])
1199-
])
1155+
AC_MSG_ERROR([building FRR requires an ISO C11 compliant compiler with atomics support])
12001156
])
12011157
])
12021158

@@ -1310,7 +1266,7 @@ FRR_INCLUDES
13101266

13111267
AC_CHECK_HEADERS([netinet/in_var.h \
13121268
net/if_dl.h net/netopt.h \
1313-
inet/nd.h netinet/ip_icmp.h \
1269+
netinet/ip_icmp.h \
13141270
sys/sysctl.h sys/sockio.h sys/conf.h],
13151271
[], [], [FRR_INCLUDES])
13161272

@@ -1348,9 +1304,6 @@ FRR_INCLUDES
13481304
# include <net/netopt.h>
13491305
#endif
13501306
#include <net/route.h>
1351-
#ifdef HAVE_INET_ND_H
1352-
# include <inet/nd.h>
1353-
#endif
13541307
#include <arpa/inet.h>
13551308
/* Required for IDRP */
13561309
#ifdef HAVE_NETINET_IP_ICMP_H
@@ -1387,14 +1340,12 @@ case "$host_os" in
13871340
AC_MSG_RESULT([OpenBSD])
13881341

13891342
AC_DEFINE([OPEN_BSD], [1], [OpenBSD])
1390-
AC_DEFINE([KAME], [1], [KAME IPv6])
13911343
AC_DEFINE([BSD_V6_SYSCTL], [1], [BSD v6 sysctl to turn on and off forwarding])
13921344
;;
13931345
*)
13941346
AC_MSG_RESULT([BSD])
13951347

13961348
AC_DEFINE([HAVE_NET_RT_IFLIST], [1], [NET_RT_IFLIST])
1397-
AC_DEFINE([KAME], [1], [KAME IPv6])
13981349
AC_DEFINE([BSD_V6_SYSCTL], [1], [BSD v6 sysctl to turn on and off forwarding])
13991350
;;
14001351
esac
@@ -1430,6 +1381,32 @@ AC_CHECK_FUNCS([ \
14301381
explicit_bzero \
14311382
])
14321383

1384+
dnl note the trailing _ in the following macros; this is neccessary since
1385+
dnl otherwise autoheader *replaces* the #define with the block...
1386+
dnl
1387+
dnl yes this might include stddef.h 3 times but who cares
1388+
1389+
AH_VERBATIM(HAVE_STRLCAT_, [
1390+
#ifndef HAVE_STRLCAT
1391+
#include <stddef.h>
1392+
size_t strlcat(char *__restrict dest,
1393+
const char *__restrict src, size_t destsize);
1394+
#endif
1395+
])
1396+
AH_VERBATIM(HAVE_STRLCPY_, [
1397+
#ifndef HAVE_STRLCPY
1398+
#include <stddef.h>
1399+
size_t strlcpy(char *__restrict dest,
1400+
const char *__restrict src, size_t destsize);
1401+
#endif
1402+
])
1403+
AH_VERBATIM(HAVE_EXPLICIT_BZERO_, [
1404+
#ifndef HAVE_EXPLICIT_BZERO
1405+
#include <stddef.h>
1406+
void explicit_bzero(void *buf, size_t len);
1407+
#endif
1408+
])
1409+
14331410
AC_CHECK_MEMBERS([struct mmsghdr.msg_hdr], [], [], FRR_INCLUDES)
14341411

14351412
dnl ##########################################################################
@@ -2359,7 +2336,7 @@ dnl ---------------------------
23592336
dnl IRDP/pktinfo/icmphdr checks
23602337
dnl ---------------------------
23612338

2362-
AC_CHECK_TYPES([struct in_pktinfo], [
2339+
AC_CHECK_TYPE([struct in_pktinfo], [
23632340
AC_CHECK_TYPES([struct icmphdr], [
23642341
IRDP=true
23652342
], [
@@ -2474,9 +2451,7 @@ AC_CHECK_DECLS([be32enc, be32dec], [], [], [
24742451
#ifdef HAVE_SYS_ENDIAN_H
24752452
#include <sys/endian.h>
24762453
#endif
2477-
#ifdef HAVE_ENDIAN_H
24782454
#include <endian.h>
2479-
#endif
24802455
])
24812456

24822457
dnl --------------------------------------

lib/command.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
#include <sys/stat.h>
1515
#include <fcntl.h>
1616

17+
#ifndef HAVE_LIBCRYPT
18+
#ifdef HAVE_LIBCRYPTO
19+
#include <openssl/des.h>
20+
#define crypt DES_crypt
21+
#endif
22+
#endif
23+
1724
#include <lib/version.h>
1825

1926
#include "command.h"

0 commit comments

Comments
 (0)