summaryrefslogtreecommitdiff
path: root/print-lisp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-10-06 09:41:01 -0700
committerGuy Harris <guy@alum.mit.edu>2015-10-06 09:41:01 -0700
commit1376682ba5650750600966ba910774ba26973b92 (patch)
tree06132413e391f9431629e02b0da21d99c6f959f6 /print-lisp.c
parentd7d269e8c67b6e8262db27bb92ae524aa3c3f439 (diff)
downloadtcpdump-1376682ba5650750600966ba910774ba26973b92.tar.gz
Introduce data types to use for integral values in packet structures.
They are defined as arrays of bytes, so 1) no padding is inserted before them to put them on natural boundaries, so they can be used if the values *aren't* so aligned; 2) you have to use EXTRACT_ macros with them - which you should be doing *anyway*, to avoid explicitly or implicitly making assumptions about byte order or alignment safety on the platform for which your code is being built (it'd better work when built for little-endian x86 or for big-endian *and* strict-alignment-requiring SPARC). Use them in the LISP (no, not the programming language!) dissector; UNALIGNED means "this structure is not guaranteed to be aligned as a whole, so don't generate code that assumes it is", not "this structure's individual members shouldn't have padding to put them on natural boundaries", so it's not sufficient to do that. (Using these types *might* suffice to ensure that code that assumes alignment not be generated, but never underestimate SPARC compilers' eagerness to use single load and store instructions to fetch big-endian 16-bit, 32-bit, and 64-bit values from packets that really aren't guaranteed to be aligned.)
Diffstat (limited to 'print-lisp.c')
-rw-r--r--print-lisp.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/print-lisp.c b/print-lisp.c
index 6b5b8151..d8a03195 100644
--- a/print-lisp.c
+++ b/print-lisp.c
@@ -186,38 +186,38 @@ static const struct tok lisp_loc_flag[] = {
};
typedef struct map_register_hdr {
- uint8_t type_and_flag;
- uint8_t reserved;
- uint8_t reserved_and_flag2;
- uint8_t record_count;
- uint64_t nonce;
- uint16_t key_id;
- uint16_t auth_data_len;
-} UNALIGNED lisp_map_register_hdr;
+ nd_uint8_t type_and_flag;
+ nd_uint8_t reserved;
+ nd_uint8_t reserved_and_flag2;
+ nd_uint8_t record_count;
+ nd_uint64_t nonce;
+ nd_uint16_t key_id;
+ nd_uint16_t auth_data_len;
+} lisp_map_register_hdr;
#define MAP_REGISTER_HDR_LEN sizeof(lisp_map_register_hdr)
typedef struct map_register_eid {
- uint32_t ttl;
- uint8_t locator_count;
- uint8_t eid_prefix_mask_length;
- uint8_t act_auth_inc_res;
- uint8_t reserved;
- uint8_t reserved_version_hi;
- uint8_t version_low;
- uint16_t eid_prefix_afi;
-} UNALIGNED lisp_map_register_eid;
+ nd_uint32_t ttl;
+ nd_uint8_t locator_count;
+ nd_uint8_t eid_prefix_mask_length;
+ nd_uint8_t act_auth_inc_res;
+ nd_uint8_t reserved;
+ nd_uint8_t reserved_version_hi;
+ nd_uint8_t version_low;
+ nd_uint16_t eid_prefix_afi;
+} lisp_map_register_eid;
#define MAP_REGISTER_EID_LEN sizeof(lisp_map_register_eid)
typedef struct map_register_loc {
- uint8_t priority;
- uint8_t weight;
- uint8_t m_priority;
- uint8_t m_weight;
- uint16_t unused_and_flag;
- uint16_t locator_afi;
-} UNALIGNED lisp_map_register_loc;
+ nd_uint8_t priority;
+ nd_uint8_t weight;
+ nd_uint8_t m_priority;
+ nd_uint8_t m_weight;
+ nd_uint16_t unused_and_flag;
+ nd_uint16_t locator_afi;
+} lisp_map_register_loc;
#define MAP_REGISTER_LOC_LEN sizeof(lisp_map_register_loc)