- Update to 3.4-rc7.
[linux-flexiantxendom0-3.2.10.git] / include / net / sctp / sctp.h
index 2cb3980..a2ef814 100644 (file)
@@ -71,7 +71,7 @@
 #include <linux/jiffies.h>
 #include <linux/idr.h>
 
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#if IS_ENABLED(CONFIG_IPV6)
 #include <net/ipv6.h>
 #include <net/ip6_route.h>
 #endif
  * sctp/protocol.c
  */
 extern struct sock *sctp_get_ctl_sock(void);
-extern void sctp_local_addr_free(struct rcu_head *head);
 extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
                                     sctp_scope_t, gfp_t gfp,
                                     int flags);
 extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
 extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
+extern void sctp_addr_wq_mgmt(struct sctp_sockaddr_entry *, int);
 
 /*
  * sctp/socket.c
@@ -135,6 +135,7 @@ void sctp_sock_rfree(struct sk_buff *skb);
 void sctp_copy_sock(struct sock *newsk, struct sock *sk,
                    struct sctp_association *asoc);
 extern struct percpu_counter sctp_sockets_allocated;
+extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
 
 /*
  * sctp/primitive.c
@@ -286,20 +287,21 @@ do {                                                      \
                pr_cont(fmt, ##args);                   \
 } while (0)
 #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail,                  \
-                                args_lead, saddr, args_trail...)       \
+                                args_lead, addr, args_trail...)        \
 do {                                                                   \
+       const union sctp_addr *_addr = (addr);                          \
        if (sctp_debug_flag) {                                          \
-               if (saddr->sa.sa_family == AF_INET6) {                  \
+               if (_addr->sa.sa_family == AF_INET6) {                  \
                        printk(KERN_DEBUG                               \
                               pr_fmt(fmt_lead "%pI6" fmt_trail),       \
                               args_lead,                               \
-                              &saddr->v6.sin6_addr,                    \
+                              &_addr->v6.sin6_addr,                    \
                               args_trail);                             \
                } else {                                                \
                        printk(KERN_DEBUG                               \
                               pr_fmt(fmt_lead "%pI4" fmt_trail),       \
                               args_lead,                               \
-                              &saddr->v4.sin_addr.s_addr,              \
+                              &_addr->v4.sin_addr.s_addr,              \
                               args_trail);                             \
                }                                                       \
        }                                                               \
@@ -381,7 +383,7 @@ static inline void sctp_sysctl_unregister(void) { return; }
 /* Size of Supported Address Parameter for 'x' address types. */
 #define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16))
 
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#if IS_ENABLED(CONFIG_IPV6)
 
 void sctp_v6_pf_init(void);
 void sctp_v6_pf_exit(void);
@@ -405,12 +407,13 @@ static inline void sctp_v6_del_protocol(void) { return; }
 /* Map an association to an assoc_id. */
 static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
 {
-       return (asoc?asoc->assoc_id:0);
+       return asoc ? asoc->assoc_id : 0;
 }
 
 /* Look up the association by its id.  */
 struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
 
+int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
 
 /* A macro to walk a list of skbs.  */
 #define sctp_skb_for_each(pos, head, tmp) \
@@ -473,7 +476,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
 /* Tests if the list has one and only one entry. */
 static inline int sctp_list_single_entry(struct list_head *head)
 {
-       return ((head->next != head) && (head->next == head->prev));
+       return (head->next != head) && (head->next == head->prev);
 }
 
 /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
@@ -531,7 +534,6 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
 
 #define _sctp_walk_params(pos, chunk, end, member)\
 for (pos.v = chunk->member;\
-     pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\
      pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
      ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\
      pos.v += WORD_ROUND(ntohs(pos.p->length)))
@@ -542,7 +544,6 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
 #define _sctp_walk_errors(err, chunk_hdr, end)\
 for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
            sizeof(sctp_chunkhdr_t));\
-     (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\
      (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
      ntohs(err->length) >= sizeof(sctp_errhdr_t); \
      err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length))))
@@ -601,7 +602,7 @@ static inline int ipver2af(__u8 ipver)
                return AF_INET6;
        default:
                return 0;
-       };
+       }
 }
 
 /* Convert from an address parameter type to an address family.  */
@@ -614,7 +615,7 @@ static inline int param_type2af(__be16 type)
                return AF_INET6;
        default:
                return 0;
-       };
+       }
 }
 
 /* Perform some sanity checks. */
@@ -631,13 +632,13 @@ static inline int sctp_sanity_check(void)
 /* This is the hash function for the SCTP port hash table. */
 static inline int sctp_phashfn(__u16 lport)
 {
-       return (lport & (sctp_port_hashsize - 1));
+       return lport & (sctp_port_hashsize - 1);
 }
 
 /* This is the hash function for the endpoint hash table. */
 static inline int sctp_ep_hashfn(__u16 lport)
 {
-       return (lport & (sctp_ep_hashsize - 1));
+       return lport & (sctp_ep_hashsize - 1);
 }
 
 /* This is the hash function for the association hash table. */
@@ -645,7 +646,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport)
 {
        int h = (lport << 16) + rport;
        h ^= h>>8;
-       return (h & (sctp_assoc_hashsize - 1));
+       return h & (sctp_assoc_hashsize - 1);
 }
 
 /* This is the hash function for the association hash table.  This is
@@ -656,7 +657,7 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
 {
        int h = (lport << 16) + rport;
        h ^= vtag;
-       return (h & (sctp_assoc_hashsize-1));
+       return h & (sctp_assoc_hashsize - 1);
 }
 
 #define sctp_for_each_hentry(epb, node, head) \
@@ -703,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
        addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
 }
 
+/* The cookie is always 0 since this is how it's used in the
+ * pmtu code.
+ */
+static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
+{
+       if (t->dst && !dst_check(t->dst, 0)) {
+               dst_release(t->dst);
+               t->dst = NULL;
+       }
+
+       return t->dst;
+}
+
 #endif /* __net_sctp_h__ */