From f4814f877d82f6242c95c10bb661fadecc5ab24b Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 6 Oct 2000 15:14:12 +0000 Subject: 2000-10-06 Marcus Brinkmann * Makefile (SRCS): Add tunnel.c * tunnel.c: New file. * linux-src/net/ipv4/devinet.c (configure_device): New argument PEER. Implement support for setting the destination address for point-to-point interfaces. (inquire_device): New argument PEER. Implement support to get the destination address. * main.c: Include fcntl.h. Update prototype of configure_device. Set trivfs_support_read and trivfs_support_write to 1, as we support those in some cases now. For the same reason, set trivfs_allow_open to O_READ | O_WRITE. (pfinet_demuxer): If the port is not in the socketport_class, don't try io_server (so requests for trivfs are not catched too early). (find_device): Use setup_tunnel_device for tun* interfaces. (main): Add peer argument to configure_device call for the lo interface. * options.c: Update prototypes for configure_device, inquire_device. (options): Add --peer option. (stuct parse_interface): Add peer member. (parse_hook_add_interface): Initialize peer. (parse_opt): Add a case for --peer. Add peer argument to configure_device call. (add_dev_opts): Add peer variable, add it to inquire_device call arguments. Check for peer argument and add it to command line if it is there. * pfinet.h: Add prototype for setup_tunnel_device. --- pfinet/main.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'pfinet/main.c') diff --git a/pfinet/main.c b/pfinet/main.c index 591192ac..f364e550 100644 --- a/pfinet/main.c +++ b/pfinet/main.c @@ -26,20 +26,21 @@ #include #include #include +#include #include #include /* devinet.c */ extern error_t configure_device (struct device *dev, - uint32_t addr, uint32_t netmask); + uint32_t addr, uint32_t netmask, uint32_t peer); int trivfs_fstype = FSTYPE_MISC; int trivfs_fsid; -int trivfs_support_read = 0; -int trivfs_support_write = 0; +int trivfs_support_read = 1; +int trivfs_support_write = 1; int trivfs_support_exec = 0; -int trivfs_allow_open = 0; +int trivfs_allow_open = O_READ | O_WRITE; struct port_class *trivfs_protid_portclasses[1]; int trivfs_protid_nportclasses = 1; struct port_class *trivfs_cntl_portclasses[1]; @@ -58,10 +59,16 @@ pfinet_demuxer (mach_msg_header_t *inp, extern int socket_server (mach_msg_header_t *, mach_msg_header_t *); extern int startup_notify_server (mach_msg_header_t *, mach_msg_header_t *); - return (io_server (inp, outp) - || socket_server (inp, outp) - || trivfs_demuxer (inp, outp) - || startup_notify_server (inp, outp)); + + if (ports_lookup_port(pfinet_bucket, inp->msgh_local_port, socketport_class) != 0) + return (io_server (inp, outp) + || socket_server (inp, outp) + || trivfs_demuxer (inp, outp) + || startup_notify_server (inp, outp)); + else + return (socket_server (inp, outp) + || trivfs_demuxer (inp, outp) + || startup_notify_server (inp, outp)); } /* The system is going down; destroy all the extant port rights. That @@ -161,7 +168,9 @@ find_device (char *name, struct device **device) return 0; } - if (strncmp(name, "dummy", 5) == 0) + if (strncmp(name, "tun", 3) == 0) + setup_tunnel_device (name, device); + else if (strncmp(name, "dummy", 5) == 0) setup_dummy_device (name, device); else setup_ethernet_device (name, device); @@ -238,7 +247,7 @@ main (int argc, /* ifconfig lo up 127.0.0.1 netmask 0xff000000 */ configure_device (&loopback_dev, - htonl (INADDR_LOOPBACK), htonl (IN_CLASSA_NET)); + htonl (INADDR_LOOPBACK), htonl (IN_CLASSA_NET), htonl (INADDR_NONE)); __mutex_unlock (&global_lock); -- cgit v1.2.3