rem: if (command->op == NET_STACK_GETSOCKOPT) {
add: if (command->op == (int32) NET_STACK_GETSOCKOPT) {
context: connection_runner(void *_cookie){	connection_cookie *cookie = (connection_cookie *)_cookie;	bool run = true;	while (run) {		net_area_info area[MAX_NET_AREAS];		net_command *command;		status_t status = B_OK;		struct stack_driver_args *args;		int32 index;		ssize_t bytes = read_port(cookie->localPort,&index,NULL,0);		if (bytes < B_OK)			break;		if (index >= NUM_COMMANDS || index < 0) {			printf("got bad command index: %lx\n",index);			continue;		}		command = cookie->commands + index;		if (clone_command_areas(area, command) < B_OK) {			printf("could not clone command areas!\n");			continue;		}		args = convert_to_local(&command->area[0],&area[0], command->data);		printf("command %lx (index = %ld), buffer = %p, length = %ld, result = %ld\n",			command->op, index, args, command->length, command->result);		switch (command->op) {			case NET_STACK_OPEN:				cookie->openFlags = args->u.integer;				printf("opening socket, mode = %lx!\n", cookie->openFlags);				break;			case NET_STACK_CLOSE:				printf("closing socket...\n");				run = false;				break;			case NET_STACK_SOCKET:				printf("open a socket... family = %d, type = %d, proto = %d\n",					args->u.socket.family, args->u.socket.type, args->u.socket.proto);				status = core->socket_init(&cookie->socket);				if (status == 0)					status = core->socket_create(cookie->socket, args->u.socket.family, args->u.socket.type, args->u.socket.proto);				break;			case NET_STACK_GETSOCKOPT:			case NET_STACK_SETSOCKOPT:				if (command->op == NET_STACK_GETSOCKOPT) {					status = core->socket_getsockopt(cookie->socket, args->u.sockopt.level, args->u.sockopt.option, 						convert_to_local(&command->area[1], &area[1], args->u.sockopt.optval),						(size_t *) &args->u.sockopt.optlen);				} else {					status = core->socket_setsockopt(cookie->socket, args->u.sockopt.level, args->u.sockopt.option, 						(const void *) convert_to_local(&command->area[1], &area[1], args->u.sockopt.optval),						args->u.sockopt.optlen);				}				break;			case NET_STACK_CONNECT:			case NET_STACK_BIND:			case NET_STACK_GETSOCKNAME:			case NET_STACK_GETPEERNAME: {				caddr_t addr = (caddr_t) convert_to_local(&command->area[1], &area[1], args->u.sockaddr.addr);				switch (command->op) {					case NET_STACK_CONNECT:						status = core->socket_connect(cookie->socket, addr, args->u.sockaddr.addrlen);						break;					case NET_STACK_BIND:						status = core->socket_bind(cookie->socket, addr, args->u.sockaddr.addrlen);						break;					case NET_STACK_GETSOCKNAME:						status = core->socket_getsockname(cookie->socket, (struct sockaddr *) addr, &args->u.sockaddr.addrlen);						break;					case NET_STACK_GETPEERNAME:						status = core->socket_getpeername(cookie->socket,(struct sockaddr *) addr, &args->u.sockaddr.addrlen);						break;				}				break;			}			case NET_STACK_LISTEN:				status = core->socket_listen(cookie->socket, args->u.integer);				break;			case NET_STACK_GET_COOKIE:				/* this is needed by accept() call, to be able to pass back				 * in NET_STACK_ACCEPT opcode the cookie of the filedescriptor to 				 * use for the new accepted socket				 */				*((void **) args) = cookie;				break;							case NET_STACK_ACCEPT:			{				connection_cookie *otherCookie = (connection_cookie *) args->u.accept.cookie;				status = core->socket_accept(cookie->socket, &otherCookie->socket,					convert_to_local(&command->area[1], &area[1], args->u.accept.addr),					&args->u.accept.addrlen);			}			case NET_STACK_SEND:			{				struct iovec iov;				int flags = 0;				iov.iov_base = convert_to_local(&command->area[1], &area[1], args->u.transfer.data);				iov.iov_len = args->u.transfer.datalen;				status = core->socket_writev(cookie->socket, &iov, flags);				break;			}			case NET_STACK_RECV:			{				struct iovec iov;				int flags = 0;				iov.iov_base = convert_to_local(&command->area[1], &area[1], args->u.transfer.data);				iov.iov_len = args->u.transfer.datalen;				/* flags gets ignored here... */				status = core->socket_readv(cookie->socket, &iov, &flags);				break;			}			case NET_STACK_RECVFROM:			{				struct msghdr *msg = (struct msghdr *) args;				int received;				msg->msg_name = convert_to_local(&command->area[1],&area[1],msg->msg_name);				msg->msg_iov = convert_to_local(&command->area[2],&area[2],msg->msg_iov);				msg->msg_control = convert_to_local(&command->area[3],&area[3],msg->msg_control);				status = core->socket_recv(cookie->socket, msg, (caddr_t)&msg->msg_namelen,&received);				if (status == 0)					status = received;				msg->msg_name = convert_to_foreign(&command->area[1],&area[1],msg->msg_name);				msg->msg_iov = convert_to_foreign(&command->area[2],&area[2],msg->msg_iov);				msg->msg_control = convert_to_foreign(&command->area[3],&area[3],msg->msg_control);				break;			}			case NET_STACK_SENDTO:			{				struct msghdr *msg = (struct msghdr *) args;				int sent;				msg->msg_name = convert_to_local(&command->area[1],&area[1],msg->msg_name);				msg->msg_iov = convert_to_local(&command->area[2],&area[2],msg->msg_iov);				msg->msg_control = convert_to_local(&command->area[3],&area[3],msg->msg_control);					status = core->socket_send(cookie->socket,msg,msg->msg_flags,&sent);				if (status == 0)					status = sent;				msg->msg_name = convert_to_foreign(&command->area[1],&area[1],msg->msg_name);				msg->msg_iov = convert_to_foreign(&command->area[2],&area[2],msg->msg_iov);				msg->msg_control = convert_to_foreign(&command->area[3],&area[3],msg->msg_control);				break;			}			case NET_STACK_NOTIFY_SOCKET_EVENT:			{				struct notify_socket_event_args *nsea = (struct notify_socket_event_args *) args;				cookie->socket_event_port = nsea->notify_port;				cookie->notify_cookie = nsea->cookie;						if (cookie->socket_event_port != -1)					// start notify socket event					status = core->socket_set_event_callback(cookie->socket, on_socket_event, cookie, 0);				else					// stop notify socket event					status = core->socket_set_event_callback(cookie->socket, NULL, NULL, 0);				break;			}			case NET_STACK_SYSCTL:			{				status = core->net_sysctl(convert_to_local(&command->area[1],&area[1], args->u.sysctl.name),					args->u.sysctl.namelen, convert_to_local(&command->area[2],&area[2],args->u.sysctl.oldp),					convert_to_local(&command->area[3],&area[3],args->u.sysctl.oldlenp),					convert_to_local(&command->area[4],&area[4],args->u.sysctl.newp),					args->u.sysctl.newlen);				break;			}			case NET_STACK_STOP:				core->stop();				break;			case B_SET_BLOCKING_IO:				cookie->openFlags &= ~O_NONBLOCK;				break;			case B_SET_NONBLOCKING_IO:				cookie->openFlags |= O_NONBLOCK;				break;			case OSIOCGIFCONF:			case SIOCGIFCONF:			{				struct ifconf *ifc = (struct ifconf *) args;				ifc->ifc_buf = convert_to_local(&command->area[1], &area[1], ifc->ifc_buf);				status = core->socket_ioctl(cookie->socket, command->op, (char *) args);				ifc->ifc_buf = convert_to_foreign(&command->area[1], &area[1], ifc->ifc_buf);				break;			}			default:				status = core->socket_ioctl(cookie->socket,command->op, (char *) args);				break;		}		// mark the command as done		command->result = status;		command->op = 0;		delete_cloned_areas(area);		// notify the command pipeline that we're done with the command		release_sem(cookie->commandSemaphore);	}	cookie->runner = -1;	shutdown_connection(cookie);	return 0;}