On Mon, Jul 30, 2012 at 03:42:22PM +0000, Ed Maste wrote: > I'm working through a handful of unit test failures in the FreeBSD port > and the first issue I've come across is set_dscp failing - as it turns > out FreeBSD requires an int value for the setsockopt() call, not a char. > > Looking at the Linux ip(7) man page I see the statement "TOS is a byte," > but all of the Linux code examples I've found in a quick Google search > pass an int. > > I made the change below to fix the issue on FreeBSD but would like some > advice on whether it's suitable on Linux (or if I need some separate > #ifdef'd code).
I remember looking at the manpage when set_dscp() was introduced and seeing the advice that TOS was a byte, and then insisting that we actually use a char there. Now that I look at the Linux source, I see that it actually works OK with either one (!): if (optlen >= sizeof(int)) { if (get_user(val, (int __user *) optval)) return -EFAULT; } else if (optlen >= sizeof(char)) { unsigned char ucval; if (get_user(ucval, (unsigned char __user *) optval)) return -EFAULT; val = (int) ucval; } It's been like that as far back as 2.6.12 and probably farther, so no historical baggage to worry about either. IP_TOS doesn't appear to be in SUSv4, so there's no real "standard" to rely on. So: let's switch to using "int". If you send a patch with the changelog updated with the above information then I'll apply it. Thanks, Ben. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev