diff options
| -rw-r--r-- | include/linux/sctp.h | 109 | ||||
| -rw-r--r-- | include/net/sctp/sm.h | 10 | ||||
| -rw-r--r-- | net/sctp/sm_make_chunk.c | 28 |
3 files changed, 28 insertions, 119 deletions
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 6131e3c9aa45..a022f9f629f6 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -524,113 +524,4 @@ typedef struct sctp_addip_chunk { sctp_addiphdr_t addip_hdr; } sctp_addip_chunk_t __attribute__((packed)); -/* FIXME: Cleanup needs to continue below this line. */ - - -/* ADDIP Section 3.1.1 - * - * ASCONF-Request Correlation ID: 32 bits (unsigned integer) - * - * This is an opaque integer assigned by the sender to identify each - * request parameter. It is in host byte order and is only meaningful - * to the sender. The receiver of the ASCONF Chunk will copy this 32 - * bit value into the ASCONF Correlation ID field of the - * ASCONF-ACK. The sender of the ASCONF can use this same value in the - * ASCONF-ACK to find which request the response is for. - * - * ASCONF Parameter: TLV format - * - * Each Address configuration change is represented by a TLV parameter - * as defined in Section 3.2. One or more requests may be present in - * an ASCONF Chunk. - */ -typedef struct { - __u32 correlation; - sctp_paramhdr_t p; - __u8 payload[0]; -} sctpAsconfReq_t; - -/* ADDIP - * 3.1.1 Address/Stream Configuration Change Chunk (ASCONF) - * - * This chunk is used to communicate to the remote endpoint one of the - * configuration change requests that MUST be acknowledged. The - * information carried in the ASCONF Chunk uses the form of a - * Tag-Length-Value (TLV), as described in "3.2.1 - * Optional/Variable-length Parameter Format" in [RFC2960], for all - * variable parameters. - */ -typedef struct { - __u32 serial; - __u8 reserved[3]; - __u8 addr_type; - __u32 addr[4]; - sctpAsconfReq_t requests[0]; -} sctpAsconf_t; - -/* ADDIP - * 3.1.2 Address/Stream Configuration Acknowledgment Chunk (ASCONF-ACK) - * - * ASCONF-Request Correlation ID: 32 bits (unsigned integer) - * - * This value is copied from the ASCONF Correlation ID received in the - * ASCONF Chunk. It is used by the receiver of the ASCONF-ACK to identify - * which ASCONF parameter this response is associated with. - * - * ASCONF Parameter Response : TLV format - * - * The ASCONF Parameter Response is used in the ASCONF-ACK to report - * status of ASCONF processing. By default, if a responding endpoint - * does not include any Error Cause, a success is indicated. Thus a - * sender of an ASCONF-ACK MAY indicate complete success of all TLVs in - * an ASCONF by returning only the Chunk Type, Chunk Flags, Chunk Length - * (set to 8) and the Serial Number. - */ -typedef union { - struct { - __u32 correlation; - sctp_paramhdr_t header; /* success report */ - } success; - struct { - __u32 correlation; - sctp_paramhdr_t header; /* error cause indication */ - sctp_paramhdr_t errcause; - uint8_t request[0]; /* original request from ASCONF */ - } error; -#define __correlation success.correlation -#define __header success.header -#define __cause error.errcause -#define __request error.request -} sctpAsconfAckRsp_t; - -/* ADDIP - * 3.1.2 Address/Stream Configuration Acknowledgment Chunk (ASCONF-ACK) - * - * This chunk is used by the receiver of an ASCONF Chunk to - * acknowledge the reception. It carries zero or more results for any - * ASCONF Parameters that were processed by the receiver. - */ -typedef struct { - __u32 serial; - sctpAsconfAckRsp_t responses[0]; -} sctpAsconfAck_t; - -/********************************************************************* - * Internal structures - * - * These are data structures which never go out on the wire. - *********************************************************************/ - -/* What is this data structure for? The TLV isn't one--it is just a - * value. Perhaps this data structure ought to have a type--otherwise - * it is not unambigiously parseable. --piggy - */ -typedef struct { - struct list_head hook; - int length; /* length of the TLV */ - - /* the actually TLV to be copied into ASCONF_ACK */ - sctpAsconfAckRsp_t TLV; -} sctpAsconfAckRspNode_t; - #endif /* __LINUX_SCTP_H__ */ diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index c1ef3ee8f7ba..2b62b1afef2a 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -265,16 +265,18 @@ struct sctp_chunk *sctp_make_op_error(const struct sctp_association *, struct sctp_chunk *sctp_make_asconf(struct sctp_association *asoc, union sctp_addr *addr, int vparam_len); -struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, - struct sctp_chunk *asconf, - int vparam_len); - struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, union sctp_addr *, struct sockaddr *, int, int); struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, union sctp_addr *addr); +struct sctp_chunk *sctp_make_asconf_ack(struct sctp_association *asoc, + int serial, int vparam_len); + +struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, + struct sctp_chunk *asconf, + int vparam_len); void sctp_chunk_assign_tsn(struct sctp_chunk *); void sctp_chunk_assign_ssn(struct sctp_chunk *); diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 47a01794b2a5..e2555a2d9b14 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -2166,11 +2166,7 @@ struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, return retval; } -/* - * Unpack the parameters in an ASCONF chunk into an association and - * generate ASCONF-ACK chunk. - * - * ADDIP 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK) +/* ADDIP 3.1.2 Address Configuration Acknowledgement Chunk (ASCONF-ACK) * 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 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -2187,8 +2183,28 @@ struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, * | ASCONF Parameter Response#N | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * - * All the parameter respoinces will be added in this function. + * Create an ASCONF_ACK chunk with enough space for the parameter responses. */ +struct sctp_chunk *sctp_make_asconf_ack(struct sctp_association *asoc, + int serial, int vparam_len) +{ + sctp_addiphdr_t asconf; + struct sctp_chunk *retval; + int length = sizeof(asconf) + vparam_len; + + /* Create the chunk. */ + retval = sctp_make_chunk(asoc, SCTP_CID_ASCONF_ACK, 0, length); + if (!retval) + return NULL; + + asconf.serial = serial; + + retval->subh.addip_hdr = + sctp_addto_chunk(retval, sizeof(asconf), &asconf); + + return retval; +} + struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, struct sctp_chunk *asconf, int vparam_len) |
