iproute2: Add patches

This commit is contained in:
xtkoba 2021-11-22 00:54:57 +09:00 committed by Henrik Grimler
parent 51b3e0ac0c
commit 4d01d7a397
5 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,13 @@
--- iproute2-5.15.0/lib/utils.c.orig
+++ iproute2-5.15.0/lib/utils.c
@@ -513,6 +513,10 @@
return 1;
}
+#undef IN6_IS_ADDR_UNSPECIFIED
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+ (a[0] == 0 && a[1] == 0 && a[2] == 0 && a[3] == 0)
+
static void set_address_type(inet_prefix *addr)
{
switch (addr->family) {

View File

@ -0,0 +1,11 @@
--- iproute2-5.15.0/include/uapi/linux/in6.h.orig
+++ iproute2-5.15.0/include/uapi/linux/in6.h
@@ -25,6 +25,8 @@
#include <linux/types.h>
#include <linux/libc-compat.h>
+typedef uint32_t in_addr_t;
+
/*
* IPv6 address structure
*/

View File

@ -0,0 +1,31 @@
--- iproute2-5.15.0/tc/f_flower.c.orig
+++ iproute2-5.15.0/tc/f_flower.c
@@ -304,7 +304,7 @@
char *slash, *mask = NULL;
size_t slen, slen_mask = 0;
- slash = index(str, '/');
+ slash = strchr(str, '/');
if (slash) {
*slash = 0;
mask = slash + 1;
@@ -1087,7 +1087,7 @@
if (mask_len + strlen(token) > XATTR_SIZE_MAX)
return -1;
- data_len = strlen(rindex(token, ':'));
+ data_len = strlen(strrchr(token, ':'));
sprintf(&mask[mask_len], "ffff:ff:");
mask_len += 8;
memset(&mask[mask_len], 'f', data_len - 1);
--- iproute2-5.15.0/tc/m_ct.c.orig
+++ iproute2-5.15.0/tc/m_ct.c
@@ -163,7 +163,7 @@
char *slash, *mask = NULL;
size_t slen, slen_mask = 0;
- slash = index(str, '/');
+ slash = strchr(str, '/');
if (slash) {
*slash = 0;
mask = slash+1;

View File

@ -0,0 +1,28 @@
--- iproute2-5.15.0/lib/utils.c.orig
+++ iproute2-5.15.0/lib/utils.c
@@ -1047,6 +1047,11 @@
#define NHASH 257
static struct namerec *nht[NHASH];
+#if defined __ANDROID__ && __ANDROID_API__ < 28
+#undef sethostent
+#define sethostent(i) ((void)0)
+#endif
+
static const char *resolve_address(const void *addr, int len, int af)
{
struct namerec *n;
--- iproute2-5.15.0/misc/ss.c.orig
+++ iproute2-5.15.0/misc/ss.c
@@ -2029,6 +2029,11 @@
return cnt;
}
+#if defined __ANDROID__ && __ANDROID_API__ < 28
+#undef sethostent
+#define sethostent(i) ((void)0)
+#endif
+
static int get_dns_host(struct aafilter *a, const char *addr, int fam)
{
static int notfirst;

View File

@ -0,0 +1,24 @@
--- iproute2-5.15.0/ip/iplink_bond.c.orig
+++ iproute2-5.15.0/ip/iplink_bond.c
@@ -171,6 +171,9 @@
print_explain(stderr);
}
+#undef strdupa
+#define strdupa(s) strcpy(alloca(strlen(s) + 1), s)
+
static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
--- iproute2-5.15.0/lib/color.c.orig
+++ iproute2-5.15.0/lib/color.c
@@ -93,6 +93,9 @@
return false;
}
+#undef strdupa
+#define strdupa(s) strcpy(alloca(strlen(s) + 1), s)
+
bool matches_color(const char *arg, int *val)
{
char *dup, *p;