]> Pileus Git - ~andy/linux/blobdiff - include/net/sctp/constants.h
Merge commit '900cfa46191a7d87cf1891924cb90499287fd235'; branches 'timers/nohz',...
[~andy/linux] / include / net / sctp / constants.h
index bb37724495a55ba425ce503ef4ee2f5b2b06ae34..c32ddf0279c83513430c841f8a5f31e4c969f7d3 100644 (file)
@@ -1,18 +1,18 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel implementation
  * (C) Copyright IBM Corp. 2001, 2004
  * Copyright (c) 1999-2000 Cisco, Inc.
  * Copyright (c) 1999-2001 Motorola, Inc.
  * Copyright (c) 2001 Intel Corp.
  *
- * This file is part of the SCTP kernel reference Implementation
+ * This file is part of the SCTP kernel implementation
  *
- * The SCTP reference implementation is free software;
+ * This SCTP implementation is free software;
  * you can redistribute it and/or modify it under the terms of
  * the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
  *
- * The SCTP reference implementation is distributed in the hope that it
+ * This SCTP implementation is distributed in the hope that it
  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  *                 ************************
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -64,12 +64,18 @@ enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM };
 #define SCTP_CID_MAX                   SCTP_CID_ASCONF_ACK
 
 #define SCTP_NUM_BASE_CHUNK_TYPES      (SCTP_CID_BASE_MAX + 1)
-#define SCTP_NUM_CHUNK_TYPES           (SCTP_NUM_BASE_CHUNKTYPES + 2)
 
 #define SCTP_NUM_ADDIP_CHUNK_TYPES     2
 
 #define SCTP_NUM_PRSCTP_CHUNK_TYPES    1
 
+#define SCTP_NUM_AUTH_CHUNK_TYPES      1
+
+#define SCTP_NUM_CHUNK_TYPES           (SCTP_NUM_BASE_CHUNK_TYPES + \
+                                        SCTP_NUM_ADDIP_CHUNK_TYPES +\
+                                        SCTP_NUM_PRSCTP_CHUNK_TYPES +\
+                                        SCTP_NUM_AUTH_CHUNK_TYPES)
+
 /* These are the different flavours of event.  */
 typedef enum {
 
@@ -177,7 +183,11 @@ typedef enum {
        SCTP_IERROR_NO_DATA,
        SCTP_IERROR_BAD_STREAM,
        SCTP_IERROR_BAD_PORTS,
-
+       SCTP_IERROR_AUTH_BAD_HMAC,
+       SCTP_IERROR_AUTH_BAD_KEYID,
+       SCTP_IERROR_PROTO_VIOLATION,
+       SCTP_IERROR_ERROR,
+       SCTP_IERROR_ABORT,
 } sctp_ierror_t;
 
 
@@ -355,36 +365,12 @@ typedef enum {
  * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP
  * addresses.
  */
-#define IS_IPV4_UNUSABLE_ADDRESS(a) \
-       ((htonl(INADDR_BROADCAST) == *a) || \
-       (MULTICAST(*a)) || \
-       (((unsigned char *)(a))[0] == 0) || \
-       ((((unsigned char *)(a))[0] == 198) && \
-       (((unsigned char *)(a))[1] == 18) && \
-       (((unsigned char *)(a))[2] == 0)) || \
-       ((((unsigned char *)(a))[0] == 192) && \
-       (((unsigned char *)(a))[1] == 88) && \
-       (((unsigned char *)(a))[2] == 99)))
-
-/* IPv4 Link-local addresses: 169.254.0.0/16.  */
-#define IS_IPV4_LINK_ADDRESS(a) \
-       ((((unsigned char *)(a))[0] == 169) && \
-       (((unsigned char *)(a))[1] == 254))
-
-/* RFC 1918 "Address Allocation for Private Internets" defines the IPv4
- * private address space as the following:
- *
- * 10.0.0.0 - 10.255.255.255 (10/8 prefix)
- * 172.16.0.0.0 - 172.31.255.255 (172.16/12 prefix)
- * 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
- */
-#define IS_IPV4_PRIVATE_ADDRESS(a) \
-       ((((unsigned char *)(a))[0] == 10) || \
-       ((((unsigned char *)(a))[0] == 172) && \
-       (((unsigned char *)(a))[1] >= 16) && \
-       (((unsigned char *)(a))[1] < 32)) || \
-       ((((unsigned char *)(a))[0] == 192) && \
-       (((unsigned char *)(a))[1] == 168)))
+#define IS_IPV4_UNUSABLE_ADDRESS(a)        \
+       ((htonl(INADDR_BROADCAST) == a) ||  \
+        ipv4_is_multicast(a) ||            \
+        ipv4_is_zeronet(a) ||              \
+        ipv4_is_test_198(a) ||             \
+        ipv4_is_anycast_6to4(a))
 
 /* Flags used for the bind address copy functions.  */
 #define SCTP_ADDR6_ALLOWED     0x00000001      /* IPv6 address is allowed by
@@ -399,6 +385,7 @@ typedef enum {
        SCTP_RTXR_T3_RTX,
        SCTP_RTXR_FAST_RTX,
        SCTP_RTXR_PMTUD,
+       SCTP_RTXR_T1_RTX,
 } sctp_retransmit_reason_t;
 
 /* Reasons to lower cwnd. */
@@ -409,4 +396,48 @@ typedef enum {
        SCTP_LOWER_CWND_INACTIVE,
 } sctp_lower_cwnd_t;
 
+
+/* SCTP-AUTH Necessary constants */
+
+/* SCTP-AUTH, Section 3.3
+ *
+ *  The following Table 2 shows the currently defined values for HMAC
+ *  identifiers.
+ *
+ *  +-----------------+--------------------------+
+ *  | HMAC Identifier | Message Digest Algorithm |
+ *  +-----------------+--------------------------+
+ *  | 0               | Reserved                 |
+ *  | 1               | SHA-1 defined in [8]     |
+ *  | 2               | Reserved                 |
+ *  | 3               | SHA-256 defined in [8]   |
+ *  +-----------------+--------------------------+
+ */
+enum {
+       SCTP_AUTH_HMAC_ID_RESERVED_0,
+       SCTP_AUTH_HMAC_ID_SHA1,
+       SCTP_AUTH_HMAC_ID_RESERVED_2,
+#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
+       SCTP_AUTH_HMAC_ID_SHA256,
+#endif
+       __SCTP_AUTH_HMAC_MAX
+};
+
+#define SCTP_AUTH_HMAC_ID_MAX  __SCTP_AUTH_HMAC_MAX - 1
+#define SCTP_AUTH_NUM_HMACS    __SCTP_AUTH_HMAC_MAX
+#define SCTP_SHA1_SIG_SIZE 20
+#define SCTP_SHA256_SIG_SIZE 32
+
+/*  SCTP-AUTH, Section 3.2
+ *     The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE and AUTH chunks
+ *     MUST NOT be listed in the CHUNKS parameter
+ */
+#define SCTP_NUM_NOAUTH_CHUNKS 4
+#define SCTP_AUTH_MAX_CHUNKS   (SCTP_NUM_CHUNK_TYPES - SCTP_NUM_NOAUTH_CHUNKS)
+
+/* SCTP-AUTH Section 6.1
+ * The RANDOM parameter MUST contain a 32 byte random number.
+ */
+#define SCTP_AUTH_RANDOM_LENGTH 32
+
 #endif /* __sctp_constants_h__ */