summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSridhar Samudrala <sri@us.ibm.com>2004-04-18 20:36:56 -0700
committerSridhar Samudrala <sri@us.ibm.com>2004-04-18 20:36:56 -0700
commitfe27663798f93789f23b7bcafcb5f8c9da09ec17 (patch)
tree77cc9d1a80605ea59e5f1a28d143e4fd572f10c1 /include
parent321fe6f8b00db387f7e05ed5be8d21fff028dbbb (diff)
[SCTP] Avoid the use of constant SCTP_IP_OVERHEAD to determine the
max data size in a SCTP packet. Calculate the overhead based on the socket's protocol family header length.
Diffstat (limited to 'include')
-rw-r--r--include/net/sctp/constants.h9
-rw-r--r--include/net/sctp/sctp.h7
-rw-r--r--include/net/sctp/structs.h7
3 files changed, 12 insertions, 11 deletions
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 6112e85f7a9c..3a5ad29201f8 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -57,15 +57,6 @@ enum { SCTP_MAX_STREAM = 0xffff };
enum { SCTP_DEFAULT_OUTSTREAMS = 10 };
enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM };
-/* Define the amount of space to reserve for SCTP, IP, LL.
- * There is a little bit of waste that we are always allocating
- * for ipv6 headers, but this seems worth the simplicity.
- */
-
-#define SCTP_IP_OVERHEAD ((sizeof(struct sctphdr)\
- + sizeof(struct ipv6hdr)\
- + MAX_HEADER))
-
/* Since CIDs are sparse, we need all four of the following
* symbols. CIDs are dense through SCTP_CID_BASE_MAX.
*/
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 6a6c6641e446..ee5e38a37d00 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -437,12 +437,15 @@ static inline __s32 sctp_jitter(__u32 rto)
static inline int sctp_frag_point(const struct sctp_opt *sp, int pmtu)
{
int frag = pmtu;
- frag -= SCTP_IP_OVERHEAD + sizeof(struct sctp_data_chunk);
- frag -= sizeof(struct sctp_sack_chunk);
+
+ frag -= sp->pf->af->net_header_len;
+ frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk);
if (sp->user_frag)
frag = min_t(int, frag, sp->user_frag);
+ frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN);
+
return frag;
}
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index a9f8c029361e..1731d02dc837 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -667,6 +667,9 @@ struct sctp_packet {
/* This contains the payload chunks. */
struct sk_buff_head chunks;
+
+ /* This is the overhead of the sctp and ip headers. */
+ size_t overhead;
/* This is the total size of all chunks INCLUDING padding. */
size_t size;
@@ -721,6 +724,10 @@ sctp_outq_ohandler_t sctp_packet_transmit_chunk;
sctp_outq_ohandler_force_t sctp_packet_transmit;
void sctp_packet_free(struct sctp_packet *);
+static inline int sctp_packet_empty(struct sctp_packet *packet)
+{
+ return (packet->size == packet->overhead);
+}
/* This represents a remote transport address.
* For local transport addresses, we just use union sctp_addr.