Sun May 30 21:01:43 2021 UTC ()
Minimal change to suppress unaligned access errors on NetBSD/alpha; add
the UNALIGNED decoration to struct icmp.

PR bin/56199.


(thorpej)
diff -r1.11 -r1.12 src/external/bsd/tcpdump/dist/print-icmp.c

cvs diff -r1.11 -r1.12 src/external/bsd/tcpdump/dist/print-icmp.c (expand / switch to unified diff)

--- src/external/bsd/tcpdump/dist/print-icmp.c 2020/02/24 18:39:47 1.11
+++ src/external/bsd/tcpdump/dist/print-icmp.c 2021/05/30 21:01:43 1.12
@@ -11,27 +11,27 @@ @@ -11,27 +11,27 @@
11 * features or use of this software display the following acknowledgement: 11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California, 12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse 14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior 15 * or promote products derived from this software without specific prior
16 * written permission. 16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */ 20 */
21 21
22#include <sys/cdefs.h> 22#include <sys/cdefs.h>
23#ifndef lint 23#ifndef lint
24__RCSID("$NetBSD: print-icmp.c,v 1.11 2020/02/24 18:39:47 kamil Exp $"); 24__RCSID("$NetBSD: print-icmp.c,v 1.12 2021/05/30 21:01:43 thorpej Exp $");
25#endif 25#endif
26 26
27/* \summary: Internet Control Message Protocol (ICMP) printer */ 27/* \summary: Internet Control Message Protocol (ICMP) printer */
28 28
29#ifdef HAVE_CONFIG_H 29#ifdef HAVE_CONFIG_H
30#include "config.h" 30#include "config.h"
31#endif 31#endif
32 32
33#include <netdissect-stdinc.h> 33#include <netdissect-stdinc.h>
34 34
35#include <stdio.h> 35#include <stdio.h>
36#include <string.h> 36#include <string.h>
37 37
@@ -79,27 +79,27 @@ struct icmp { @@ -79,27 +79,27 @@ struct icmp {
79 struct id_ip { 79 struct id_ip {
80 struct ip idi_ip; 80 struct ip idi_ip;
81 /* options and then 64 bits of data */ 81 /* options and then 64 bits of data */
82 } id_ip; 82 } id_ip;
83 uint32_t id_mask; 83 uint32_t id_mask;
84 uint8_t id_data[1]; 84 uint8_t id_data[1];
85 } icmp_dun; 85 } icmp_dun;
86#define icmp_otime icmp_dun.id_ts.its_otime 86#define icmp_otime icmp_dun.id_ts.its_otime
87#define icmp_rtime icmp_dun.id_ts.its_rtime 87#define icmp_rtime icmp_dun.id_ts.its_rtime
88#define icmp_ttime icmp_dun.id_ts.its_ttime 88#define icmp_ttime icmp_dun.id_ts.its_ttime
89#define icmp_ip icmp_dun.id_ip.idi_ip 89#define icmp_ip icmp_dun.id_ip.idi_ip
90#define icmp_mask icmp_dun.id_mask 90#define icmp_mask icmp_dun.id_mask
91#define icmp_data icmp_dun.id_data 91#define icmp_data icmp_dun.id_data
92}; 92} UNALIGNED;
93 93
94#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4) 94#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
95#define ICMP_MPLS_EXT_VERSION 2 95#define ICMP_MPLS_EXT_VERSION 2
96 96
97/* 97/*
98 * Lower bounds on packet lengths for various types. 98 * Lower bounds on packet lengths for various types.
99 * For the error advice packets must first insure that the 99 * For the error advice packets must first insure that the
100 * packet is large enought to contain the returned ip header. 100 * packet is large enought to contain the returned ip header.
101 * Only then can we do the check to see if 64 bits of packet 101 * Only then can we do the check to see if 64 bits of packet
102 * data have been returned, since we need to check the returned 102 * data have been returned, since we need to check the returned
103 * ip header length. 103 * ip header length.
104 */ 104 */
105#define ICMP_MINLEN 8 /* abs minimum */ 105#define ICMP_MINLEN 8 /* abs minimum */