Added member fields for reserved bits and bytes in all payloads
authorMartin Willi <martin@revosec.ch>
Wed, 24 Nov 2010 15:34:16 +0000 (16:34 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 5 Jan 2011 15:45:51 +0000 (16:45 +0100)
19 files changed:
src/libcharon/encoding/payloads/auth_payload.c
src/libcharon/encoding/payloads/auth_payload.h
src/libcharon/encoding/payloads/cert_payload.c
src/libcharon/encoding/payloads/certreq_payload.c
src/libcharon/encoding/payloads/configuration_attribute.c
src/libcharon/encoding/payloads/cp_payload.c
src/libcharon/encoding/payloads/delete_payload.c
src/libcharon/encoding/payloads/eap_payload.c
src/libcharon/encoding/payloads/id_payload.c
src/libcharon/encoding/payloads/ike_header.c
src/libcharon/encoding/payloads/ke_payload.c
src/libcharon/encoding/payloads/nonce_payload.c
src/libcharon/encoding/payloads/notify_payload.c
src/libcharon/encoding/payloads/proposal_substructure.c
src/libcharon/encoding/payloads/sa_payload.c
src/libcharon/encoding/payloads/transform_substructure.c
src/libcharon/encoding/payloads/ts_payload.c
src/libcharon/encoding/payloads/unknown_payload.c
src/libcharon/encoding/payloads/vendor_id_payload.c

index 9086f2f..cb44a99 100644 (file)
@@ -43,6 +43,16 @@ struct private_auth_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved_bit[7];
+
+       /**
+        * Reserved bytes
+        */
+       u_int8_t reserved_byte[3];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -66,25 +76,25 @@ struct private_auth_payload_t {
  */
 encoding_rule_t auth_payload_encodings[] = {
        /* 1 Byte next payload type, stored in the field next_payload */
-       { U_INT_8,                      offsetof(private_auth_payload_t, next_payload)  },
+       { U_INT_8,                      offsetof(private_auth_payload_t, next_payload)          },
        /* the critical bit */
-       { FLAG,                         offsetof(private_auth_payload_t, critical)              },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
+       { FLAG,                         offsetof(private_auth_payload_t, critical)                      },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[0])       },
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[1])       },
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[2])       },
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[3])       },
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[4])       },
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[5])       },
+       { RESERVED_BIT,         offsetof(private_auth_payload_t, reserved_bit[6])       },
        /* Length of the whole payload*/
-       { PAYLOAD_LENGTH,       offsetof(private_auth_payload_t, payload_length)},
+       { PAYLOAD_LENGTH,       offsetof(private_auth_payload_t, payload_length)        },
        /* 1 Byte AUTH type*/
-       { U_INT_8,                      offsetof(private_auth_payload_t, auth_method)   },
+       { U_INT_8,                      offsetof(private_auth_payload_t, auth_method)           },
        /* 3 reserved bytes */
-       { RESERVED_BYTE,        0                                                                                               },
-       { RESERVED_BYTE,        0                                                                                               },
-       { RESERVED_BYTE,        0                                                                                               },
+       { RESERVED_BYTE,        offsetof(private_auth_payload_t, reserved_byte[0])      },
+       { RESERVED_BYTE,        offsetof(private_auth_payload_t, reserved_byte[1])      },
+       { RESERVED_BYTE,        offsetof(private_auth_payload_t, reserved_byte[2])      },
        /* some auth data bytes, length is defined in PAYLOAD_LENGTH */
        { AUTH_DATA,            offsetof(private_auth_payload_t, auth_data)     }
 };
index e2b8298..e4c4e6a 100644 (file)
@@ -74,6 +74,21 @@ struct auth_payload_t {
        chunk_t (*get_data) (auth_payload_t *this);
 
        /**
+        * Get the value of a reserved bit.
+        *
+        * @param nr                    number of the reserved bit, 0-6
+        * @return                              TRUE if bit was set, FALSE to clear
+        */
+       bool (*get_reserved_bit)(auth_payload_t *this, u_int nr);
+
+       /**
+        * Set one of the reserved bits.
+        *
+        * @param nr                    number of the reserved bit, 0-6
+        */
+       void (*set_reserved_bit)(auth_payload_t *this, u_int nr);
+
+       /**
         * Destroys an auth_payload_t object.
         */
        void (*destroy) (auth_payload_t *this);
index 6b96d2e..814ec27 100644 (file)
@@ -63,6 +63,11 @@ struct private_cert_payload_t {
        bool critical;
 
        /**
+        * reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -96,13 +101,13 @@ encoding_rule_t cert_payload_encodings[] = {
        /* the critical bit */
        { FLAG,                         offsetof(private_cert_payload_t, critical)              },
        /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[0])   },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[1])   },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[2])   },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[3])   },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[4])   },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[5])   },
+       { RESERVED_BIT,         offsetof(private_cert_payload_t, reserved[6])   },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_cert_payload_t, payload_length)},
        /* 1 Byte CERT type*/
index aa135ed..8e0836f 100644 (file)
@@ -46,6 +46,11 @@ struct private_certreq_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -72,14 +77,14 @@ encoding_rule_t certreq_payload_encodings[] = {
        { U_INT_8,                      offsetof(private_certreq_payload_t, next_payload)       },
        /* the critical bit */
        { FLAG,                         offsetof(private_certreq_payload_t, critical)           },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[0])        },
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[1])        },
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[2])        },
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[3])        },
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[4])        },
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[5])        },
+       { RESERVED_BIT,         offsetof(private_certreq_payload_t, reserved[6])        },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_certreq_payload_t, payload_length)     },
        /* 1 Byte CERTREQ type*/
index 4857c45..e608497 100644 (file)
@@ -36,6 +36,11 @@ struct private_configuration_attribute_t {
        configuration_attribute_t public;
 
        /**
+        * Reserved bit
+        */
+       bool reserved;
+
+       /**
         * Type of the attribute.
         */
        u_int16_t type;
@@ -58,8 +63,8 @@ struct private_configuration_attribute_t {
  * private_configuration_attribute_t.
  */
 encoding_rule_t configuration_attribute_encodings[] = {
-
-       { RESERVED_BIT,                                         0                                                                                                       },
+       /* 1 reserved bit */
+       { RESERVED_BIT,                                         offsetof(private_configuration_attribute_t, reserved)},
        /* type of the attribute as 15 bit unsigned integer */
        { ATTRIBUTE_TYPE,                                       offsetof(private_configuration_attribute_t, type)       },
        /* Length of attribute value */
index 1c03262..82e9e51 100644 (file)
@@ -52,6 +52,16 @@ struct private_cp_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved_bit[7];
+
+       /**
+        * Reserved bytes
+        */
+       u_int8_t reserved_byte[3];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -78,22 +88,23 @@ encoding_rule_t cp_payload_encodings[] = {
        { U_INT_8,                                      offsetof(private_cp_payload_t, next_payload)    },
        /* the critical bit */
        { FLAG,                                         offsetof(private_cp_payload_t, critical)                },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,                         0                                                                                               },
-       { RESERVED_BIT,                         0                                                                                               },
-       { RESERVED_BIT,                         0                                                                                               },
-       { RESERVED_BIT,                         0                                                                                               },
-       { RESERVED_BIT,                         0                                                                                               },
-       { RESERVED_BIT,                         0                                                                                               },
-       { RESERVED_BIT,                         0                                                                                               },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[0]) },
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[1]) },
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[2]) },
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[3]) },
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[4]) },
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[5]) },
+       { RESERVED_BIT,                         offsetof(private_cp_payload_t, reserved_bit[6]) },
        /* Length of the whole CP payload*/
        { PAYLOAD_LENGTH,                       offsetof(private_cp_payload_t, payload_length)  },
        /* Proposals are stored in a proposal substructure,
           offset points to a linked_list_t pointer */
        { U_INT_8,                                      offsetof(private_cp_payload_t, type)                    },
-       { RESERVED_BYTE,0                                                                                                                       },
-       { RESERVED_BYTE,0                                                                                                                       },
-       { RESERVED_BYTE,0                                                                                                                       },
+       /* 3 reserved bytes */
+       { RESERVED_BYTE,                        offsetof(private_cp_payload_t, reserved_byte[0])},
+       { RESERVED_BYTE,                        offsetof(private_cp_payload_t, reserved_byte[1])},
+       { RESERVED_BYTE,                        offsetof(private_cp_payload_t, reserved_byte[2])},
        { CONFIGURATION_ATTRIBUTES,     offsetof(private_cp_payload_t, attributes)              }
 };
 
index 5fc3b7c..e6ee07d 100644 (file)
@@ -43,6 +43,11 @@ struct private_delete_payload_t {
        bool critical;
 
        /**
+        * reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -79,14 +84,14 @@ encoding_rule_t delete_payload_encodings[] = {
        { U_INT_8,                      offsetof(private_delete_payload_t, next_payload)        },
        /* the critical bit */
        { FLAG,                         offsetof(private_delete_payload_t, critical)            },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[0])         },
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[1])         },
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[2])         },
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[3])         },
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[4])         },
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[5])         },
+       { RESERVED_BIT,         offsetof(private_delete_payload_t, reserved[6])         },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_delete_payload_t, payload_length)      },
        { U_INT_8,                      offsetof(private_delete_payload_t, protocol_id)         },
index 21f34a6..eafb668 100644 (file)
@@ -43,6 +43,11 @@ struct private_eap_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -66,13 +71,13 @@ static encoding_rule_t eap_payload_encodings[] = {
        /* the critical bit */
        { FLAG,                         offsetof(private_eap_payload_t, critical)               },
        /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT, 0                                                                                                       },
-       { RESERVED_BIT, 0                                                                                                       },
-       { RESERVED_BIT, 0                                                                                                       },
-       { RESERVED_BIT, 0                                                                                                       },
-       { RESERVED_BIT, 0                                                                                                       },
-       { RESERVED_BIT, 0                                                                                                       },
-       { RESERVED_BIT, 0                                                                                                       },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[0])    },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[1])    },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[2])    },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[3])    },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[4])    },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[5])    },
+       { RESERVED_BIT,         offsetof(private_eap_payload_t, reserved[6])    },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_eap_payload_t, payload_length) },
        /* chunt to data, starting at "code" */
index e4ca88e..3befadf 100644 (file)
@@ -52,6 +52,16 @@ struct private_id_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved_bit[7];
+
+       /**
+        * Reserved bytes
+        */
+       u_int8_t reserved_byte[3];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -78,22 +88,22 @@ encoding_rule_t id_payload_encodings[] = {
        { U_INT_8,                      offsetof(private_id_payload_t, next_payload)    },
        /* the critical bit */
        { FLAG,                         offsetof(private_id_payload_t, critical)                },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[0]) },
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[1]) },
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[2]) },
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[3]) },
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[4]) },
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[5]) },
+       { RESERVED_BIT,         offsetof(private_id_payload_t, reserved_bit[6]) },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_id_payload_t, payload_length)  },
        /* 1 Byte ID type*/
        { U_INT_8,                      offsetof(private_id_payload_t, id_type)                 },
        /* 3 reserved bytes */
-       { RESERVED_BYTE,        0                                                                                               },
-       { RESERVED_BYTE,        0                                                                                               },
-       { RESERVED_BYTE,        0                                                                                               },
+       { RESERVED_BYTE,        offsetof(private_id_payload_t, reserved_byte[0])},
+       { RESERVED_BYTE,        offsetof(private_id_payload_t, reserved_byte[1])},
+       { RESERVED_BYTE,        offsetof(private_id_payload_t, reserved_byte[2])},
        /* some id data bytes, length is defined in PAYLOAD_LENGTH */
        { ID_DATA,                      offsetof(private_id_payload_t, id_data)                 }
 };
index 9c1bbbe..d061bd2 100644 (file)
@@ -84,6 +84,11 @@ struct private_ike_header_t {
        } flags;
 
        /**
+        * Reserved bits of IKE header
+        */
+       bool reserved[5];
+
+       /**
         * Associated Message-ID.
         */
        u_int32_t message_id;
@@ -128,17 +133,17 @@ encoding_rule_t ike_header_encodings[] = {
        { U_INT_4,              offsetof(private_ike_header_t, min_version)             },
        /* 8 Bit for the exchange type */
        { U_INT_8,              offsetof(private_ike_header_t, exchange_type)   },
-       /* 2 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT, 0                                                                                               },
-       { RESERVED_BIT, 0                                                                                               },
+       /* 2 Bit reserved bits */
+       { RESERVED_BIT, offsetof(private_ike_header_t, reserved[0])             },
+       { RESERVED_BIT, offsetof(private_ike_header_t, reserved[1])             },
        /* 3 Bit flags, stored in the fields response, version and initiator */
        { FLAG,                 offsetof(private_ike_header_t, flags.response)  },
        { FLAG,                 offsetof(private_ike_header_t, flags.version)   },
        { FLAG,                 offsetof(private_ike_header_t, flags.initiator) },
-       /* 3 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT, 0                                                                                               },
-       { RESERVED_BIT, 0                                                                                               },
-       { RESERVED_BIT, 0                                                                                               },
+       /* 3 Bit reserved bits */
+       { RESERVED_BIT, offsetof(private_ike_header_t, reserved[2])             },
+       { RESERVED_BIT, offsetof(private_ike_header_t, reserved[3])             },
+       { RESERVED_BIT, offsetof(private_ike_header_t, reserved[4])             },
        /* 4 Byte message id, stored in the field message_id */
        { U_INT_32,             offsetof(private_ike_header_t, message_id)              },
        /* 4 Byte length fied, stored in the field length */
index ddea0b3..999d731 100644 (file)
@@ -44,6 +44,16 @@ struct private_ke_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved_bit[7];
+
+       /**
+        * Reserved bytes
+        */
+       u_int8_t reserved_byte[2];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -70,20 +80,21 @@ encoding_rule_t ke_payload_encodings[] = {
        { U_INT_8,                              offsetof(private_ke_payload_t, next_payload)    },
        /* the critical bit */
        { FLAG,                                 offsetof(private_ke_payload_t, critical)                },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,                 0                                                                                               },
-       { RESERVED_BIT,                 0                                                                                               },
-       { RESERVED_BIT,                 0                                                                                               },
-       { RESERVED_BIT,                 0                                                                                               },
-       { RESERVED_BIT,                 0                                                                                               },
-       { RESERVED_BIT,                 0                                                                                               },
-       { RESERVED_BIT,                 0                                                                                               },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[0]) },
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[1]) },
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[2]) },
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[3]) },
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[4]) },
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[5]) },
+       { RESERVED_BIT,                 offsetof(private_ke_payload_t, reserved_bit[6]) },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,               offsetof(private_ke_payload_t, payload_length)  },
        /* DH Group number as 16 bit field*/
        { U_INT_16,                             offsetof(private_ke_payload_t, dh_group_number) },
-       { RESERVED_BYTE,                0                                                                                               },
-       { RESERVED_BYTE,                0                                                                                               },
+       /* 2 reserved bytes */
+       { RESERVED_BYTE,                offsetof(private_ke_payload_t, reserved_byte[0])},
+       { RESERVED_BYTE,                offsetof(private_ke_payload_t, reserved_byte[1])},
        /* Key Exchange Data is from variable size */
        { KEY_EXCHANGE_DATA,    offsetof(private_ke_payload_t, key_exchange_data)}
 };
index 0d582fa..78000b8 100644 (file)
@@ -44,6 +44,11 @@ struct private_nonce_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -65,14 +70,14 @@ encoding_rule_t nonce_payload_encodings[] = {
        { U_INT_8,                      offsetof(private_nonce_payload_t, next_payload)         },
        /* the critical bit */
        { FLAG,                         offsetof(private_nonce_payload_t, critical)                     },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[0])          },
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[1])          },
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[2])          },
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[3])          },
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[4])          },
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[5])          },
+       { RESERVED_BIT,         offsetof(private_nonce_payload_t, reserved[6])          },
        /* Length of the whole nonce payload*/
        { PAYLOAD_LENGTH,       offsetof(private_nonce_payload_t, payload_length)       },
        /* some nonce bytes, lenth is defined in PAYLOAD_LENGTH */
index d1c2ac5..77f15ec 100644 (file)
@@ -206,6 +206,11 @@ struct private_notify_payload_t {
        bool critical;
 
        /**
+        * reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -248,13 +253,13 @@ encoding_rule_t notify_payload_encodings[] = {
        /* the critical bit */
        { FLAG,                         offsetof(private_notify_payload_t, critical)                    },
        /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
-       { RESERVED_BIT,         0                                                                                                               },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[0])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[1])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[2])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[3])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[4])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[5])                 },
+       { RESERVED_BIT,         offsetof(private_notify_payload_t, reserved[6])                 },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_notify_payload_t, payload_length)              },
        /* Protocol ID as 8 bit field*/
index 0fcfee7..7d73bec 100644 (file)
@@ -47,6 +47,11 @@ struct private_proposal_substructure_t {
        u_int8_t  next_payload;
 
        /**
+        * reserved byte
+        */
+       u_int8_t reserved;
+
+       /**
         * Length of this payload.
         */
        u_int16_t proposal_length;
@@ -91,8 +96,8 @@ struct private_proposal_substructure_t {
 encoding_rule_t proposal_substructure_encodings[] = {
        /* 1 Byte next payload type, stored in the field next_payload */
        { U_INT_8,                      offsetof(private_proposal_substructure_t, next_payload)         },
-       /* Reserved Byte is skipped */
-       { RESERVED_BYTE,        0                                                                                                                       },
+       /* 1 Reserved Byte */
+       { RESERVED_BYTE,        offsetof(private_proposal_substructure_t, reserved)                     },
        /* Length of the whole proposal substructure payload*/
        { PAYLOAD_LENGTH,       offsetof(private_proposal_substructure_t, proposal_length)      },
        /* proposal number is a number of 8 bit */
index 08ecba8..8667e7a 100644 (file)
@@ -46,6 +46,11 @@ struct private_sa_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -68,13 +73,13 @@ encoding_rule_t sa_payload_encodings[] = {
        /* the critical bit */
        { FLAG,                         offsetof(private_sa_payload_t, critical)                        },
        /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[0])                     },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[1])                     },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[2])                     },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[3])                     },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[4])                     },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[5])                     },
+       { RESERVED_BIT,         offsetof(private_sa_payload_t, reserved[6])                     },
        /* Length of the whole SA payload*/
        { PAYLOAD_LENGTH,       offsetof(private_sa_payload_t, payload_length)          },
        /* Proposals are stored in a proposal substructure,
index 63e31e5..0428da7 100644 (file)
@@ -41,6 +41,10 @@ struct private_transform_substructure_t {
         * Next payload type.
         */
        u_int8_t  next_payload;
+       /**
+        * Reserved bytes
+        */
+       u_int8_t reserved[2];
 
        /**
         * Length of this payload.
@@ -72,14 +76,14 @@ struct private_transform_substructure_t {
 encoding_rule_t transform_substructure_encodings[] = {
        /* 1 Byte next payload type, stored in the field next_payload */
        { U_INT_8,                              offsetof(private_transform_substructure_t, next_payload)        },
-       /* Reserved Byte is skipped */
-       { RESERVED_BYTE,                0                                                                                                                       },
+       /* 1 Reserved Byte */
+       { RESERVED_BYTE,                offsetof(private_transform_substructure_t, reserved[0])         },
        /* Length of the whole transform substructure*/
        { PAYLOAD_LENGTH,               offsetof(private_transform_substructure_t, transform_length)},
        /* transform type is a number of 8 bit */
        { U_INT_8,                              offsetof(private_transform_substructure_t, transform_type)      },
-       /* Reserved Byte is skipped */
-       { RESERVED_BYTE,                0                                                                                                                       },
+       /* 1 Reserved Byte */
+       { RESERVED_BYTE,                offsetof(private_transform_substructure_t, reserved[1])         },
        /* tranform ID is a number of 8 bit */
        { U_INT_16,                             offsetof(private_transform_substructure_t, transform_id)        },
        /* Attributes are stored in a transform attribute,
index d693b11..28f760e 100644 (file)
@@ -50,6 +50,16 @@ struct private_ts_payload_t {
        bool critical;
 
        /**
+        * reserved bits
+        */
+       bool reserved_bit[7];
+
+       /**
+        * reserved bytes
+        */
+       bool reserved_byte[3];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -76,24 +86,24 @@ encoding_rule_t ts_payload_encodings[] = {
        { U_INT_8,                      offsetof(private_ts_payload_t, next_payload)    },
        /* the critical bit */
        { FLAG,                         offsetof(private_ts_payload_t, critical)                },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
-       { RESERVED_BIT,         0                                                                                               },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[0]) },
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[1]) },
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[2]) },
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[3]) },
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[4]) },
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[5]) },
+       { RESERVED_BIT,         offsetof(private_ts_payload_t, reserved_bit[6]) },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_ts_payload_t, payload_length)  },
        /* 1 Byte TS type*/
        { U_INT_8,                      offsetof(private_ts_payload_t, ts_num)                  },
        /* 3 reserved bytes */
-       { RESERVED_BYTE,        0                                                                                               },
-       { RESERVED_BYTE,        0                                                                                               },
-       { RESERVED_BYTE,        0                                                                                               },
+       { RESERVED_BYTE,        offsetof(private_ts_payload_t, reserved_byte[0])},
+       { RESERVED_BYTE,        offsetof(private_ts_payload_t, reserved_byte[1])},
+       { RESERVED_BYTE,        offsetof(private_ts_payload_t, reserved_byte[2])},
        /* some ts data bytes, length is defined in PAYLOAD_LENGTH */
-       { TRAFFIC_SELECTORS,    offsetof(private_ts_payload_t, substrs)         }
+       { TRAFFIC_SELECTORS,offsetof(private_ts_payload_t, substrs)                     }
 };
 
 /*
index f2c7808..27af338 100644 (file)
@@ -46,6 +46,11 @@ struct private_unknown_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -68,14 +73,14 @@ encoding_rule_t unknown_payload_encodings[] = {
        { U_INT_8,                      offsetof(private_unknown_payload_t, next_payload)       },
        /* the critical bit */
        { FLAG,                         offsetof(private_unknown_payload_t, critical)           },
-       /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
+       /* 7 Bit reserved bits */
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[0])        },
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[1])        },
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[2])        },
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[3])        },
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[4])        },
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[5])        },
+       { RESERVED_BIT,         offsetof(private_unknown_payload_t, reserved[6])        },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_unknown_payload_t, payload_length)     },
        /* some unknown data bytes, length is defined in PAYLOAD_LENGTH */
index ca50943..e9e80e9 100644 (file)
@@ -42,6 +42,11 @@ struct private_vendor_id_payload_t {
        bool critical;
 
        /**
+        * Reserved bits
+        */
+       bool reserved[7];
+
+       /**
         * Length of this payload.
         */
        u_int16_t payload_length;
@@ -64,13 +69,13 @@ encoding_rule_t vendor_id_payload_encodings[] = {
        /* the critical bit */
        { FLAG,                         offsetof(private_vendor_id_payload_t, critical)         },
        /* 7 Bit reserved bits, nowhere stored */
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
-       { RESERVED_BIT,         0                                                                                                       },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[0])      },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[1])      },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[2])      },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[3])      },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[4])      },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[5])      },
+       { RESERVED_BIT,         offsetof(private_vendor_id_payload_t, reserved[6])      },
        /* Length of the whole payload*/
        { PAYLOAD_LENGTH,       offsetof(private_vendor_id_payload_t, payload_length)},
        /* some vendor_id data bytes, length is defined in PAYLOAD_LENGTH */