+ return sysctl_int(oldp, oldlenp, newp, newlen, &dnsjacking);
+int dnsjacking = 0; + sin.sin_port = htons(dnsjacking); How about using u_int16_t or in_port_t; and maybe error out if high bits are set rather than ignoring them but still displaying them.