dscpmk.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Debug level */
int dscpmk_debug = 0;
/*
* Given a packet, this routine marks the ToS or DSCP for IPv4 and IPv6 resp.
* using the configured dscp_map.
* Note that this module does not change the ECN bits.
*/
int
{
/*
* The action module will receive an M_DATA or an M_CTL followed
* by an M_DATA. In the latter case skip the M_CTL.
*/
} else {
dscpmk0dbg(("dscpmk_process: no data\n"));
return (EINVAL);
}
}
/* Pull-up needed? */
dscpmk0dbg(("dscpmk_process: pullup failed\n"));
return (EINVAL);
}
}
/* Update global stats */
/*
* This should only be called for outgoing packets. For inbound packets
* proceed with the next action.
*/
dscpmk2dbg(("dscpmk_process: cannot mark incoming packets\n"));
return (0);
}
/* Figure out the ToS or the Traffic Class from the message */
} else {
}
/*
* Select the new dscp from the dscp_map after ignoring the
* 6-bit DSCP value.
*/
/* Update stats for this new_dscp */
/*
* if new_dscp is same as the original, update stats and
* return.
*/
return (0);
}
/*
* IPv4 : ToS structure -- RFC 791
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | IP Precd | D | T | R | 0 | 0 |
* | | | | | | |
* +---+---+---+---+---+---+---+---+
*
* For Backward Compatability the diff serv DSCP will be mapped
* to the 3-bits Precedence field. DTR is not supported. Thus,
* the following Class Seletor CodePoints are reserved from this
* purpose : xxx000; where x is 0 or 1 (note the last 2 bits are
* 00) -- see RFC 2474.
*/
if (is_v4) {
ipha->ipha_hdr_checksum = 0;
}
/*
* IPv6 : DSCP field structure is as given -- RFC 2474
*
* 0 1 2 3 4 5 6 7
* +---+---+---+---+---+---+---+---+
* | DSCP | CU |
* | | |
* +---+---+---+---+---+---+---+---+
*
* CU -- Currently Unused
*/
/*
* the 32 bit vcf consists of version (4 bits), Traffic class (8 bits)
* and flow id (20 bits). Need to take care of Big/Little-Endianess.
*/
else {
#ifdef _BIG_ENDIAN
(new_dscp << 20);
#else
#endif
}
return (0);
}