浏览代码

sctp: SO_REUSEADDR on the sctp sockets

Reported-by: Michal Matyska, michal.matyska at iptel org
Andrei Pelinescu-Onciul 16 年之前
父节点
当前提交
235631a005
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      sctp_server.c

+ 9 - 0
sctp_server.c

@@ -216,6 +216,15 @@ static int sctp_init_sock_opt_common(int s)
 		}
 	}
 	
+	/* set reuseaddr */
+	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
+						(void*)&optval, sizeof(optval))==-1){
+			LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt:"
+						" SO_REUSEADDR (%d): %s\n", optval, strerror(errno));
+			/* continue, non-critical */
+	}
+
+	
 	/* disable fragments interleave (SCTP_FRAGMENT_INTERLEAVE) --
 	 * we don't want partial delivery, so fragment interleave must be off too
 	 */