basic: Add our own <netinet/in.h> and <net/if.h> headers

These glibc headers conflicts with the corresponding linux headers
(<linux/in.h> and <linux/if.h>) and impose an include order (the glibc one
has to be included before any linux header is included). This makes sorting
includes a royal pain so let's define our own versions of these headers using
various linux headers to do all the work and filling in the missing bits
ourselves.
This commit is contained in:
Daan De Meyer
2025-04-30 07:50:03 +02:00
parent 3a03b97d6f
commit d559f46384
5 changed files with 44 additions and 11 deletions
+9
View File
@@ -0,0 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/if.h>
#define IF_NAMESIZE 16
extern unsigned int if_nametoindex(const char *__ifname) __THROW;
extern char *if_indextoname(unsigned int __ifindex, char __ifname[IF_NAMESIZE]) __THROW;
+19
View File
@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/ipv6.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/socket.h>
#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
extern const struct in6_addr in6addr_any; /* :: */
extern const struct in6_addr in6addr_loopback; /* ::1 */
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
typedef uint32_t in_addr_t;