Browse code

sctp: suggest kernel upgrade if not all the sctp options are supported

Andrei Pelinescu-Onciul authored on 07/10/2008 11:23:23
Showing 1 changed files
... ...
@@ -183,7 +183,9 @@ static int sctp_init_sock_opt_common(int s)
183 183
 	struct sctp_event_subscribe es;
184 184
 	int optval;
185 185
 	socklen_t optlen;
186
+	int sctp_err;
186 187
 	
188
+	sctp_err=0;
187 189
 	/* set tos */
188 190
 	optval = tos;
189 191
 	if (setsockopt(s, IPPROTO_IP, IP_TOS, (void*)&optval,sizeof(optval)) ==-1){
... ...
@@ -223,6 +225,7 @@ static int sctp_init_sock_opt_common(int s)
223 223
 					(void*)&optval, sizeof(optval)) ==-1){
224 224
 		LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt: "
225 225
 					"SCTP_FRAGMENT_INTERLEAVE: %s\n", strerror(errno));
226
+		sctp_err++;
226 227
 		/* try to continue */
227 228
 	}
228 229
 #endif /* SCTP_FRAGMENT_INTERLEAVE */
... ...
@@ -245,6 +248,7 @@ static int sctp_init_sock_opt_common(int s)
245 245
 		LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt: "
246 246
 						"SCTP_PARTIAL_DELIVERY_POINT (%d): %s\n",
247 247
 						optval, strerror(errno));
248
+		sctp_err++;
248 249
 		/* try to continue */
249 250
 	}
250 251
 #endif /* SCTP_PARTIAL_DELIVERY_POINT */
... ...
@@ -256,6 +260,7 @@ static int sctp_init_sock_opt_common(int s)
256 256
 					(void*)&optval, sizeof(optval)) ==-1){
257 257
 		LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt: "
258 258
 						"SCTP_NODELAY: %s\n", strerror(errno));
259
+		sctp_err++;
259 260
 		/* non critical, try to continue */
260 261
 	}
261 262
 #endif /* SCTP_NODELAY */
... ...
@@ -267,6 +272,7 @@ static int sctp_init_sock_opt_common(int s)
267 267
 					(void*)&optval, sizeof(optval)) ==-1){
268 268
 		LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt: "
269 269
 						"SCTP_DISABLE_FRAGMENTS: %s\n", strerror(errno));
270
+		sctp_err++;
270 271
 		/* non critical, try to continue */
271 272
 	}
272 273
 #endif /* SCTP_DISABLE_FRAGMENTS */
... ...
@@ -280,6 +286,7 @@ static int sctp_init_sock_opt_common(int s)
280 280
 						"SCTP_AUTOCLOSE: %s (critical)\n", strerror(errno));
281 281
 		/* critical: w/o autoclose we could have sctp connection living
282 282
 		   forever (if the remote side doesn't close them) */
283
+		sctp_err++;
283 284
 		goto error;
284 285
 	}
285 286
 #else
... ...
@@ -305,10 +312,15 @@ static int sctp_init_sock_opt_common(int s)
305 305
 	if (setsockopt(s, IPPROTO_SCTP, SCTP_EVENTS, &es, sizeof(es))==-1){
306 306
 		LOG(L_ERR, "ERROR: sctp_init_sock_opt_common: setsockopt: "
307 307
 				"SCTP_EVENTS: %s\n", strerror(errno));
308
+		sctp_err++;
308 309
 		/* non critical, try to continue */
309 310
 	}
310 311
 #endif /* SCTP_EVENTS */
311 312
 	
313
+	if (sctp_err){
314
+		LOG(L_ERR, "ERROR: sctp: setting some sctp sockopts failed, "
315
+					"consider upgrading your kernel\n");
316
+	}
312 317
 	return 0;
313 318
 error:
314 319
 	return -1;