]> The Tcpdump Group git mirrors - tcpdump/blobdiff - ospf.h
Use more the EXTRACT_U_1() macro (40/n)
[tcpdump] / ospf.h
diff --git a/ospf.h b/ospf.h
index 82803e3fe06029188db19f02079903b8d87117c8..9d0b4c46ba7572222673d559b46d8ec30a36f68b 100644 (file)
--- a/ospf.h
+++ b/ospf.h
@@ -1,4 +1,3 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.17 2005-08-23 11:07:34 hannes Exp $ (LBL) */
 /*
  * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
  *     The Regents of the University of California.  All rights reserved.
@@ -21,7 +20,6 @@
  *
  * OSPF support contributed by Jeffrey Honig ([email protected])
  */
-#define        OSPF_TYPE_UMD           0       /* UMd's special monitoring packets */
 #define        OSPF_TYPE_HELLO         1       /* Hello */
 #define        OSPF_TYPE_DD            2       /* Database Description */
 #define        OSPF_TYPE_LS_REQ        3       /* Link State Request */
 /* Options field
  *
  * +------------------------------------+
- * | * | O | DC | EA | N/P | MC | E | T |
+ * | DN | O | DC | L | N/P | MC | E | T |
  * +------------------------------------+
  *
  */
-                
+
 #define OSPF_OPTION_T  0x01    /* T bit: TOS support   */
 #define OSPF_OPTION_E  0x02    /* E bit: External routes advertised    */
 #define        OSPF_OPTION_MC  0x04    /* MC bit: Multicast capable */
 #define        OSPF_OPTION_NP  0x08    /* N/P bit: NSSA capable */
 #define        OSPF_OPTION_EA  0x10    /* EA bit: External Attribute capable */
+#define        OSPF_OPTION_L   0x10    /* L bit: Packet contains LLS data block */
 #define        OSPF_OPTION_DC  0x20    /* DC bit: Demand circuit capable */
 #define        OSPF_OPTION_O   0x40    /* O bit: Opaque LSA capable */
 #define        OSPF_OPTION_DN  0x80    /* DN bit: Up/Down Bit capable - draft-ietf-ospf-2547-dnbit-04 */
 /* ospf_authtype       */
 #define        OSPF_AUTH_NONE          0       /* No auth-data */
 #define        OSPF_AUTH_SIMPLE        1       /* Simple password */
+#define OSPF_AUTH_SIMPLE_LEN   8       /* max length of simple authentication */
 #define OSPF_AUTH_MD5          2       /* MD5 authentication */
 #define OSPF_AUTH_MD5_LEN      16      /* length of MD5 authentication */
 
 /* db_flags    */
-#define        OSPF_DB_INIT            0x04        /*  */
+#define        OSPF_DB_INIT            0x04
 #define        OSPF_DB_MORE            0x02
-#define        OSPF_DB_MASTER          0x01
+#define        OSPF_DB_MASTER          0x01
+#define OSPF_DB_RESYNC          0x08  /* RFC4811 */
 
 /* ls_type     */
 #define        LS_TYPE_ROUTER          1   /* router link */
 #define LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW            7 /* rfc3630 */
 #define LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW              8 /* rfc3630 */
 #define LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP           9 /* rfc3630 */
-#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* draft-ietf-ccamp-ospf-gmpls-extensions */
-#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE 14 /* draft-ietf-ccamp-ospf-gmpls-extensions */
-#define LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR    15 /* draft-ietf-ccamp-ospf-gmpls-extensions */
-#define LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP    16 /* draft-ietf-ccamp-ospf-gmpls-extensions */
+#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* rfc4203 */
+#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE 14 /* rfc4203 */
+#define LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR    15 /* rfc4203 */
+#define LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP    16 /* rfc4203 */
 #define LS_OPAQUE_TE_LINK_SUBTLV_BW_CONSTRAINTS       17 /* rfc4124 */
 
 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP        1  /* rfc3630 */
 
 #define LS_OPAQUE_RI_TLV_CAP             1 /* draft-ietf-ospf-cap-03 */
 
-/*************************************************
- *
- * is the above a bug in the documentation?
- *
- *************************************************/
-
 
 /* rla_link.link_type  */
 #define        RLA_TYPE_ROUTER         1   /* point-to-point to another router */
 #define        MCLA_VERTEX_ROUTER      1
 #define        MCLA_VERTEX_NETWORK     2
 
+/* Link-Local-Signaling */
+#define OSPF_LLS_HDRLEN         4U /* RFC5613 Section 2.2 */
+
+#define OSPF_LLS_EO             1  /* RFC4811, RFC4812 */
+#define OSPF_LLS_MD5            2  /* RFC4813 */
+
+#define OSPF_LLS_EO_LR         0x00000001              /* RFC4811 */
+#define OSPF_LLS_EO_RS         0x00000002              /* RFC4812 */
+
+/*
+ * TOS metric struct (will be 0 or more in router links update)
+ */
+struct tos_metric {
+    uint8_t tos_type;
+    uint8_t reserved;
+    uint8_t tos_metric[2];
+};
+struct tos_link {
+    uint8_t link_type;
+    uint8_t link_tos_count;
+    uint8_t tos_metric[2];
+};
+union un_tos {
+    struct tos_link link;
+    struct tos_metric metrics;
+};
+
 /* link state advertisement header */
 struct lsa_hdr {
-    u_int16_t ls_age;
-    u_int8_t ls_options;
-    u_int8_t ls_type;
+    uint16_t ls_age;
+    uint8_t ls_options;
+    uint8_t ls_type;
     union {
         struct in_addr lsa_id;
         struct { /* opaque LSAs change the LSA-ID field */
-            u_int8_t opaque_type;
-            u_int8_t opaque_id[3];
+            uint8_t opaque_type;
+            uint8_t opaque_id[3];
        } opaque_field;
     } un_lsa_id;
     struct in_addr ls_router;
-    u_int32_t ls_seq;
-    u_int16_t ls_chksum;
-    u_int16_t ls_length;
+    uint32_t ls_seq;
+    uint16_t ls_chksum;
+    uint16_t ls_length;
 };
 
 /* link state advertisement */
@@ -165,15 +187,13 @@ struct lsa {
     union {
        /* Router links advertisements */
        struct {
-           u_int8_t rla_flags;
-           u_int8_t rla_zero[1];
-           u_int16_t rla_count;
+           uint8_t rla_flags;
+           uint8_t rla_zero[1];
+           uint16_t rla_count;
            struct rlalink {
                struct in_addr link_id;
                struct in_addr link_data;
-               u_int8_t link_type;
-               u_int8_t link_toscount;
-               u_int16_t link_tos0metric;
+                union un_tos un_tos;
            } rla_link[1];              /* may repeat   */
        } un_rla;
 
@@ -186,14 +206,14 @@ struct lsa {
        /* Summary links advertisements */
        struct {
            struct in_addr sla_mask;
-           u_int32_t sla_tosmetric[1]; /* may repeat   */
+           uint32_t sla_tosmetric[1];  /* may repeat   */
        } un_sla;
 
        /* AS external links advertisements */
        struct {
            struct in_addr asla_mask;
            struct aslametric {
-               u_int32_t asla_tosmetric;
+               uint32_t asla_tosmetric;
                struct in_addr asla_forward;
                struct in_addr asla_tag;
            } asla_metric[1];           /* may repeat   */
@@ -201,72 +221,62 @@ struct lsa {
 
        /* Multicast group membership */
        struct mcla {
-           u_int32_t mcla_vtype;
+           uint32_t mcla_vtype;
            struct in_addr mcla_vid;
        } un_mcla[1];
 
         /* Opaque TE LSA */
         struct {
-           u_int16_t type;
-           u_int16_t length;
-           u_int8_t data[1]; /* may repeat   */
+           uint16_t type;
+           uint16_t length;
+           uint8_t data[1]; /* may repeat   */
        } un_te_lsa_tlv;
 
         /* Opaque Grace LSA */
         struct {
-           u_int16_t type;
-           u_int16_t length;
-           u_int8_t data[1]; /* may repeat   */
+           uint16_t type;
+           uint16_t length;
+           uint8_t data[1]; /* may repeat   */
        } un_grace_tlv;
 
         /* Opaque Router information LSA */
         struct {
-           u_int16_t type;
-           u_int16_t length;
-           u_int8_t data[1]; /* may repeat   */
+           uint16_t type;
+           uint16_t length;
+           uint8_t data[1]; /* may repeat   */
        } un_ri_tlv;
 
         /* Unknown LSA */
         struct unknown {
-           u_int8_t data[1]; /* may repeat   */
+           uint8_t data[1]; /* may repeat   */
        } un_unknown[1];
 
     } lsa_un;
 };
 
-
-/*
- * TOS metric struct (will be 0 or more in router links update)
- */
-struct tos_metric {
-    u_int8_t tos_type;
-    u_int8_t tos_zero;
-    u_int16_t tos_metric;
-};
-
 #define        OSPF_AUTH_SIZE  8
 
 /*
  * the main header
  */
 struct ospfhdr {
-    u_int8_t ospf_version;
-    u_int8_t ospf_type;
-    u_int16_t ospf_len;
+    uint8_t ospf_version;
+    uint8_t ospf_type;
+    uint16_t ospf_len;
     struct in_addr ospf_routerid;
     struct in_addr ospf_areaid;
-    u_int16_t ospf_chksum;
-    u_int16_t ospf_authtype;
-    u_int8_t ospf_authdata[OSPF_AUTH_SIZE];
+    uint16_t ospf_chksum;
+    uint16_t ospf_authtype;
+    uint8_t ospf_authdata[OSPF_AUTH_SIZE];
     union {
 
        /* Hello packet */
        struct {
            struct in_addr hello_mask;
-           u_int16_t hello_helloint;
-           u_int8_t hello_options;
-           u_int8_t hello_priority;
-           u_int32_t hello_deadint;
+           uint16_t hello_helloint;
+           uint8_t hello_options;
+           uint8_t hello_priority;
+           uint32_t hello_deadint;
            struct in_addr hello_dr;
            struct in_addr hello_bdr;
            struct in_addr hello_neighbor[1]; /* may repeat     */
@@ -274,21 +284,21 @@ struct ospfhdr {
 
        /* Database Description packet */
        struct {
-           u_int8_t db_zero[2];
-           u_int8_t db_options;
-           u_int8_t db_flags;
-           u_int32_t db_seq;
+           uint16_t db_ifmtu;
+           uint8_t db_options;
+           uint8_t db_flags;
+           uint32_t db_seq;
            struct lsa_hdr db_lshdr[1]; /* may repeat   */
        } un_db;
 
        /* Link State Request */
        struct lsr {
-           u_int8_t ls_type[4];
+           uint8_t ls_type[4];
             union {
                 struct in_addr ls_stateid;
                 struct { /* opaque LSAs change the LSA-ID field */
-                    u_int8_t opaque_type;
-                    u_int8_t opaque_id[3];
+                    uint8_t opaque_type;
+                    uint8_t opaque_id[3];
                 } opaque_field;
             } un_ls_stateid;
            struct in_addr ls_router;
@@ -296,7 +306,7 @@ struct ospfhdr {
 
        /* Link State Update */
        struct {
-           u_int32_t lsu_count;
+           uint32_t lsu_count;
            struct lsa lsu_lsa[1]; /* may repeat        */
        } un_lsu;
 
@@ -312,4 +322,3 @@ struct ospfhdr {
 #define        ospf_lsr        ospf_un.un_lsr
 #define        ospf_lsu        ospf_un.un_lsu
 #define        ospf_lsa        ospf_un.un_lsa
-