Use UNALIGNED_OK to disable unaligned pointer arithmetic checks in UBSan
Upstream fixed it differently by refactoring the code and the problem will go away on upgrade to 5.0.
This commit is contained in:
parent
d8be380674
commit
a8e08e9489
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-ah.c,v 1.6 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-ah.c,v 1.7 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: IPSEC Authentication Header printer */
|
||||
|
@ -39,6 +39,7 @@ __RCSID("$NetBSD: print-ah.c,v 1.6 2017/02/05 04:05:05 spz Exp $");
|
|||
#include "netdissect.h"
|
||||
#include "extract.h"
|
||||
|
||||
UNALIGNED_OK
|
||||
int
|
||||
ah_print(netdissect_options *ndo, register const u_char *bp)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-bgp.c,v 1.10 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-bgp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Border Gateway Protocol (BGP) printer */
|
||||
|
@ -921,6 +921,7 @@ static const struct tok bgp_multicast_vpn_route_type_values[] = {
|
|||
{ 0, NULL}
|
||||
};
|
||||
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
decode_multicast_vpn(netdissect_options *ndo,
|
||||
const u_char *pptr, char *buf, u_int buflen)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-esp.c,v 1.10 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-esp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: IPSEC Encapsulating Security Payload (ESP) printer */
|
||||
|
@ -654,6 +654,7 @@ void esp_print_decodesecret(netdissect_options *ndo)
|
|||
|
||||
#endif
|
||||
|
||||
UNALIGNED_OK
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
USES_APPLE_DEPRECATED_API
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-icmp.c,v 1.10 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-icmp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Internet Control Message Protocol (ICMP) printer */
|
||||
|
@ -331,6 +331,7 @@ icmp_tstamp_print(u_int tstamp)
|
|||
return buf;
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *bp2,
|
||||
int fragmented)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-icmp6.c,v 1.12 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-icmp6.c,v 1.13 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: IPv6 Internet Control Message Protocol (ICMPv6) printer */
|
||||
|
@ -818,6 +818,7 @@ tooshort:
|
|||
return;
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
rpl_print(netdissect_options *ndo,
|
||||
const struct icmp6_hdr *hdr,
|
||||
|
@ -876,6 +877,7 @@ trunc:
|
|||
}
|
||||
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
icmp6_print(netdissect_options *ndo,
|
||||
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
|
||||
|
@ -1403,6 +1405,7 @@ trunc:
|
|||
#undef ECHECK
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
mld6_print(netdissect_options *ndo, const u_char *bp)
|
||||
{
|
||||
|
@ -1419,6 +1422,7 @@ mld6_print(netdissect_options *ndo, const u_char *bp)
|
|||
ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr)));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
|
||||
{
|
||||
|
@ -1477,6 +1481,7 @@ trunc:
|
|||
return;
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-igmp.c,v 1.7 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-igmp.c,v 1.8 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Internet Group Management Protocol (IGMP) printer */
|
||||
|
@ -107,6 +107,7 @@ static const struct tok igmpv3report2str[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
print_mtrace(netdissect_options *ndo,
|
||||
register const u_char *bp, register u_int len)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-m3ua.c,v 1.5 2017/09/08 14:01:13 christos Exp $");
|
||||
__RCSID("$NetBSD: print-m3ua.c,v 1.6 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Message Transfer Part 3 (MTP3) User Adaptation Layer (M3UA) printer */
|
||||
|
@ -301,6 +301,7 @@ trunc:
|
|||
* \ \
|
||||
* / /
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
void
|
||||
m3ua_print(netdissect_options *ndo,
|
||||
const u_char *buf, const u_int size)
|
||||
|
@ -341,4 +342,3 @@ invalid:
|
|||
trunc:
|
||||
ND_PRINT((ndo, "%s", tstr));
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-msnlb.c,v 1.3 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-msnlb.c,v 1.4 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: MS Network Load Balancing's (NLB) heartbeat printer */
|
||||
|
@ -52,6 +52,7 @@ struct msnlb_heartbeat_pkt {
|
|||
/* the protocol is undocumented so we ignore the rest */
|
||||
};
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
msnlb_print(netdissect_options *ndo, const u_char *bp)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-nfs.c,v 1.9 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-nfs.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Network File System (NFS) printer */
|
||||
|
@ -354,6 +354,7 @@ trunc:
|
|||
ND_PRINT((ndo, "%s", tstr));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
nfsreply_print_noaddr(netdissect_options *ndo,
|
||||
register const u_char *bp, u_int length,
|
||||
|
@ -419,6 +420,7 @@ trunc:
|
|||
* Return a pointer to the first file handle in the packet.
|
||||
* If the packet was truncated, return 0.
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
static const uint32_t *
|
||||
parsereq(netdissect_options *ndo,
|
||||
register const struct sunrpc_msg *rp, register u_int length)
|
||||
|
@ -522,6 +524,7 @@ parsefhn(netdissect_options *ndo,
|
|||
return (parsefn(ndo, dp));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
nfsreq_print_noaddr(netdissect_options *ndo,
|
||||
register const u_char *bp, u_int length,
|
||||
|
@ -867,6 +870,7 @@ static struct xid_map_entry xid_map[XIDMAPSIZE];
|
|||
static int xid_map_next = 0;
|
||||
static int xid_map_hint = 0;
|
||||
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
xid_map_enter(netdissect_options *ndo,
|
||||
const struct sunrpc_msg *rp, const u_char *bp)
|
||||
|
@ -913,6 +917,7 @@ xid_map_enter(netdissect_options *ndo,
|
|||
* Returns 0 and puts NFSPROC_xxx in proc return and
|
||||
* version in vers return, or returns -1 on failure
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc,
|
||||
uint32_t *vers)
|
||||
|
@ -977,6 +982,7 @@ xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc,
|
|||
* Return a pointer to the beginning of the actual results.
|
||||
* If the packet was truncated, return 0.
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
static const uint32_t *
|
||||
parserep(netdissect_options *ndo,
|
||||
register const struct sunrpc_msg *rp, register u_int length)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-ntp.c,v 1.7 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-ntp.c,v 1.8 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -205,6 +205,7 @@ static const struct tok ntp_stratum_values[] = {
|
|||
/*
|
||||
* Print ntp requests
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
void
|
||||
ntp_print(netdissect_options *ndo,
|
||||
register const u_char *cp, u_int length)
|
||||
|
@ -429,4 +430,3 @@ p_ntp_delta(netdissect_options *ndo,
|
|||
f = (uint32_t)(ff * 1000000000.0); /* treat fraction as parts per billion */
|
||||
ND_PRINT((ndo, "%s%d.%09d", signbit ? "-" : "+", i, f));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-ospf6.c,v 1.9 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-ospf6.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: IPv6 Open Shortest Path First (OSPFv3) printer */
|
||||
|
@ -388,6 +388,7 @@ ospf6_print_ls_type(netdissect_options *ndo,
|
|||
ipaddr_string(ndo, ls_stateid)));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
ospf6_print_lshdr(netdissect_options *ndo,
|
||||
register const struct lsa6_hdr *lshp, const u_char *dataend)
|
||||
|
@ -450,6 +451,7 @@ trunc:
|
|||
/*
|
||||
* Print a single link state advertisement. If truncated return 1, else 0.
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
ospf6_print_lsa(netdissect_options *ndo,
|
||||
register const struct lsa6 *lsap, const u_char *dataend)
|
||||
|
@ -724,6 +726,7 @@ trunc:
|
|||
return (1);
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
ospf6_decode_v3(netdissect_options *ndo,
|
||||
register const struct ospf6hdr *op,
|
||||
|
@ -929,6 +932,7 @@ trunc:
|
|||
* AT data may be present in Hello and DBDesc packets with the AT-bit set or in
|
||||
* any other packet type, thus decode the AT data regardless of the AT-bit.
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
static int
|
||||
ospf6_decode_v3_trailer(netdissect_options *ndo,
|
||||
const struct ospf6hdr *op, const u_char *cp, const unsigned len)
|
||||
|
@ -956,6 +960,7 @@ trunc:
|
|||
return 1;
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
ospf6_print(netdissect_options *ndo,
|
||||
register const u_char *bp, register u_int length)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-pgm.c,v 1.9 2017/09/08 14:01:13 christos Exp $");
|
||||
__RCSID("$NetBSD: print-pgm.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Pragmatic General Multicast (PGM) printer */
|
||||
|
@ -147,6 +147,7 @@ typedef enum _pgm_type {
|
|||
|
||||
#define PGM_MIN_OPT_LEN 4
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
pgm_print(netdissect_options *ndo,
|
||||
register const u_char *bp, register u_int length,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-rip.c,v 1.7 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-rip.c,v 1.8 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Routing Information Protocol (RIP) printer */
|
||||
|
@ -98,6 +98,7 @@ struct rip_netinfo {
|
|||
uint32_t rip_metric; /* cost of route */
|
||||
};
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
rip_entry_print_v1(netdissect_options *ndo,
|
||||
register const struct rip_netinfo *ni)
|
||||
|
@ -129,6 +130,7 @@ rip_entry_print_v1(netdissect_options *ndo,
|
|||
EXTRACT_32BITS(&ni->rip_metric)));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static unsigned
|
||||
rip_entry_print_v2(netdissect_options *ndo,
|
||||
register const struct rip_netinfo *ni, const unsigned remaining)
|
||||
|
@ -274,5 +276,3 @@ rip_print(netdissect_options *ndo,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-ripng.c,v 1.7 2017/09/08 14:01:13 christos Exp $");
|
||||
__RCSID("$NetBSD: print-ripng.c,v 1.8 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: IPv6 Routing Information Protocol (RIPng) printer */
|
||||
|
@ -110,6 +110,7 @@ rip6_entry_print(netdissect_options *ndo, register const struct netinfo6 *ni, in
|
|||
return l;
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-sctp.c,v 1.8 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-sctp.c,v 1.9 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Stream Control Transmission Protocol (SCTP) printer */
|
||||
|
@ -495,6 +495,7 @@ static inline int isForCES_port(u_short Port)
|
|||
return 0;
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void sctp_print(netdissect_options *ndo,
|
||||
const u_char *bp, /* beginning of sctp packet */
|
||||
const u_char *bp2, /* beginning of enclosing */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-tcp.c,v 1.9 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-tcp.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -156,6 +156,7 @@ tcp6_cksum(netdissect_options *ndo,
|
|||
IPPROTO_TCP);
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
tcp_print(netdissect_options *ndo,
|
||||
register const u_char *bp, register u_int length,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-timed.c,v 1.6 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-timed.c,v 1.7 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: BSD time daemon protocol printer */
|
||||
|
@ -99,6 +99,7 @@ static const char *tsptype[TSPTYPENUMBER] =
|
|||
"DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
|
||||
"TEST", "SETDATE", "SETDATEREQ", "LOOP" };
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
timed_print(netdissect_options *ndo,
|
||||
register const u_char *bp)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-tipc.c,v 1.3 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-tipc.c,v 1.4 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: Transparent Inter-Process Communication (TIPC) protocol printer */
|
||||
|
@ -225,6 +225,7 @@ trunc:
|
|||
ND_PRINT((ndo, "%s", tstr));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
static void
|
||||
print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap)
|
||||
{
|
||||
|
@ -339,6 +340,7 @@ trunc:
|
|||
ND_PRINT((ndo, "%s", tstr));
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_,
|
||||
u_int caplen _U_)
|
||||
|
@ -387,4 +389,3 @@ trunc:
|
|||
* c-style: bsd
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-udp.c,v 1.8 2017/02/05 04:05:05 spz Exp $");
|
||||
__RCSID("$NetBSD: print-udp.c,v 1.9 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: UDP printer */
|
||||
|
@ -371,6 +371,7 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo
|
|||
}
|
||||
}
|
||||
|
||||
UNALIGNED_OK
|
||||
void
|
||||
udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
|
||||
register const u_char *bp2, int fragmented)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print-wb.c,v 1.9 2019/10/01 16:06:16 christos Exp $");
|
||||
__RCSID("$NetBSD: print-wb.c,v 1.10 2020/02/24 18:39:47 kamil Exp $");
|
||||
#endif
|
||||
|
||||
/* \summary: White Board printer */
|
||||
|
@ -399,6 +399,7 @@ wb_drawop(netdissect_options *ndo,
|
|||
/*
|
||||
* Print whiteboard multicast packets.
|
||||
*/
|
||||
UNALIGNED_OK
|
||||
void
|
||||
wb_print(netdissect_options *ndo,
|
||||
register const void *hdr, register u_int len)
|
||||
|
|
Loading…
Reference in New Issue