Message ID | 8815067eea44ffd7274b0038e48c2618c2e77916.1602150362.git.lucien.xin@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | sctp: Implement RFC6951: UDP Encapsulation of SCTP | expand |
Hi Xin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Xin-Long/sctp-Implement-RFC6951-UDP-Encapsulation-of-SCTP/20201008-175211 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9faebeb2d80065926dfbc09cb73b1bb7779a89cd config: i386-randconfig-s002-20201008 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.2-218-gc0e96d6d-dirty # https://github.com/0day-ci/linux/commit/9119d2be86deb6950b26b152a51ddad0a95182a5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Xin-Long/sctp-Implement-RFC6951-UDP-Encapsulation-of-SCTP/20201008-175211 git checkout 9119d2be86deb6950b26b152a51ddad0a95182a5 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> echo echo "sparse warnings: (new ones prefixed by >>)" echo net/sctp/sm_make_chunk.c: note: in included file (through include/net/sctp/sctp.h): include/net/sctp/structs.h:334:41: sparse: sparse: array of flexible structures >> net/sctp/sm_make_chunk.c:1157:24: sparse: sparse: cast from restricted __be16 >> net/sctp/sm_make_chunk.c:1157:24: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __be16 [usertype] encap_port @@ >> net/sctp/sm_make_chunk.c:1157:24: sparse: expected unsigned short [usertype] val >> net/sctp/sm_make_chunk.c:1157:24: sparse: got restricted __be16 [usertype] encap_port >> net/sctp/sm_make_chunk.c:1157:24: sparse: sparse: cast from restricted __be16 >> net/sctp/sm_make_chunk.c:1157:24: sparse: sparse: cast from restricted __be16 net/sctp/sm_make_chunk.c:1158:24: sparse: sparse: cast from restricted __be16 net/sctp/sm_make_chunk.c:1158:24: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __be16 [usertype] encap_port @@ net/sctp/sm_make_chunk.c:1158:24: sparse: expected unsigned short [usertype] val net/sctp/sm_make_chunk.c:1158:24: sparse: got restricted __be16 [usertype] encap_port net/sctp/sm_make_chunk.c:1158:24: sparse: sparse: cast from restricted __be16 net/sctp/sm_make_chunk.c:1158:24: sparse: sparse: cast from restricted __be16 net/sctp/sm_make_chunk.c:3081:48: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected int optname @@ got restricted __be16 @@ net/sctp/sm_make_chunk.c:3081:48: sparse: expected int optname net/sctp/sm_make_chunk.c:3081:48: sparse: got restricted __be16 net/sctp/sm_make_chunk.c:3153:48: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected int optname @@ got restricted __be16 @@ net/sctp/sm_make_chunk.c:3153:48: sparse: expected int optname net/sctp/sm_make_chunk.c:3153:48: sparse: got restricted __be16 vim +1157 net/sctp/sm_make_chunk.c 1144 1145 struct sctp_chunk *sctp_make_new_encap_port(const struct sctp_association *asoc, 1146 const struct sctp_chunk *chunk) 1147 { 1148 struct sctp_new_encap_port_hdr nep; 1149 struct sctp_chunk *retval; 1150 1151 retval = sctp_make_abort(asoc, chunk, 1152 sizeof(struct sctp_errhdr) + sizeof(nep)); 1153 if (!retval) 1154 goto nodata; 1155 1156 sctp_init_cause(retval, SCTP_ERROR_NEW_ENCAP_PORT, sizeof(nep)); > 1157 nep.cur_port = htons(SCTP_INPUT_CB(chunk->skb)->encap_port); 1158 nep.new_port = htons(chunk->transport->encap_port); 1159 sctp_addto_chunk(retval, sizeof(nep), &nep); 1160 1161 nodata: 1162 return retval; 1163 } 1164 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 7673123..bb19265 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -482,11 +482,13 @@ enum sctp_error { * 11 Restart of an association with new addresses * 12 User Initiated Abort * 13 Protocol Violation + * 14 Restart of an Association with New Encapsulation Port */ SCTP_ERROR_RESTART = cpu_to_be16(0x0b), SCTP_ERROR_USER_ABORT = cpu_to_be16(0x0c), SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d), + SCTP_ERROR_NEW_ENCAP_PORT = cpu_to_be16(0x0e), /* ADDIP Section 3.3 New Error Causes * @@ -793,4 +795,22 @@ enum { SCTP_FLOWLABEL_VAL_MASK = 0xfffff }; +/* UDP Encapsulation + * draft-tuexen-tsvwg-sctp-udp-encaps-cons-03.html#section-4-4 + * + * The error cause indicating an "Restart of an Association with + * New Encapsulation Port" + * + * 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 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Cause Code = 14 | Cause Length = 8 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Current Encapsulation Port | New Encapsulation Port | + * +-------------------------------+-------------------------------+ + */ +struct sctp_new_encap_port_hdr { + __be16 cur_port; + __be16 new_port; +}; + #endif /* __LINUX_SCTP_H__ */ diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index a499341..fd223c9 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -221,6 +221,9 @@ struct sctp_chunk *sctp_make_violation_paramlen( struct sctp_chunk *sctp_make_violation_max_retrans( const struct sctp_association *asoc, const struct sctp_chunk *chunk); +struct sctp_chunk *sctp_make_new_encap_port( + const struct sctp_association *asoc, + const struct sctp_chunk *chunk); struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc, const struct sctp_transport *transport); struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *asoc, diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 21d0ff1..3bf1399 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1142,6 +1142,26 @@ struct sctp_chunk *sctp_make_violation_max_retrans( return retval; } +struct sctp_chunk *sctp_make_new_encap_port(const struct sctp_association *asoc, + const struct sctp_chunk *chunk) +{ + struct sctp_new_encap_port_hdr nep; + struct sctp_chunk *retval; + + retval = sctp_make_abort(asoc, chunk, + sizeof(struct sctp_errhdr) + sizeof(nep)); + if (!retval) + goto nodata; + + sctp_init_cause(retval, SCTP_ERROR_NEW_ENCAP_PORT, sizeof(nep)); + nep.cur_port = htons(SCTP_INPUT_CB(chunk->skb)->encap_port); + nep.new_port = htons(chunk->transport->encap_port); + sctp_addto_chunk(retval, sizeof(nep), &nep); + +nodata: + return retval; +} + /* Make a HEARTBEAT chunk. */ struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc, const struct sctp_transport *transport)
This patch is to add the function to make the abort chunk with the error cause for new encapsulation port restart, defined on Section 4.4 in draft-tuexen-tsvwg-sctp-udp-encaps-cons-03. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- include/linux/sctp.h | 20 ++++++++++++++++++++ include/net/sctp/sm.h | 3 +++ net/sctp/sm_make_chunk.c | 20 ++++++++++++++++++++ 3 files changed, 43 insertions(+)