sctp_usrreq.c (168859) | sctp_usrreq.c (168943) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2007, Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 168859 2007-04-19 11:28:43Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 168943 2007-04-22 11:06:27Z rrs $"); |
35#include <netinet/sctp_os.h> 36#include <sys/proc.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctp_header.h> 39#include <netinet/sctp_var.h> 40#if defined(INET6) 41#include <netinet6/sctp6_var.h> 42#endif --- 1468 unchanged lines hidden (view full) --- 1511 *optsize = sizeof(uint32_t); 1512 } 1513 break; 1514 case SCTP_FRAGMENT_INTERLEAVE: 1515 { 1516 uint32_t *value; 1517 1518 SCTP_CHECK_AND_CAST(value, optval, uint32_t, *optsize); | 35#include <netinet/sctp_os.h> 36#include <sys/proc.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctp_header.h> 39#include <netinet/sctp_var.h> 40#if defined(INET6) 41#include <netinet6/sctp6_var.h> 42#endif --- 1468 unchanged lines hidden (view full) --- 1511 *optsize = sizeof(uint32_t); 1512 } 1513 break; 1514 case SCTP_FRAGMENT_INTERLEAVE: 1515 { 1516 uint32_t *value; 1517 1518 SCTP_CHECK_AND_CAST(value, optval, uint32_t, *optsize); |
1519 *value = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE); | 1519 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE)) { 1520 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS)) { 1521 *value = SCTP_FRAG_LEVEL_2; 1522 } else { 1523 *value = SCTP_FRAG_LEVEL_1; 1524 } 1525 } else { 1526 *value = SCTP_FRAG_LEVEL_0; 1527 } |
1520 *optsize = sizeof(uint32_t); 1521 } 1522 break; 1523 case SCTP_CMT_ON_OFF: 1524 { 1525 struct sctp_assoc_value *av; 1526 1527 SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); --- 924 unchanged lines hidden (view full) --- 2452 break; 2453 } 2454 inp->partial_delivery_point = *value; 2455 } 2456 break; 2457 case SCTP_FRAGMENT_INTERLEAVE: 2458 /* not yet until we re-write sctp_recvmsg() */ 2459 { | 1528 *optsize = sizeof(uint32_t); 1529 } 1530 break; 1531 case SCTP_CMT_ON_OFF: 1532 { 1533 struct sctp_assoc_value *av; 1534 1535 SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); --- 924 unchanged lines hidden (view full) --- 2460 break; 2461 } 2462 inp->partial_delivery_point = *value; 2463 } 2464 break; 2465 case SCTP_FRAGMENT_INTERLEAVE: 2466 /* not yet until we re-write sctp_recvmsg() */ 2467 { |
2460 uint32_t *on_off; | 2468 uint32_t *level; |
2461 | 2469 |
2462 SCTP_CHECK_AND_CAST(on_off, optval, uint32_t, optsize); 2463 if (*on_off) { | 2470 SCTP_CHECK_AND_CAST(level, optval, uint32_t, optsize); 2471 if (*level == SCTP_FRAG_LEVEL_2) { |
2464 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE); | 2472 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE); |
2473 sctp_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS); 2474 } else if (*level == SCTP_FRAG_LEVEL_1) { 2475 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE); 2476 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS); 2477 } else if (*level == SCTP_FRAG_LEVEL_0) { 2478 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE); 2479 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS); 2480 |
|
2465 } else { | 2481 } else { |
2466 sctp_feature_off(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE); | 2482 error = EINVAL; |
2467 } 2468 } 2469 break; 2470 case SCTP_CMT_ON_OFF: 2471 { 2472 struct sctp_assoc_value *av; 2473 2474 SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); --- 1457 unchanged lines hidden --- | 2483 } 2484 } 2485 break; 2486 case SCTP_CMT_ON_OFF: 2487 { 2488 struct sctp_assoc_value *av; 2489 2490 SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); --- 1457 unchanged lines hidden --- |