FreeBSD/sys/netinet/ip_ecn.c
/*
 * modify outer ECN (TOS) field on ingress operation (tunnel encapsulation).
 */
modify outer ECN (TOS) field on ingress operation (tunnel encapsulation).
modify outer ECN ( TOS ) field on ingress operation ( tunnel encapsulation ) .
void
ip_ecn_ingress(int mode, u_int8_t *outer, const u_int8_t *inner)
{
	if (!outer || !inner)
		panic("NULL pointer passed to ip_ecn_ingress");
	*outer = *inner;
	switch (mode) {
	case ECN_ALLOWED:		
		if ((*inner & IPTOS_ECN_MASK) == IPTOS_ECN_CE)
			*outer &= ~IPTOS_ECN_ECT1;
		break;
	case ECN_FORBIDDEN:		
		*outer &= ~IPTOS_ECN_MASK;
		break;
	case ECN_NOCARE:	
		break;
	}
}
void ip_ecn_ingress ( int mode , u_int8_t * outer , const u_int8_t * inner ) { if ( ! outer || ! inner ) panic ( " " ) ; * outer = * inner ; switch ( mode ) { case ECN_ALLOWED : if ( ( * inner & IPTOS_ECN_MASK ) == IPTOS_ECN_CE ) * outer &= ~ IPTOS_ECN_ECT1 ; break ; case ECN_FORBIDDEN : * outer &= ~ IPTOS_ECN_MASK ; break ; case ECN_NOCARE : break ; } }
modify outer ECN (TOS) field on ingress operation (tunnel encapsulation).
modify outer ECN ( TOS ) field on ingress operation ( tunnel encapsulation ) .
/* ECN allowed */ /*
		 * full-functionality: if the inner is CE, set ECT(0)
		 * to the outer.  otherwise, copy the ECN field.
		 */ /* ECN forbidden */ /*
		 * limited-functionality: set not-ECT to the outer
		 */ /* no consideration to ECN */