X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/f555c163f90c9de17ebcef8313f86404c5174ca9..fb8b947488c7f22b518de1df1a91e663dc7ab33c:/ospf.h diff --git a/ospf.h b/ospf.h index eee79441..67ea363b 100644 --- a/ospf.h +++ b/ospf.h @@ -1,3 +1,4 @@ +/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.13 2004-01-27 13:33:24 hannes Exp $ (LBL) */ /* * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997 * The Regents of the University of California. All rights reserved. @@ -20,25 +21,34 @@ * * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu) */ -#define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */ -#define OSPF_TYPE_HELLO 1 /* Hello */ -#define OSPF_TYPE_DB 2 /* Database Description */ -#define OSPF_TYPE_LSR 3 /* Link State Request */ -#define OSPF_TYPE_LSU 4 /* Link State Update */ -#define OSPF_TYPE_LSA 5 /* Link State Ack */ -#define OSPF_TYPE_MAX 6 - -/* Options *_options */ +#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 */ +#define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */ +#define OSPF_TYPE_LS_ACK 5 /* Link State Ack */ + +/* Options field + * + * +------------------------------------+ + * | * | O | DC | EA | 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_DC 0x20 /* DC bit: Demand circuit capable */ +#define OSPF_OPTION_O 0x40 /* O bit: Opaque LSA capable */ /* ospf_authtype */ #define OSPF_AUTH_NONE 0 /* No auth-data */ #define OSPF_AUTH_SIMPLE 1 /* Simple password */ #define OSPF_AUTH_MD5 2 /* MD5 authentication */ -#define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */ - +#define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */ /* db_flags */ #define OSPF_DB_INIT 0x04 /* */ @@ -53,7 +63,43 @@ #define LS_TYPE_ASE 5 /* ASE */ #define LS_TYPE_GROUP 6 /* Group membership (multicast */ /* extensions 23 July 1991) */ -#define LS_TYPE_MAX 7 +#define LS_TYPE_NSSA 7 /* rfc1587 - Not so Stubby Areas */ +#define LS_TYPE_OPAQUE_LL 9 /* rfc2370 - Opaque Link Local */ +#define LS_TYPE_OPAQUE_AL 10 /* rfc2370 - Opaque Link Local */ +#define LS_TYPE_OPAQUE_DW 11 /* rfc2370 - Opaque Domain Wide */ + +#define LS_OPAQUE_TYPE_TE 1 /* rfc3630 */ +#define LS_OPAQUE_TYPE_GRACE 3 /* rfc3623 */ + +#define LS_OPAQUE_TE_TLV_ROUTER 1 /* rfc3630 */ +#define LS_OPAQUE_TE_TLV_LINK 2 /* rfc3630 */ + +#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE 1 /* rfc3630 */ +#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID 2 /* rfc3630 */ +#define LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP 3 /* rfc3630 */ +#define LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP 4 /* rfc3630 */ +#define LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC 5 /* rfc3630 */ +#define LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW 6 /* rfc3630 */ +#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_DIFFSERV_TE 17 /* draft-ietf-tewg-diff-te-proto-06 */ + +#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP 1 /* rfc3630 */ +#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */ + +#define LS_OPAQUE_GRACE_TLV_PERIOD 1 /* rfc3623 */ +#define LS_OPAQUE_GRACE_TLV_REASON 2 /* rfc3623 */ +#define LS_OPAQUE_GRACE_TLV_INT_ADDRESS 3 /* rfc3623 */ + +#define LS_OPAQUE_GRACE_TLV_REASON_UNKNOWN 0 /* rfc3623 */ +#define LS_OPAQUE_GRACE_TLV_REASON_SW_RESTART 1 /* rfc3623 */ +#define LS_OPAQUE_GRACE_TLV_REASON_SW_UPGRADE 2 /* rfc3623 */ +#define LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH 3 /* rfc3623 */ /************************************************* * @@ -91,15 +137,21 @@ /* link state advertisement header */ struct lsa_hdr { - u_short ls_age; - u_char ls_options; - u_char ls_type; - struct in_addr ls_stateid; + u_int16_t ls_age; + u_int8_t ls_options; + u_int8_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]; + } opaque_field; + } un_lsa_id; struct in_addr ls_router; u_int32_t ls_seq; - u_short ls_chksum; - u_short ls_length; -} ; + u_int16_t ls_chksum; + u_int16_t ls_length; +}; /* link state advertisement */ struct lsa { @@ -109,15 +161,15 @@ struct lsa { union { /* Router links advertisements */ struct { - u_char rla_flags; - u_char rla_zero[1]; - u_short rla_count; + u_int8_t rla_flags; + u_int8_t rla_zero[1]; + u_int16_t rla_count; struct rlalink { struct in_addr link_id; struct in_addr link_data; - u_char link_type; - u_char link_toscount; - u_short link_tos0metric; + u_int8_t link_type; + u_int8_t link_toscount; + u_int16_t link_tos0metric; } rla_link[1]; /* may repeat */ } un_rla; @@ -148,18 +200,38 @@ struct lsa { u_int32_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 */ + } un_te_lsa_tlv; + + /* Grace LSA */ + struct { + u_int16_t type; + u_int16_t length; + u_int8_t data[1]; /* may repeat */ + } un_grace_tlv; + + /* Unknown LSA */ + struct unknown { + u_int8_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_char tos_type; - u_char tos_zero; - u_short tos_metric; -} ; + u_int8_t tos_type; + u_int8_t tos_zero; + u_int16_t tos_metric; +}; #define OSPF_AUTH_SIZE 8 @@ -167,22 +239,22 @@ struct tos_metric { * the main header */ struct ospfhdr { - u_char ospf_version; - u_char ospf_type; - u_short ospf_len; + u_int8_t ospf_version; + u_int8_t ospf_type; + u_int16_t ospf_len; struct in_addr ospf_routerid; struct in_addr ospf_areaid; - u_short ospf_chksum; - u_short ospf_authtype; - u_char ospf_authdata[OSPF_AUTH_SIZE]; + u_int16_t ospf_chksum; + u_int16_t ospf_authtype; + u_int8_t ospf_authdata[OSPF_AUTH_SIZE]; union { /* Hello packet */ struct { struct in_addr hello_mask; - u_short hello_helloint; - u_char hello_options; - u_char hello_priority; + u_int16_t hello_helloint; + u_int8_t hello_options; + u_int8_t hello_priority; u_int32_t hello_deadint; struct in_addr hello_dr; struct in_addr hello_bdr; @@ -191,17 +263,23 @@ struct ospfhdr { /* Database Description packet */ struct { - u_char db_zero[2]; - u_char db_options; - u_char db_flags; + u_int8_t db_zero[2]; + u_int8_t db_options; + u_int8_t db_flags; u_int32_t db_seq; struct lsa_hdr db_lshdr[1]; /* may repeat */ } un_db; /* Link State Request */ struct lsr { - u_int32_t ls_type; - struct in_addr ls_stateid; + u_int8_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]; + } opaque_field; + } un_ls_stateid; struct in_addr ls_router; } un_lsr[1]; /* may repeat */ @@ -216,7 +294,7 @@ struct ospfhdr { struct lsa_hdr lsa_lshdr[1]; /* may repeat */ } un_lsa ; } ospf_un ; -} ; +}; #define ospf_hello ospf_un.un_hello #define ospf_db ospf_un.un_db