]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/net/sctp/user.h
[SCTP] Fix SCTP socket options to work with 32-bit apps on 64-bit kernels.
[net-next-2.6.git] / include / net / sctp / user.h
index f6328aeddcce064a9eebd2c570ede0a2b5b1d33e..1c5f19f995ad2beb8f0feb8ac04df7f115c99900 100644 (file)
@@ -103,16 +103,20 @@ enum sctp_optname {
 #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
        SCTP_SOCKOPT_PEELOFF,   /* peel off association. */
 #define SCTP_SOCKOPT_PEELOFF   SCTP_SOCKOPT_PEELOFF
-       SCTP_GET_PEER_ADDRS_NUM,        /* Get number of peer addresss. */
-#define SCTP_GET_PEER_ADDRS_NUM        SCTP_GET_PEER_ADDRS_NUM
+       SCTP_GET_PEER_ADDRS_NUM_OLD,    /* Get number of peer addresss. */
+#define SCTP_GET_PEER_ADDRS_NUM_OLD    SCTP_GET_PEER_ADDRS_NUM_OLD
+       SCTP_GET_PEER_ADDRS_OLD,        /* Get all peer addresss. */
+#define SCTP_GET_PEER_ADDRS_OLD        SCTP_GET_PEER_ADDRS_OLD
+       SCTP_GET_LOCAL_ADDRS_NUM_OLD,   /* Get number of local addresss. */
+#define SCTP_GET_LOCAL_ADDRS_NUM_OLD   SCTP_GET_LOCAL_ADDRS_NUM_OLD
+       SCTP_GET_LOCAL_ADDRS_OLD,       /* Get all local addresss. */
+#define SCTP_GET_LOCAL_ADDRS_OLD       SCTP_GET_LOCAL_ADDRS_OLD
+       SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
+#define SCTP_SOCKOPT_CONNECTX  SCTP_SOCKOPT_CONNECTX
        SCTP_GET_PEER_ADDRS,    /* Get all peer addresss. */
 #define SCTP_GET_PEER_ADDRS    SCTP_GET_PEER_ADDRS
-       SCTP_GET_LOCAL_ADDRS_NUM,       /* Get number of local addresss. */
-#define SCTP_GET_LOCAL_ADDRS_NUM       SCTP_GET_LOCAL_ADDRS_NUM
        SCTP_GET_LOCAL_ADDRS,   /* Get all local addresss. */
 #define SCTP_GET_LOCAL_ADDRS   SCTP_GET_LOCAL_ADDRS
-       SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
-#define SCTP_SOCKOPT_CONNECTX  SCTP_SOCKOPT_CONNECTX
 };
 
 /*
@@ -239,7 +243,7 @@ struct sctp_paddr_change {
        int spc_state;
        int spc_error;
        sctp_assoc_t spc_assoc_id;
-};
+} __attribute__((packed, aligned(4)));
 
 /*
  *    spc_state:  32 bits (signed integer)
@@ -464,7 +468,7 @@ struct sctp_assocparams {
 struct sctp_setpeerprim {
        sctp_assoc_t            sspp_assoc_id;
        struct sockaddr_storage sspp_addr;
-};
+} __attribute__((packed, aligned(4)));
 
 /*
  * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
@@ -477,7 +481,7 @@ struct sctp_setpeerprim {
 struct sctp_prim {
        sctp_assoc_t            ssp_assoc_id;
        struct sockaddr_storage ssp_addr;
-};
+} __attribute__((packed, aligned(4)));
 
 /*
  * 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER)
@@ -504,7 +508,7 @@ struct sctp_paddrparams {
        struct sockaddr_storage spp_address;
        __u32                   spp_hbinterval;
        __u16                   spp_pathmaxrxt;
-};
+} __attribute__((packed, aligned(4)));
 
 /*
  * 7.2.2 Peer Address Information
@@ -523,7 +527,7 @@ struct sctp_paddrinfo {
        __u32                   spinfo_srtt;
        __u32                   spinfo_rto;
        __u32                   spinfo_mtu;
-};
+} __attribute__((packed, aligned(4)));
 
 /* Peer addresses's state. */
 enum sctp_spinfo_state {
@@ -559,11 +563,16 @@ struct sctp_status {
  * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
  * sctp_getpaddrs() and sctp_getladdrs() API. 
  */
-struct sctp_getaddrs {
+struct sctp_getaddrs_old {
        sctp_assoc_t            assoc_id;
        int                     addr_num;
        struct sockaddr         __user *addrs;
 };
+struct sctp_getaddrs {
+       sctp_assoc_t            assoc_id; /*input*/
+       __u32                   addr_num; /*output*/
+       __u8                    addrs[0]; /*output, variable size*/
+};
 
 /* These are bit fields for msghdr->msg_flags.  See section 5.1.  */
 /* On user space Linux, these live in <bits/socket.h> as an enum.  */