MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_setopt

Function sctp_setopt

freebsd/netinet/sctp_usrreq.c:3725–6867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3723}
3724
3725static int
3726sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
3727 void *p)
3728{
3729 int error, set_opt;
3730 uint32_t *mopt;
3731 struct sctp_tcb *stcb = NULL;
3732 struct sctp_inpcb *inp = NULL;
3733 uint32_t vrf_id;
3734
3735 if (optval == NULL) {
3736 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3737 return (EINVAL);
3738 }
3739 inp = (struct sctp_inpcb *)so->so_pcb;
3740 if (inp == NULL) {
3741 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3742 return (EINVAL);
3743 }
3744 vrf_id = inp->def_vrf_id;
3745
3746 error = 0;
3747 switch (optname) {
3748 case SCTP_NODELAY:
3749 case SCTP_AUTOCLOSE:
3750 case SCTP_AUTO_ASCONF:
3751 case SCTP_EXPLICIT_EOR:
3752 case SCTP_DISABLE_FRAGMENTS:
3753 case SCTP_USE_EXT_RCVINFO:
3754 case SCTP_I_WANT_MAPPED_V4_ADDR:
3755 /* copy in the option value */
3756 SCTP_CHECK_AND_CAST(mopt, optval, uint32_t, optsize);
3757 set_opt = 0;
3758 if (error)
3759 break;
3760 switch (optname) {
3761 case SCTP_DISABLE_FRAGMENTS:
3762 set_opt = SCTP_PCB_FLAGS_NO_FRAGMENT;
3763 break;
3764 case SCTP_AUTO_ASCONF:
3765 /*
3766 * NOTE: we don't really support this flag
3767 */
3768 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
3769 /* only valid for bound all sockets */
3770 if ((SCTP_BASE_SYSCTL(sctp_auto_asconf) == 0) &&
3771 (*mopt != 0)) {
3772 /* forbidden by admin */
3773 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM);
3774 return (EPERM);
3775 }
3776 set_opt = SCTP_PCB_FLAGS_AUTO_ASCONF;
3777 } else {
3778 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3779 return (EINVAL);
3780 }
3781 break;
3782 case SCTP_EXPLICIT_EOR:

Callers 1

sctp_ctloutputFunction · 0.85

Calls 15

sctp_secs_to_ticksFunction · 0.85
sctp_msecs_to_ticksFunction · 0.85
sctp_auth_add_chunkFunction · 0.85
sctp_clear_cachedkeysFunction · 0.85
sctp_set_keyFunction · 0.85
sctp_alloc_sharedkeyFunction · 0.85
sctp_free_keyFunction · 0.85
sctp_insert_sharedkeyFunction · 0.85
sctp_clear_cachedkeys_epFunction · 0.85
sctp_alloc_hmaclistFunction · 0.85
sctp_auth_add_hmacidFunction · 0.85
sctp_free_hmaclistFunction · 0.85

Tested by

no test coverage detected