From fda07ec40401b719c7b316d244294a68d4e59684 Mon Sep 17 00:00:00 2001 From: Hongjun Ni Date: Fri, 29 Sep 2017 01:03:31 +0800 Subject: Add NSH TTL support Change-Id: Id2f8236cc997d08c53217fc92881b8bbf2c2f429 Signed-off-by: Hongjun Ni --- nsh-plugin/nsh/nsh_packet.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'nsh-plugin/nsh/nsh_packet.h') diff --git a/nsh-plugin/nsh/nsh_packet.h b/nsh-plugin/nsh/nsh_packet.h index 101652a..9d6237a 100644 --- a/nsh-plugin/nsh/nsh_packet.h +++ b/nsh-plugin/nsh/nsh_packet.h @@ -22,7 +22,7 @@ * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * |Ver|O|C|R|R|R|R|R|R| Length | MD Type | Next Protocol | + * |Ver|O|C| TTL | Length | MD Type | Next Protocol | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * @@ -69,8 +69,8 @@ */ typedef CLIB_PACKED(struct { - u8 ver_o_c; - u8 length; + u8 ver_o_c; //TTL: high 4 bit + u8 length; //TTL: low 2 bit u8 md_type; u8 next_protocol; u32 nsp_nsi; // nsp 24 bits, nsi 8 bits @@ -104,6 +104,10 @@ typedef CLIB_PACKED(struct { #define NSH_O_BIT (1<<5) #define NSH_C_BIT (1<<4) +#define NSH_TTL_H4_MASK 0xF +#define NSH_TTL_L2_MASK 0xC0 +#define NSH_LEN_MASK 0x3F + /* Network byte order shift / mask */ #define NSH_NSI_MASK 0xFF #define NSH_NSP_MASK (0x00FFFFFF) -- cgit 1.2.3-korg