Author: tuexen Date: Tue Oct 11 13:24:37 2011 New Revision: 226252 URL: http://svn.freebsd.org/changeset/base/226252
Log: Use the most significant 6 bits of the dscp instead of the least significant ones. This has changed in the latest version of the socket API ID and provides backwards compatibility and gets it in syn with the usage of the IP_TOS socket option. MFC after: 3 days. Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Tue Oct 11 13:22:35 2011 (r226251) +++ head/sys/netinet/sctp_usrreq.c Tue Oct 11 13:24:37 2011 (r226252) @@ -2435,7 +2435,7 @@ flags_out: paddrp->spp_flags |= SPP_PMTUD_DISABLE; } if (net->dscp & 0x01) { - paddrp->spp_dscp = net->dscp >> 2; + paddrp->spp_dscp = net->dscp & 0xfc; paddrp->spp_flags |= SPP_DSCP; } #ifdef INET6 @@ -2453,7 +2453,7 @@ flags_out: paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure; paddrp->spp_pathmtu = sctp_get_frag_point(stcb, &stcb->asoc); if (stcb->asoc.default_dscp & 0x01) { - paddrp->spp_dscp = stcb->asoc.default_dscp >> 2; + paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc; paddrp->spp_flags |= SPP_DSCP; } #ifdef INET6 @@ -2488,7 +2488,7 @@ flags_out: paddrp->spp_assoc_id = SCTP_FUTURE_ASSOC; /* get inp's default */ if (inp->sctp_ep.default_dscp & 0x01) { - paddrp->spp_dscp = inp->sctp_ep.default_dscp >> 2; + paddrp->spp_dscp = inp->sctp_ep.default_dscp & 0xfc; paddrp->spp_flags |= SPP_DSCP; } #ifdef INET6 @@ -4691,7 +4691,7 @@ sctp_setopt(struct socket *so, int optna net->failure_threshold = paddrp->spp_pathmaxrxt; } if (paddrp->spp_flags & SPP_DSCP) { - net->dscp = paddrp->spp_dscp << 2; + net->dscp = paddrp->spp_dscp & 0xfc; net->dscp |= 0x01; } #ifdef INET6 @@ -4794,10 +4794,10 @@ sctp_setopt(struct socket *so, int optna } if (paddrp->spp_flags & SPP_DSCP) { TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { - net->dscp = paddrp->spp_dscp << 2; + net->dscp = paddrp->spp_dscp & 0xfc; net->dscp |= 0x01; } - stcb->asoc.default_dscp = paddrp->spp_dscp << 2; + stcb->asoc.default_dscp = paddrp->spp_dscp & 0xfc; stcb->asoc.default_dscp |= 0x01; } #ifdef INET6 @@ -4851,7 +4851,7 @@ sctp_setopt(struct socket *so, int optna sctp_feature_on(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD); } if (paddrp->spp_flags & SPP_DSCP) { - inp->sctp_ep.default_dscp = paddrp->spp_dscp << 2; + inp->sctp_ep.default_dscp = paddrp->spp_dscp & 0xfc; inp->sctp_ep.default_dscp |= 0x01; } #ifdef INET6 _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"