All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support
@ 2016-08-04 10:11 ` Phil Sutter
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

The following series contains a number of fixes necessary to make my yet
unpublished 'ss' support patch functional.

Changes since v1:
- Fixed patch 2/3
- Rebased whole series onto current net-next/master

Changes since v2:
- Improved description of patch 2/3

Phil Sutter (3):
  sctp: Export struct sctp_info to userspace
  sctp_diag: Fix T3_rtx timer export
  sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states

 include/linux/sctp.h      | 64 -----------------------------------------------
 include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
 net/sctp/sctp_diag.c      | 18 ++++++++-----
 3 files changed, 76 insertions(+), 70 deletions(-)

-- 
2.8.2

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support
@ 2016-08-04 10:11 ` Phil Sutter
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

The following series contains a number of fixes necessary to make my yet
unpublished 'ss' support patch functional.

Changes since v1:
- Fixed patch 2/3
- Rebased whole series onto current net-next/master

Changes since v2:
- Improved description of patch 2/3

Phil Sutter (3):
  sctp: Export struct sctp_info to userspace
  sctp_diag: Fix T3_rtx timer export
  sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states

 include/linux/sctp.h      | 64 -----------------------------------------------
 include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
 net/sctp/sctp_diag.c      | 18 ++++++++-----
 3 files changed, 76 insertions(+), 70 deletions(-)

-- 
2.8.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 1/3] sctp: Export struct sctp_info to userspace
  2016-08-04 10:11 ` Phil Sutter
@ 2016-08-04 10:11   ` Phil Sutter
  -1 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

This is required to correctly interpret INET_DIAG_INFO messages exported
by sctp_diag module.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 include/linux/sctp.h      | 64 -----------------------------------------------
 include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index de1f64318fc4e..fcb4c36461732 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
 	sctp_authhdr_t auth_hdr;
 } __packed sctp_auth_chunk_t;
 
-struct sctp_info {
-	__u32	sctpi_tag;
-	__u32	sctpi_state;
-	__u32	sctpi_rwnd;
-	__u16	sctpi_unackdata;
-	__u16	sctpi_penddata;
-	__u16	sctpi_instrms;
-	__u16	sctpi_outstrms;
-	__u32	sctpi_fragmentation_point;
-	__u32	sctpi_inqueue;
-	__u32	sctpi_outqueue;
-	__u32	sctpi_overall_error;
-	__u32	sctpi_max_burst;
-	__u32	sctpi_maxseg;
-	__u32	sctpi_peer_rwnd;
-	__u32	sctpi_peer_tag;
-	__u8	sctpi_peer_capable;
-	__u8	sctpi_peer_sack;
-	__u16	__reserved1;
-
-	/* assoc status info */
-	__u64	sctpi_isacks;
-	__u64	sctpi_osacks;
-	__u64	sctpi_opackets;
-	__u64	sctpi_ipackets;
-	__u64	sctpi_rtxchunks;
-	__u64	sctpi_outofseqtsns;
-	__u64	sctpi_idupchunks;
-	__u64	sctpi_gapcnt;
-	__u64	sctpi_ouodchunks;
-	__u64	sctpi_iuodchunks;
-	__u64	sctpi_oodchunks;
-	__u64	sctpi_iodchunks;
-	__u64	sctpi_octrlchunks;
-	__u64	sctpi_ictrlchunks;
-
-	/* primary transport info */
-	struct sockaddr_storage	sctpi_p_address;
-	__s32	sctpi_p_state;
-	__u32	sctpi_p_cwnd;
-	__u32	sctpi_p_srtt;
-	__u32	sctpi_p_rto;
-	__u32	sctpi_p_hbinterval;
-	__u32	sctpi_p_pathmaxrxt;
-	__u32	sctpi_p_sackdelay;
-	__u32	sctpi_p_sackfreq;
-	__u32	sctpi_p_ssthresh;
-	__u32	sctpi_p_partial_bytes_acked;
-	__u32	sctpi_p_flight_size;
-	__u16	sctpi_p_error;
-	__u16	__reserved2;
-
-	/* sctp sock info */
-	__u32	sctpi_s_autoclose;
-	__u32	sctpi_s_adaptation_ind;
-	__u32	sctpi_s_pd_point;
-	__u8	sctpi_s_nodelay;
-	__u8	sctpi_s_disable_fragments;
-	__u8	sctpi_s_v4mapped;
-	__u8	sctpi_s_frag_interleave;
-	__u32	sctpi_s_type;
-	__u32	__reserved3;
-};
-
 struct sctp_infox {
 	struct sctp_info *sctpinfo;
 	struct sctp_association *asoc;
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index d304f4c9792c4..a406adcc0793e 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -944,4 +944,68 @@ struct sctp_default_prinfo {
 	__u16 pr_policy;
 };
 
+struct sctp_info {
+	__u32	sctpi_tag;
+	__u32	sctpi_state;
+	__u32	sctpi_rwnd;
+	__u16	sctpi_unackdata;
+	__u16	sctpi_penddata;
+	__u16	sctpi_instrms;
+	__u16	sctpi_outstrms;
+	__u32	sctpi_fragmentation_point;
+	__u32	sctpi_inqueue;
+	__u32	sctpi_outqueue;
+	__u32	sctpi_overall_error;
+	__u32	sctpi_max_burst;
+	__u32	sctpi_maxseg;
+	__u32	sctpi_peer_rwnd;
+	__u32	sctpi_peer_tag;
+	__u8	sctpi_peer_capable;
+	__u8	sctpi_peer_sack;
+	__u16	__reserved1;
+
+	/* assoc status info */
+	__u64	sctpi_isacks;
+	__u64	sctpi_osacks;
+	__u64	sctpi_opackets;
+	__u64	sctpi_ipackets;
+	__u64	sctpi_rtxchunks;
+	__u64	sctpi_outofseqtsns;
+	__u64	sctpi_idupchunks;
+	__u64	sctpi_gapcnt;
+	__u64	sctpi_ouodchunks;
+	__u64	sctpi_iuodchunks;
+	__u64	sctpi_oodchunks;
+	__u64	sctpi_iodchunks;
+	__u64	sctpi_octrlchunks;
+	__u64	sctpi_ictrlchunks;
+
+	/* primary transport info */
+	struct sockaddr_storage	sctpi_p_address;
+	__s32	sctpi_p_state;
+	__u32	sctpi_p_cwnd;
+	__u32	sctpi_p_srtt;
+	__u32	sctpi_p_rto;
+	__u32	sctpi_p_hbinterval;
+	__u32	sctpi_p_pathmaxrxt;
+	__u32	sctpi_p_sackdelay;
+	__u32	sctpi_p_sackfreq;
+	__u32	sctpi_p_ssthresh;
+	__u32	sctpi_p_partial_bytes_acked;
+	__u32	sctpi_p_flight_size;
+	__u16	sctpi_p_error;
+	__u16	__reserved2;
+
+	/* sctp sock info */
+	__u32	sctpi_s_autoclose;
+	__u32	sctpi_s_adaptation_ind;
+	__u32	sctpi_s_pd_point;
+	__u8	sctpi_s_nodelay;
+	__u8	sctpi_s_disable_fragments;
+	__u8	sctpi_s_v4mapped;
+	__u8	sctpi_s_frag_interleave;
+	__u32	sctpi_s_type;
+	__u32	__reserved3;
+};
+
 #endif /* _UAPI_SCTP_H */
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 1/3] sctp: Export struct sctp_info to userspace
@ 2016-08-04 10:11   ` Phil Sutter
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

This is required to correctly interpret INET_DIAG_INFO messages exported
by sctp_diag module.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 include/linux/sctp.h      | 64 -----------------------------------------------
 include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index de1f64318fc4e..fcb4c36461732 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
 	sctp_authhdr_t auth_hdr;
 } __packed sctp_auth_chunk_t;
 
-struct sctp_info {
-	__u32	sctpi_tag;
-	__u32	sctpi_state;
-	__u32	sctpi_rwnd;
-	__u16	sctpi_unackdata;
-	__u16	sctpi_penddata;
-	__u16	sctpi_instrms;
-	__u16	sctpi_outstrms;
-	__u32	sctpi_fragmentation_point;
-	__u32	sctpi_inqueue;
-	__u32	sctpi_outqueue;
-	__u32	sctpi_overall_error;
-	__u32	sctpi_max_burst;
-	__u32	sctpi_maxseg;
-	__u32	sctpi_peer_rwnd;
-	__u32	sctpi_peer_tag;
-	__u8	sctpi_peer_capable;
-	__u8	sctpi_peer_sack;
-	__u16	__reserved1;
-
-	/* assoc status info */
-	__u64	sctpi_isacks;
-	__u64	sctpi_osacks;
-	__u64	sctpi_opackets;
-	__u64	sctpi_ipackets;
-	__u64	sctpi_rtxchunks;
-	__u64	sctpi_outofseqtsns;
-	__u64	sctpi_idupchunks;
-	__u64	sctpi_gapcnt;
-	__u64	sctpi_ouodchunks;
-	__u64	sctpi_iuodchunks;
-	__u64	sctpi_oodchunks;
-	__u64	sctpi_iodchunks;
-	__u64	sctpi_octrlchunks;
-	__u64	sctpi_ictrlchunks;
-
-	/* primary transport info */
-	struct sockaddr_storage	sctpi_p_address;
-	__s32	sctpi_p_state;
-	__u32	sctpi_p_cwnd;
-	__u32	sctpi_p_srtt;
-	__u32	sctpi_p_rto;
-	__u32	sctpi_p_hbinterval;
-	__u32	sctpi_p_pathmaxrxt;
-	__u32	sctpi_p_sackdelay;
-	__u32	sctpi_p_sackfreq;
-	__u32	sctpi_p_ssthresh;
-	__u32	sctpi_p_partial_bytes_acked;
-	__u32	sctpi_p_flight_size;
-	__u16	sctpi_p_error;
-	__u16	__reserved2;
-
-	/* sctp sock info */
-	__u32	sctpi_s_autoclose;
-	__u32	sctpi_s_adaptation_ind;
-	__u32	sctpi_s_pd_point;
-	__u8	sctpi_s_nodelay;
-	__u8	sctpi_s_disable_fragments;
-	__u8	sctpi_s_v4mapped;
-	__u8	sctpi_s_frag_interleave;
-	__u32	sctpi_s_type;
-	__u32	__reserved3;
-};
-
 struct sctp_infox {
 	struct sctp_info *sctpinfo;
 	struct sctp_association *asoc;
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
index d304f4c9792c4..a406adcc0793e 100644
--- a/include/uapi/linux/sctp.h
+++ b/include/uapi/linux/sctp.h
@@ -944,4 +944,68 @@ struct sctp_default_prinfo {
 	__u16 pr_policy;
 };
 
+struct sctp_info {
+	__u32	sctpi_tag;
+	__u32	sctpi_state;
+	__u32	sctpi_rwnd;
+	__u16	sctpi_unackdata;
+	__u16	sctpi_penddata;
+	__u16	sctpi_instrms;
+	__u16	sctpi_outstrms;
+	__u32	sctpi_fragmentation_point;
+	__u32	sctpi_inqueue;
+	__u32	sctpi_outqueue;
+	__u32	sctpi_overall_error;
+	__u32	sctpi_max_burst;
+	__u32	sctpi_maxseg;
+	__u32	sctpi_peer_rwnd;
+	__u32	sctpi_peer_tag;
+	__u8	sctpi_peer_capable;
+	__u8	sctpi_peer_sack;
+	__u16	__reserved1;
+
+	/* assoc status info */
+	__u64	sctpi_isacks;
+	__u64	sctpi_osacks;
+	__u64	sctpi_opackets;
+	__u64	sctpi_ipackets;
+	__u64	sctpi_rtxchunks;
+	__u64	sctpi_outofseqtsns;
+	__u64	sctpi_idupchunks;
+	__u64	sctpi_gapcnt;
+	__u64	sctpi_ouodchunks;
+	__u64	sctpi_iuodchunks;
+	__u64	sctpi_oodchunks;
+	__u64	sctpi_iodchunks;
+	__u64	sctpi_octrlchunks;
+	__u64	sctpi_ictrlchunks;
+
+	/* primary transport info */
+	struct sockaddr_storage	sctpi_p_address;
+	__s32	sctpi_p_state;
+	__u32	sctpi_p_cwnd;
+	__u32	sctpi_p_srtt;
+	__u32	sctpi_p_rto;
+	__u32	sctpi_p_hbinterval;
+	__u32	sctpi_p_pathmaxrxt;
+	__u32	sctpi_p_sackdelay;
+	__u32	sctpi_p_sackfreq;
+	__u32	sctpi_p_ssthresh;
+	__u32	sctpi_p_partial_bytes_acked;
+	__u32	sctpi_p_flight_size;
+	__u16	sctpi_p_error;
+	__u16	__reserved2;
+
+	/* sctp sock info */
+	__u32	sctpi_s_autoclose;
+	__u32	sctpi_s_adaptation_ind;
+	__u32	sctpi_s_pd_point;
+	__u8	sctpi_s_nodelay;
+	__u8	sctpi_s_disable_fragments;
+	__u8	sctpi_s_v4mapped;
+	__u8	sctpi_s_frag_interleave;
+	__u32	sctpi_s_type;
+	__u32	__reserved3;
+};
+
 #endif /* _UAPI_SCTP_H */
-- 
2.8.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/3] sctp_diag: Fix T3_rtx timer export
  2016-08-04 10:11 ` Phil Sutter
@ 2016-08-04 10:11   ` Phil Sutter
  -1 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

The asoc's timer value is not kept in asoc->timeouts array but in it's
primary transport instead.

Furthermore, we must export the timer only if it is pending, otherwise
the value will underrun when stored in an unsigned variable and
user space will only see a very large timeout value.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Introduce local variable to shorten long lines.
- Use timer_pending() to decide whether to export the timer value.
- Export the primary path's value instead of garbage.
- If not exporting, zero fields to not confuse userspace.
Changes since v2:
- Rewrote description, emphasizing on wrong value export
  rather than exporting conditionally.
---
 net/sctp/sctp_diag.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index f69edcf219e51..f728ef04a7b2d 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -13,6 +13,7 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
 {
 	union sctp_addr laddr, paddr;
 	struct dst_entry *dst;
+	struct timer_list *t3_rtx = &asoc->peer.primary_path->T3_rtx_timer;
 
 	laddr = list_entry(asoc->base.bind_addr.address_list.next,
 			   struct sctp_sockaddr_entry, list)->a;
@@ -40,10 +41,15 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
 	}
 
 	r->idiag_state = asoc->state;
-	r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
-	r->idiag_retrans = asoc->rtx_data_chunks;
-	r->idiag_expires = jiffies_to_msecs(
-		asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] - jiffies);
+	if (timer_pending(t3_rtx)) {
+		r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
+		r->idiag_retrans = asoc->rtx_data_chunks;
+		r->idiag_expires = jiffies_to_msecs(t3_rtx->expires - jiffies);
+	} else {
+		r->idiag_timer = 0;
+		r->idiag_retrans = 0;
+		r->idiag_expires = 0;
+	}
 }
 
 static int inet_diag_msg_sctpladdrs_fill(struct sk_buff *skb,
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/3] sctp_diag: Fix T3_rtx timer export
@ 2016-08-04 10:11   ` Phil Sutter
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

The asoc's timer value is not kept in asoc->timeouts array but in it's
primary transport instead.

Furthermore, we must export the timer only if it is pending, otherwise
the value will underrun when stored in an unsigned variable and
user space will only see a very large timeout value.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Introduce local variable to shorten long lines.
- Use timer_pending() to decide whether to export the timer value.
- Export the primary path's value instead of garbage.
- If not exporting, zero fields to not confuse userspace.
Changes since v2:
- Rewrote description, emphasizing on wrong value export
  rather than exporting conditionally.
---
 net/sctp/sctp_diag.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index f69edcf219e51..f728ef04a7b2d 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -13,6 +13,7 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
 {
 	union sctp_addr laddr, paddr;
 	struct dst_entry *dst;
+	struct timer_list *t3_rtx = &asoc->peer.primary_path->T3_rtx_timer;
 
 	laddr = list_entry(asoc->base.bind_addr.address_list.next,
 			   struct sctp_sockaddr_entry, list)->a;
@@ -40,10 +41,15 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
 	}
 
 	r->idiag_state = asoc->state;
-	r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
-	r->idiag_retrans = asoc->rtx_data_chunks;
-	r->idiag_expires = jiffies_to_msecs(
-		asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] - jiffies);
+	if (timer_pending(t3_rtx)) {
+		r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
+		r->idiag_retrans = asoc->rtx_data_chunks;
+		r->idiag_expires = jiffies_to_msecs(t3_rtx->expires - jiffies);
+	} else {
+		r->idiag_timer = 0;
+		r->idiag_retrans = 0;
+		r->idiag_expires = 0;
+	}
 }
 
 static int inet_diag_msg_sctpladdrs_fill(struct sk_buff *skb,
-- 
2.8.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 3/3] sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states
  2016-08-04 10:11 ` Phil Sutter
@ 2016-08-04 10:11   ` Phil Sutter
  -1 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

Since 'ss' always adds TCPF_CLOSE to idiag_states flags, sctp_diag can't
rely upon TCPF_LISTEN flag solely being present when listening sockets
are requested.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 net/sctp/sctp_diag.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index f728ef04a7b2d..bb691538adc8e 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -356,7 +356,7 @@ static int sctp_ep_dump(struct sctp_endpoint *ep, void *p)
 	if (cb->args[4] < cb->args[1])
 		goto next;
 
-	if ((r->idiag_states & ~TCPF_LISTEN) && !list_empty(&ep->asocs))
+	if (!(r->idiag_states & TCPF_LISTEN) && !list_empty(&ep->asocs))
 		goto next;
 
 	if (r->sdiag_family != AF_UNSPEC &&
@@ -471,7 +471,7 @@ skip:
 	 * 3 : to mark if we have dumped the ep info of the current asoc
 	 * 4 : to work as a temporary variable to traversal list
 	 */
-	if (!(idiag_states & ~TCPF_LISTEN))
+	if (!(idiag_states & ~(TCPF_LISTEN | TCPF_CLOSE)))
 		goto done;
 	sctp_for_each_transport(sctp_tsp_dump, net, cb->args[2], &commp);
 done:
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 3/3] sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states
@ 2016-08-04 10:11   ` Phil Sutter
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 10:11 UTC (permalink / raw)
  To: David Miller; +Cc: Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

Since 'ss' always adds TCPF_CLOSE to idiag_states flags, sctp_diag can't
rely upon TCPF_LISTEN flag solely being present when listening sockets
are requested.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 net/sctp/sctp_diag.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index f728ef04a7b2d..bb691538adc8e 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -356,7 +356,7 @@ static int sctp_ep_dump(struct sctp_endpoint *ep, void *p)
 	if (cb->args[4] < cb->args[1])
 		goto next;
 
-	if ((r->idiag_states & ~TCPF_LISTEN) && !list_empty(&ep->asocs))
+	if (!(r->idiag_states & TCPF_LISTEN) && !list_empty(&ep->asocs))
 		goto next;
 
 	if (r->sdiag_family != AF_UNSPEC &&
@@ -471,7 +471,7 @@ skip:
 	 * 3 : to mark if we have dumped the ep info of the current asoc
 	 * 4 : to work as a temporary variable to traversal list
 	 */
-	if (!(idiag_states & ~TCPF_LISTEN))
+	if (!(idiag_states & ~(TCPF_LISTEN | TCPF_CLOSE)))
 		goto done;
 	sctp_for_each_transport(sctp_tsp_dump, net, cb->args[2], &commp);
 done:
-- 
2.8.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support
  2016-08-04 10:11 ` Phil Sutter
@ 2016-08-04 12:36   ` Marcelo Ricardo Leitner
  -1 siblings, 0 replies; 14+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-08-04 12:36 UTC (permalink / raw)
  To: Phil Sutter; +Cc: David Miller, Xin Long, netdev, linux-sctp

On Thu, Aug 04, 2016 at 12:11:54PM +0200, Phil Sutter wrote:
> The following series contains a number of fixes necessary to make my yet
> unpublished 'ss' support patch functional.
> 
> Changes since v1:
> - Fixed patch 2/3
> - Rebased whole series onto current net-next/master
> 
> Changes since v2:
> - Improved description of patch 2/3
> 
> Phil Sutter (3):
>   sctp: Export struct sctp_info to userspace
>   sctp_diag: Fix T3_rtx timer export
>   sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states
> 

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Thanks!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support
@ 2016-08-04 12:36   ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 14+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-08-04 12:36 UTC (permalink / raw)
  To: Phil Sutter; +Cc: David Miller, Xin Long, netdev, linux-sctp

On Thu, Aug 04, 2016 at 12:11:54PM +0200, Phil Sutter wrote:
> The following series contains a number of fixes necessary to make my yet
> unpublished 'ss' support patch functional.
> 
> Changes since v1:
> - Fixed patch 2/3
> - Rebased whole series onto current net-next/master
> 
> Changes since v2:
> - Improved description of patch 2/3
> 
> Phil Sutter (3):
>   sctp: Export struct sctp_info to userspace
>   sctp_diag: Fix T3_rtx timer export
>   sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states
> 

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Thanks!


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/3] sctp: Export struct sctp_info to userspace
  2016-08-04 10:11   ` Phil Sutter
@ 2016-08-04 13:33     ` Neil Horman
  -1 siblings, 0 replies; 14+ messages in thread
From: Neil Horman @ 2016-08-04 13:33 UTC (permalink / raw)
  To: Phil Sutter
  Cc: David Miller, Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

On Thu, Aug 04, 2016 at 12:11:55PM +0200, Phil Sutter wrote:
> This is required to correctly interpret INET_DIAG_INFO messages exported
> by sctp_diag module.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  include/linux/sctp.h      | 64 -----------------------------------------------
>  include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 64 insertions(+), 64 deletions(-)
> 
> diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> index de1f64318fc4e..fcb4c36461732 100644
> --- a/include/linux/sctp.h
> +++ b/include/linux/sctp.h
> @@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
>  	sctp_authhdr_t auth_hdr;
>  } __packed sctp_auth_chunk_t;
>  
> -struct sctp_info {
> -	__u32	sctpi_tag;
> -	__u32	sctpi_state;
> -	__u32	sctpi_rwnd;
> -	__u16	sctpi_unackdata;
> -	__u16	sctpi_penddata;
> -	__u16	sctpi_instrms;
> -	__u16	sctpi_outstrms;
> -	__u32	sctpi_fragmentation_point;
> -	__u32	sctpi_inqueue;
> -	__u32	sctpi_outqueue;
> -	__u32	sctpi_overall_error;
> -	__u32	sctpi_max_burst;
> -	__u32	sctpi_maxseg;
> -	__u32	sctpi_peer_rwnd;
> -	__u32	sctpi_peer_tag;
> -	__u8	sctpi_peer_capable;
> -	__u8	sctpi_peer_sack;
> -	__u16	__reserved1;
> -
> -	/* assoc status info */
> -	__u64	sctpi_isacks;
> -	__u64	sctpi_osacks;
> -	__u64	sctpi_opackets;
> -	__u64	sctpi_ipackets;
> -	__u64	sctpi_rtxchunks;
> -	__u64	sctpi_outofseqtsns;
> -	__u64	sctpi_idupchunks;
> -	__u64	sctpi_gapcnt;
> -	__u64	sctpi_ouodchunks;
> -	__u64	sctpi_iuodchunks;
> -	__u64	sctpi_oodchunks;
> -	__u64	sctpi_iodchunks;
> -	__u64	sctpi_octrlchunks;
> -	__u64	sctpi_ictrlchunks;
> -
> -	/* primary transport info */
> -	struct sockaddr_storage	sctpi_p_address;
> -	__s32	sctpi_p_state;
> -	__u32	sctpi_p_cwnd;
> -	__u32	sctpi_p_srtt;
> -	__u32	sctpi_p_rto;
> -	__u32	sctpi_p_hbinterval;
> -	__u32	sctpi_p_pathmaxrxt;
> -	__u32	sctpi_p_sackdelay;
> -	__u32	sctpi_p_sackfreq;
> -	__u32	sctpi_p_ssthresh;
> -	__u32	sctpi_p_partial_bytes_acked;
> -	__u32	sctpi_p_flight_size;
> -	__u16	sctpi_p_error;
> -	__u16	__reserved2;
> -
> -	/* sctp sock info */
> -	__u32	sctpi_s_autoclose;
> -	__u32	sctpi_s_adaptation_ind;
> -	__u32	sctpi_s_pd_point;
> -	__u8	sctpi_s_nodelay;
> -	__u8	sctpi_s_disable_fragments;
> -	__u8	sctpi_s_v4mapped;
> -	__u8	sctpi_s_frag_interleave;
> -	__u32	sctpi_s_type;
> -	__u32	__reserved3;
> -};
> -
>  struct sctp_infox {
>  	struct sctp_info *sctpinfo;
>  	struct sctp_association *asoc;
> diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
> index d304f4c9792c4..a406adcc0793e 100644
> --- a/include/uapi/linux/sctp.h
> +++ b/include/uapi/linux/sctp.h
> @@ -944,4 +944,68 @@ struct sctp_default_prinfo {
>  	__u16 pr_policy;
>  };
>  
> +struct sctp_info {
> +	__u32	sctpi_tag;
> +	__u32	sctpi_state;
> +	__u32	sctpi_rwnd;
> +	__u16	sctpi_unackdata;
> +	__u16	sctpi_penddata;
> +	__u16	sctpi_instrms;
> +	__u16	sctpi_outstrms;
> +	__u32	sctpi_fragmentation_point;
> +	__u32	sctpi_inqueue;
> +	__u32	sctpi_outqueue;
> +	__u32	sctpi_overall_error;
> +	__u32	sctpi_max_burst;
> +	__u32	sctpi_maxseg;
> +	__u32	sctpi_peer_rwnd;
> +	__u32	sctpi_peer_tag;
> +	__u8	sctpi_peer_capable;
> +	__u8	sctpi_peer_sack;
> +	__u16	__reserved1;
> +
> +	/* assoc status info */
> +	__u64	sctpi_isacks;
> +	__u64	sctpi_osacks;
> +	__u64	sctpi_opackets;
> +	__u64	sctpi_ipackets;
> +	__u64	sctpi_rtxchunks;
> +	__u64	sctpi_outofseqtsns;
> +	__u64	sctpi_idupchunks;
> +	__u64	sctpi_gapcnt;
> +	__u64	sctpi_ouodchunks;
> +	__u64	sctpi_iuodchunks;
> +	__u64	sctpi_oodchunks;
> +	__u64	sctpi_iodchunks;
> +	__u64	sctpi_octrlchunks;
> +	__u64	sctpi_ictrlchunks;
> +
> +	/* primary transport info */
> +	struct sockaddr_storage	sctpi_p_address;
> +	__s32	sctpi_p_state;
> +	__u32	sctpi_p_cwnd;
> +	__u32	sctpi_p_srtt;
> +	__u32	sctpi_p_rto;
> +	__u32	sctpi_p_hbinterval;
> +	__u32	sctpi_p_pathmaxrxt;
> +	__u32	sctpi_p_sackdelay;
> +	__u32	sctpi_p_sackfreq;
> +	__u32	sctpi_p_ssthresh;
> +	__u32	sctpi_p_partial_bytes_acked;
> +	__u32	sctpi_p_flight_size;
> +	__u16	sctpi_p_error;
> +	__u16	__reserved2;
> +
> +	/* sctp sock info */
> +	__u32	sctpi_s_autoclose;
> +	__u32	sctpi_s_adaptation_ind;
> +	__u32	sctpi_s_pd_point;
> +	__u8	sctpi_s_nodelay;
> +	__u8	sctpi_s_disable_fragments;
> +	__u8	sctpi_s_v4mapped;
> +	__u8	sctpi_s_frag_interleave;
> +	__u32	sctpi_s_type;
> +	__u32	__reserved3;
> +};
> +
If you export these, shouldn't they be converted to the corresponding
uint<size>_t variants?

Neil

>  #endif /* _UAPI_SCTP_H */
> -- 
> 2.8.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/3] sctp: Export struct sctp_info to userspace
@ 2016-08-04 13:33     ` Neil Horman
  0 siblings, 0 replies; 14+ messages in thread
From: Neil Horman @ 2016-08-04 13:33 UTC (permalink / raw)
  To: Phil Sutter
  Cc: David Miller, Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

On Thu, Aug 04, 2016 at 12:11:55PM +0200, Phil Sutter wrote:
> This is required to correctly interpret INET_DIAG_INFO messages exported
> by sctp_diag module.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  include/linux/sctp.h      | 64 -----------------------------------------------
>  include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 64 insertions(+), 64 deletions(-)
> 
> diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> index de1f64318fc4e..fcb4c36461732 100644
> --- a/include/linux/sctp.h
> +++ b/include/linux/sctp.h
> @@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
>  	sctp_authhdr_t auth_hdr;
>  } __packed sctp_auth_chunk_t;
>  
> -struct sctp_info {
> -	__u32	sctpi_tag;
> -	__u32	sctpi_state;
> -	__u32	sctpi_rwnd;
> -	__u16	sctpi_unackdata;
> -	__u16	sctpi_penddata;
> -	__u16	sctpi_instrms;
> -	__u16	sctpi_outstrms;
> -	__u32	sctpi_fragmentation_point;
> -	__u32	sctpi_inqueue;
> -	__u32	sctpi_outqueue;
> -	__u32	sctpi_overall_error;
> -	__u32	sctpi_max_burst;
> -	__u32	sctpi_maxseg;
> -	__u32	sctpi_peer_rwnd;
> -	__u32	sctpi_peer_tag;
> -	__u8	sctpi_peer_capable;
> -	__u8	sctpi_peer_sack;
> -	__u16	__reserved1;
> -
> -	/* assoc status info */
> -	__u64	sctpi_isacks;
> -	__u64	sctpi_osacks;
> -	__u64	sctpi_opackets;
> -	__u64	sctpi_ipackets;
> -	__u64	sctpi_rtxchunks;
> -	__u64	sctpi_outofseqtsns;
> -	__u64	sctpi_idupchunks;
> -	__u64	sctpi_gapcnt;
> -	__u64	sctpi_ouodchunks;
> -	__u64	sctpi_iuodchunks;
> -	__u64	sctpi_oodchunks;
> -	__u64	sctpi_iodchunks;
> -	__u64	sctpi_octrlchunks;
> -	__u64	sctpi_ictrlchunks;
> -
> -	/* primary transport info */
> -	struct sockaddr_storage	sctpi_p_address;
> -	__s32	sctpi_p_state;
> -	__u32	sctpi_p_cwnd;
> -	__u32	sctpi_p_srtt;
> -	__u32	sctpi_p_rto;
> -	__u32	sctpi_p_hbinterval;
> -	__u32	sctpi_p_pathmaxrxt;
> -	__u32	sctpi_p_sackdelay;
> -	__u32	sctpi_p_sackfreq;
> -	__u32	sctpi_p_ssthresh;
> -	__u32	sctpi_p_partial_bytes_acked;
> -	__u32	sctpi_p_flight_size;
> -	__u16	sctpi_p_error;
> -	__u16	__reserved2;
> -
> -	/* sctp sock info */
> -	__u32	sctpi_s_autoclose;
> -	__u32	sctpi_s_adaptation_ind;
> -	__u32	sctpi_s_pd_point;
> -	__u8	sctpi_s_nodelay;
> -	__u8	sctpi_s_disable_fragments;
> -	__u8	sctpi_s_v4mapped;
> -	__u8	sctpi_s_frag_interleave;
> -	__u32	sctpi_s_type;
> -	__u32	__reserved3;
> -};
> -
>  struct sctp_infox {
>  	struct sctp_info *sctpinfo;
>  	struct sctp_association *asoc;
> diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
> index d304f4c9792c4..a406adcc0793e 100644
> --- a/include/uapi/linux/sctp.h
> +++ b/include/uapi/linux/sctp.h
> @@ -944,4 +944,68 @@ struct sctp_default_prinfo {
>  	__u16 pr_policy;
>  };
>  
> +struct sctp_info {
> +	__u32	sctpi_tag;
> +	__u32	sctpi_state;
> +	__u32	sctpi_rwnd;
> +	__u16	sctpi_unackdata;
> +	__u16	sctpi_penddata;
> +	__u16	sctpi_instrms;
> +	__u16	sctpi_outstrms;
> +	__u32	sctpi_fragmentation_point;
> +	__u32	sctpi_inqueue;
> +	__u32	sctpi_outqueue;
> +	__u32	sctpi_overall_error;
> +	__u32	sctpi_max_burst;
> +	__u32	sctpi_maxseg;
> +	__u32	sctpi_peer_rwnd;
> +	__u32	sctpi_peer_tag;
> +	__u8	sctpi_peer_capable;
> +	__u8	sctpi_peer_sack;
> +	__u16	__reserved1;
> +
> +	/* assoc status info */
> +	__u64	sctpi_isacks;
> +	__u64	sctpi_osacks;
> +	__u64	sctpi_opackets;
> +	__u64	sctpi_ipackets;
> +	__u64	sctpi_rtxchunks;
> +	__u64	sctpi_outofseqtsns;
> +	__u64	sctpi_idupchunks;
> +	__u64	sctpi_gapcnt;
> +	__u64	sctpi_ouodchunks;
> +	__u64	sctpi_iuodchunks;
> +	__u64	sctpi_oodchunks;
> +	__u64	sctpi_iodchunks;
> +	__u64	sctpi_octrlchunks;
> +	__u64	sctpi_ictrlchunks;
> +
> +	/* primary transport info */
> +	struct sockaddr_storage	sctpi_p_address;
> +	__s32	sctpi_p_state;
> +	__u32	sctpi_p_cwnd;
> +	__u32	sctpi_p_srtt;
> +	__u32	sctpi_p_rto;
> +	__u32	sctpi_p_hbinterval;
> +	__u32	sctpi_p_pathmaxrxt;
> +	__u32	sctpi_p_sackdelay;
> +	__u32	sctpi_p_sackfreq;
> +	__u32	sctpi_p_ssthresh;
> +	__u32	sctpi_p_partial_bytes_acked;
> +	__u32	sctpi_p_flight_size;
> +	__u16	sctpi_p_error;
> +	__u16	__reserved2;
> +
> +	/* sctp sock info */
> +	__u32	sctpi_s_autoclose;
> +	__u32	sctpi_s_adaptation_ind;
> +	__u32	sctpi_s_pd_point;
> +	__u8	sctpi_s_nodelay;
> +	__u8	sctpi_s_disable_fragments;
> +	__u8	sctpi_s_v4mapped;
> +	__u8	sctpi_s_frag_interleave;
> +	__u32	sctpi_s_type;
> +	__u32	__reserved3;
> +};
> +
If you export these, shouldn't they be converted to the corresponding
uint<size>_t variants?

Neil

>  #endif /* _UAPI_SCTP_H */
> -- 
> 2.8.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/3] sctp: Export struct sctp_info to userspace
  2016-08-04 13:33     ` Neil Horman
@ 2016-08-04 14:40       ` Phil Sutter
  -1 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 14:40 UTC (permalink / raw)
  To: Neil Horman
  Cc: David Miller, Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

On Thu, Aug 04, 2016 at 09:33:29AM -0400, Neil Horman wrote:
> On Thu, Aug 04, 2016 at 12:11:55PM +0200, Phil Sutter wrote:
> > This is required to correctly interpret INET_DIAG_INFO messages exported
> > by sctp_diag module.
> > 
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> >  include/linux/sctp.h      | 64 -----------------------------------------------
> >  include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 64 insertions(+), 64 deletions(-)
> > 
> > diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> > index de1f64318fc4e..fcb4c36461732 100644
> > --- a/include/linux/sctp.h
> > +++ b/include/linux/sctp.h
> > @@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
> >  	sctp_authhdr_t auth_hdr;
> >  } __packed sctp_auth_chunk_t;
> >  
> > -struct sctp_info {
> > -	__u32	sctpi_tag;
> > -	__u32	sctpi_state;
> > -	__u32	sctpi_rwnd;
> > -	__u16	sctpi_unackdata;
> > -	__u16	sctpi_penddata;
> > -	__u16	sctpi_instrms;
> > -	__u16	sctpi_outstrms;
> > -	__u32	sctpi_fragmentation_point;
> > -	__u32	sctpi_inqueue;
> > -	__u32	sctpi_outqueue;
> > -	__u32	sctpi_overall_error;
> > -	__u32	sctpi_max_burst;
> > -	__u32	sctpi_maxseg;
> > -	__u32	sctpi_peer_rwnd;
> > -	__u32	sctpi_peer_tag;
> > -	__u8	sctpi_peer_capable;
> > -	__u8	sctpi_peer_sack;
> > -	__u16	__reserved1;
> > -
> > -	/* assoc status info */
> > -	__u64	sctpi_isacks;
> > -	__u64	sctpi_osacks;
> > -	__u64	sctpi_opackets;
> > -	__u64	sctpi_ipackets;
> > -	__u64	sctpi_rtxchunks;
> > -	__u64	sctpi_outofseqtsns;
> > -	__u64	sctpi_idupchunks;
> > -	__u64	sctpi_gapcnt;
> > -	__u64	sctpi_ouodchunks;
> > -	__u64	sctpi_iuodchunks;
> > -	__u64	sctpi_oodchunks;
> > -	__u64	sctpi_iodchunks;
> > -	__u64	sctpi_octrlchunks;
> > -	__u64	sctpi_ictrlchunks;
> > -
> > -	/* primary transport info */
> > -	struct sockaddr_storage	sctpi_p_address;
> > -	__s32	sctpi_p_state;
> > -	__u32	sctpi_p_cwnd;
> > -	__u32	sctpi_p_srtt;
> > -	__u32	sctpi_p_rto;
> > -	__u32	sctpi_p_hbinterval;
> > -	__u32	sctpi_p_pathmaxrxt;
> > -	__u32	sctpi_p_sackdelay;
> > -	__u32	sctpi_p_sackfreq;
> > -	__u32	sctpi_p_ssthresh;
> > -	__u32	sctpi_p_partial_bytes_acked;
> > -	__u32	sctpi_p_flight_size;
> > -	__u16	sctpi_p_error;
> > -	__u16	__reserved2;
> > -
> > -	/* sctp sock info */
> > -	__u32	sctpi_s_autoclose;
> > -	__u32	sctpi_s_adaptation_ind;
> > -	__u32	sctpi_s_pd_point;
> > -	__u8	sctpi_s_nodelay;
> > -	__u8	sctpi_s_disable_fragments;
> > -	__u8	sctpi_s_v4mapped;
> > -	__u8	sctpi_s_frag_interleave;
> > -	__u32	sctpi_s_type;
> > -	__u32	__reserved3;
> > -};
> > -
> >  struct sctp_infox {
> >  	struct sctp_info *sctpinfo;
> >  	struct sctp_association *asoc;
> > diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
> > index d304f4c9792c4..a406adcc0793e 100644
> > --- a/include/uapi/linux/sctp.h
> > +++ b/include/uapi/linux/sctp.h
> > @@ -944,4 +944,68 @@ struct sctp_default_prinfo {
> >  	__u16 pr_policy;
> >  };
> >  
> > +struct sctp_info {
> > +	__u32	sctpi_tag;
> > +	__u32	sctpi_state;
> > +	__u32	sctpi_rwnd;
> > +	__u16	sctpi_unackdata;
> > +	__u16	sctpi_penddata;
> > +	__u16	sctpi_instrms;
> > +	__u16	sctpi_outstrms;
> > +	__u32	sctpi_fragmentation_point;
> > +	__u32	sctpi_inqueue;
> > +	__u32	sctpi_outqueue;
> > +	__u32	sctpi_overall_error;
> > +	__u32	sctpi_max_burst;
> > +	__u32	sctpi_maxseg;
> > +	__u32	sctpi_peer_rwnd;
> > +	__u32	sctpi_peer_tag;
> > +	__u8	sctpi_peer_capable;
> > +	__u8	sctpi_peer_sack;
> > +	__u16	__reserved1;
> > +
> > +	/* assoc status info */
> > +	__u64	sctpi_isacks;
> > +	__u64	sctpi_osacks;
> > +	__u64	sctpi_opackets;
> > +	__u64	sctpi_ipackets;
> > +	__u64	sctpi_rtxchunks;
> > +	__u64	sctpi_outofseqtsns;
> > +	__u64	sctpi_idupchunks;
> > +	__u64	sctpi_gapcnt;
> > +	__u64	sctpi_ouodchunks;
> > +	__u64	sctpi_iuodchunks;
> > +	__u64	sctpi_oodchunks;
> > +	__u64	sctpi_iodchunks;
> > +	__u64	sctpi_octrlchunks;
> > +	__u64	sctpi_ictrlchunks;
> > +
> > +	/* primary transport info */
> > +	struct sockaddr_storage	sctpi_p_address;
> > +	__s32	sctpi_p_state;
> > +	__u32	sctpi_p_cwnd;
> > +	__u32	sctpi_p_srtt;
> > +	__u32	sctpi_p_rto;
> > +	__u32	sctpi_p_hbinterval;
> > +	__u32	sctpi_p_pathmaxrxt;
> > +	__u32	sctpi_p_sackdelay;
> > +	__u32	sctpi_p_sackfreq;
> > +	__u32	sctpi_p_ssthresh;
> > +	__u32	sctpi_p_partial_bytes_acked;
> > +	__u32	sctpi_p_flight_size;
> > +	__u16	sctpi_p_error;
> > +	__u16	__reserved2;
> > +
> > +	/* sctp sock info */
> > +	__u32	sctpi_s_autoclose;
> > +	__u32	sctpi_s_adaptation_ind;
> > +	__u32	sctpi_s_pd_point;
> > +	__u8	sctpi_s_nodelay;
> > +	__u8	sctpi_s_disable_fragments;
> > +	__u8	sctpi_s_v4mapped;
> > +	__u8	sctpi_s_frag_interleave;
> > +	__u32	sctpi_s_type;
> > +	__u32	__reserved3;
> > +};
> > +
> If you export these, shouldn't they be converted to the corresponding
> uint<size>_t variants?

As mentioned earlier, uapi headers using the __u* types seems not
uncommon. Another aspect is consistency, these types are used throughout
the whole file already, so if I should change them, they all should be
changed. And assuming uapi/linux/tcp.h being a good example: struct
tcp_info uses them also.

Cheers, Phil

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/3] sctp: Export struct sctp_info to userspace
@ 2016-08-04 14:40       ` Phil Sutter
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Sutter @ 2016-08-04 14:40 UTC (permalink / raw)
  To: Neil Horman
  Cc: David Miller, Xin Long, Marcelo Ricardo Leitner, netdev, linux-sctp

On Thu, Aug 04, 2016 at 09:33:29AM -0400, Neil Horman wrote:
> On Thu, Aug 04, 2016 at 12:11:55PM +0200, Phil Sutter wrote:
> > This is required to correctly interpret INET_DIAG_INFO messages exported
> > by sctp_diag module.
> > 
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> >  include/linux/sctp.h      | 64 -----------------------------------------------
> >  include/uapi/linux/sctp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 64 insertions(+), 64 deletions(-)
> > 
> > diff --git a/include/linux/sctp.h b/include/linux/sctp.h
> > index de1f64318fc4e..fcb4c36461732 100644
> > --- a/include/linux/sctp.h
> > +++ b/include/linux/sctp.h
> > @@ -705,70 +705,6 @@ typedef struct sctp_auth_chunk {
> >  	sctp_authhdr_t auth_hdr;
> >  } __packed sctp_auth_chunk_t;
> >  
> > -struct sctp_info {
> > -	__u32	sctpi_tag;
> > -	__u32	sctpi_state;
> > -	__u32	sctpi_rwnd;
> > -	__u16	sctpi_unackdata;
> > -	__u16	sctpi_penddata;
> > -	__u16	sctpi_instrms;
> > -	__u16	sctpi_outstrms;
> > -	__u32	sctpi_fragmentation_point;
> > -	__u32	sctpi_inqueue;
> > -	__u32	sctpi_outqueue;
> > -	__u32	sctpi_overall_error;
> > -	__u32	sctpi_max_burst;
> > -	__u32	sctpi_maxseg;
> > -	__u32	sctpi_peer_rwnd;
> > -	__u32	sctpi_peer_tag;
> > -	__u8	sctpi_peer_capable;
> > -	__u8	sctpi_peer_sack;
> > -	__u16	__reserved1;
> > -
> > -	/* assoc status info */
> > -	__u64	sctpi_isacks;
> > -	__u64	sctpi_osacks;
> > -	__u64	sctpi_opackets;
> > -	__u64	sctpi_ipackets;
> > -	__u64	sctpi_rtxchunks;
> > -	__u64	sctpi_outofseqtsns;
> > -	__u64	sctpi_idupchunks;
> > -	__u64	sctpi_gapcnt;
> > -	__u64	sctpi_ouodchunks;
> > -	__u64	sctpi_iuodchunks;
> > -	__u64	sctpi_oodchunks;
> > -	__u64	sctpi_iodchunks;
> > -	__u64	sctpi_octrlchunks;
> > -	__u64	sctpi_ictrlchunks;
> > -
> > -	/* primary transport info */
> > -	struct sockaddr_storage	sctpi_p_address;
> > -	__s32	sctpi_p_state;
> > -	__u32	sctpi_p_cwnd;
> > -	__u32	sctpi_p_srtt;
> > -	__u32	sctpi_p_rto;
> > -	__u32	sctpi_p_hbinterval;
> > -	__u32	sctpi_p_pathmaxrxt;
> > -	__u32	sctpi_p_sackdelay;
> > -	__u32	sctpi_p_sackfreq;
> > -	__u32	sctpi_p_ssthresh;
> > -	__u32	sctpi_p_partial_bytes_acked;
> > -	__u32	sctpi_p_flight_size;
> > -	__u16	sctpi_p_error;
> > -	__u16	__reserved2;
> > -
> > -	/* sctp sock info */
> > -	__u32	sctpi_s_autoclose;
> > -	__u32	sctpi_s_adaptation_ind;
> > -	__u32	sctpi_s_pd_point;
> > -	__u8	sctpi_s_nodelay;
> > -	__u8	sctpi_s_disable_fragments;
> > -	__u8	sctpi_s_v4mapped;
> > -	__u8	sctpi_s_frag_interleave;
> > -	__u32	sctpi_s_type;
> > -	__u32	__reserved3;
> > -};
> > -
> >  struct sctp_infox {
> >  	struct sctp_info *sctpinfo;
> >  	struct sctp_association *asoc;
> > diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h
> > index d304f4c9792c4..a406adcc0793e 100644
> > --- a/include/uapi/linux/sctp.h
> > +++ b/include/uapi/linux/sctp.h
> > @@ -944,4 +944,68 @@ struct sctp_default_prinfo {
> >  	__u16 pr_policy;
> >  };
> >  
> > +struct sctp_info {
> > +	__u32	sctpi_tag;
> > +	__u32	sctpi_state;
> > +	__u32	sctpi_rwnd;
> > +	__u16	sctpi_unackdata;
> > +	__u16	sctpi_penddata;
> > +	__u16	sctpi_instrms;
> > +	__u16	sctpi_outstrms;
> > +	__u32	sctpi_fragmentation_point;
> > +	__u32	sctpi_inqueue;
> > +	__u32	sctpi_outqueue;
> > +	__u32	sctpi_overall_error;
> > +	__u32	sctpi_max_burst;
> > +	__u32	sctpi_maxseg;
> > +	__u32	sctpi_peer_rwnd;
> > +	__u32	sctpi_peer_tag;
> > +	__u8	sctpi_peer_capable;
> > +	__u8	sctpi_peer_sack;
> > +	__u16	__reserved1;
> > +
> > +	/* assoc status info */
> > +	__u64	sctpi_isacks;
> > +	__u64	sctpi_osacks;
> > +	__u64	sctpi_opackets;
> > +	__u64	sctpi_ipackets;
> > +	__u64	sctpi_rtxchunks;
> > +	__u64	sctpi_outofseqtsns;
> > +	__u64	sctpi_idupchunks;
> > +	__u64	sctpi_gapcnt;
> > +	__u64	sctpi_ouodchunks;
> > +	__u64	sctpi_iuodchunks;
> > +	__u64	sctpi_oodchunks;
> > +	__u64	sctpi_iodchunks;
> > +	__u64	sctpi_octrlchunks;
> > +	__u64	sctpi_ictrlchunks;
> > +
> > +	/* primary transport info */
> > +	struct sockaddr_storage	sctpi_p_address;
> > +	__s32	sctpi_p_state;
> > +	__u32	sctpi_p_cwnd;
> > +	__u32	sctpi_p_srtt;
> > +	__u32	sctpi_p_rto;
> > +	__u32	sctpi_p_hbinterval;
> > +	__u32	sctpi_p_pathmaxrxt;
> > +	__u32	sctpi_p_sackdelay;
> > +	__u32	sctpi_p_sackfreq;
> > +	__u32	sctpi_p_ssthresh;
> > +	__u32	sctpi_p_partial_bytes_acked;
> > +	__u32	sctpi_p_flight_size;
> > +	__u16	sctpi_p_error;
> > +	__u16	__reserved2;
> > +
> > +	/* sctp sock info */
> > +	__u32	sctpi_s_autoclose;
> > +	__u32	sctpi_s_adaptation_ind;
> > +	__u32	sctpi_s_pd_point;
> > +	__u8	sctpi_s_nodelay;
> > +	__u8	sctpi_s_disable_fragments;
> > +	__u8	sctpi_s_v4mapped;
> > +	__u8	sctpi_s_frag_interleave;
> > +	__u32	sctpi_s_type;
> > +	__u32	__reserved3;
> > +};
> > +
> If you export these, shouldn't they be converted to the corresponding
> uint<size>_t variants?

As mentioned earlier, uapi headers using the __u* types seems not
uncommon. Another aspect is consistency, these types are used throughout
the whole file already, so if I should change them, they all should be
changed. And assuming uapi/linux/tcp.h being a good example: struct
tcp_info uses them also.

Cheers, Phil

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-08-04 14:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 10:11 [PATCH v3 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support Phil Sutter
2016-08-04 10:11 ` Phil Sutter
2016-08-04 10:11 ` [PATCH v3 1/3] sctp: Export struct sctp_info to userspace Phil Sutter
2016-08-04 10:11   ` Phil Sutter
2016-08-04 13:33   ` Neil Horman
2016-08-04 13:33     ` Neil Horman
2016-08-04 14:40     ` Phil Sutter
2016-08-04 14:40       ` Phil Sutter
2016-08-04 10:11 ` [PATCH v3 2/3] sctp_diag: Fix T3_rtx timer export Phil Sutter
2016-08-04 10:11   ` Phil Sutter
2016-08-04 10:11 ` [PATCH v3 3/3] sctp_diag: Respect ss adding TCPF_CLOSE to idiag_states Phil Sutter
2016-08-04 10:11   ` Phil Sutter
2016-08-04 12:36 ` [PATCH v3 0/3] sctp_diag: A bunch of fixes for upcoming 'ss' support Marcelo Ricardo Leitner
2016-08-04 12:36   ` Marcelo Ricardo Leitner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.