From 2a0220f19b262f122bc8dc7b68e6f4c0a5a16cae Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 11 Jan 2001 22:28:29 +0000 Subject: hurd/ 2001-01-07 Marcus Brinkmann * ioctl_types.h: Include , define types sockaddr_t and ifname_t for iioctl.defs. * iioctl.defs: New file for network interface ioctls. * pfinet.defs: Remove old RPCs, fix subsystem number, add RPC for SIOCGIFCONF. pfinet/ 2001-01-07 Marcus Brinkmann * pfinet-ops.c: New file to implement hurd/pfinet.defs. * iioctl-ops.c: New file to implement iioctl.defs. * linux-src/net/core/dev.c: If _HURD_, don't define netdev_chain as static. * glue-include/linux/if.h: New file, to avoid conflict between (imported by iioctl.defs) and linux version of it. * main.c (pfinet_demuxer): Prototype pfinet_server and iioctl_server, use them. * pfinet.h: New global variables pfinetctl, pfinet_owner and pfinet_group. * main.c (main): New variable ST. Request pfinetctl from trivfs_startup. Use it to determine the owner and group of the underlying node. * io-ops.c (S_io_reauthenticate): New index variable j. Set newuser->isroot also for owners of the underlying file and group owners. (S_io_restrict_auth): Likewise. * socket-ops.c: Include and . (S_socket_create): New variable isroot. If master->isroot is not set, use fshelp_isowner to check ownership and if to set it. Pass isroot to make_sock_user instead master->isroot. * linux-src/net/ipv4/devinet.c (configure_device): Accept new parameter BROADCAST, set ifa_broadcast if this is not INADDR_NONE. (inquire_device): Accept new parameter broadcast, set it. * main.c: Add new paramter to prototype of configure_device. (main): Add new parameter to call to configure_device. * options.c: Add new parameters to prototypes of configure_device and inquire_device. (trivfs_append_args): Define new variable BROAD, use its address as the new parameter for inquire_device. * linux-src/net/core/dev.c (dev_ifconf): Don't declare static if _HURD_. * linux-src/net/ipv4/devinet.c (inet_gifconf): If _HURD_, set sin_len member. * Makefile (MIGSRCS): Add pfinetServer.c and iioctlServer.c. (SRCS): Add pfinet-ops.c, iioctl-ops.c. --- pfinet/main.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'pfinet/main.c') diff --git a/pfinet/main.c b/pfinet/main.c index 713eddc7..e5cac55f 100644 --- a/pfinet/main.c +++ b/pfinet/main.c @@ -33,7 +33,8 @@ /* devinet.c */ extern error_t configure_device (struct device *dev, - uint32_t addr, uint32_t netmask, uint32_t peer); + uint32_t addr, uint32_t netmask, + uint32_t peer, uint32_t broadcast); int trivfs_fstype = FSTYPE_MISC; int trivfs_fsid; @@ -59,6 +60,8 @@ pfinet_demuxer (mach_msg_header_t *inp, extern int io_server (mach_msg_header_t *, mach_msg_header_t *); 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 *); + extern int pfinet_server (mach_msg_header_t *, mach_msg_header_t *); + extern int iioctl_server (mach_msg_header_t *, mach_msg_header_t *); /* We have several classes in one bucket, which need to be demuxed differently. */ @@ -70,11 +73,15 @@ pfinet_demuxer (mach_msg_header_t *inp, return (io_server (inp, outp) || socket_server (inp, outp) + || pfinet_server (inp, outp) + || iioctl_server (inp, outp) || trivfs_demuxer (inp, outp) || startup_notify_server (inp, outp)); } else return (socket_server (inp, outp) + || pfinet_server (inp, outp) + || iioctl_server (inp, outp) || trivfs_demuxer (inp, outp) || startup_notify_server (inp, outp)); } @@ -221,6 +228,7 @@ main (int argc, { error_t err; mach_port_t bootstrap; + struct stat st; pfinet_bucket = ports_create_bucket (); trivfs_protid_portclasses[0] = ports_create_class (trivfs_clean_protid, 0); @@ -255,7 +263,8 @@ 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_NONE)); + htonl (INADDR_LOOPBACK), htonl (IN_CLASSA_NET), + htonl (INADDR_NONE), htonl (INADDR_NONE)); __mutex_unlock (&global_lock); @@ -275,10 +284,26 @@ main (int argc, err = trivfs_startup (bootstrap, 0, trivfs_cntl_portclasses[0], pfinet_bucket, - trivfs_protid_portclasses[0], pfinet_bucket, 0); + trivfs_protid_portclasses[0], pfinet_bucket, + &pfinetctl); + if (err) error (1, err, "contacting parent"); + /* Initialize status from underlying node. */ + err = io_stat (pfinetctl->underlying, &st); + if (err) + { + /* We cannot stat the underlying node. Fallback to the defaults. */ + pfinet_owner = pfinet_group = 0; + err = 0; + } + else + { + pfinet_owner = st.st_uid; + pfinet_group = st.st_gid; + } + /* Launch */ ports_manage_port_operations_multithread (pfinet_bucket, pfinet_demuxer, -- cgit v1.2.3