diff options
author | Stefan Siegl <stesie@brokenpipe.de> | 2007-10-09 21:54:24 +0000 |
---|---|---|
committer | Stefan Siegl <stesie@brokenpipe.de> | 2007-10-09 21:54:24 +0000 |
commit | 573f8ac83fe0855b9d7ef44713f304cf91365acc (patch) | |
tree | 01aeb10ff7b7c05b8606f91a76f20cbcfa7c259f /pfinet | |
parent | c8eb5ad02c3d19d2ae6c8a11649aa7e33b3fa0aa (diff) |
2007-10-09 Stefan Siegl <stesie@brokenpipe.de>
* iioctl-ops.c: Include <net/sock.h>.
(siocgifXaddr): Return EINVAL unless socket family is AF_INET.
(siocsifXaddr): Likewise.
Diffstat (limited to 'pfinet')
-rw-r--r-- | pfinet/ChangeLog | 6 | ||||
-rw-r--r-- | pfinet/iioctl-ops.c | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/pfinet/ChangeLog b/pfinet/ChangeLog index 3a50d343..0bef0da0 100644 --- a/pfinet/ChangeLog +++ b/pfinet/ChangeLog @@ -1,3 +1,9 @@ +2007-10-09 Stefan Siegl <stesie@brokenpipe.de> + + * iioctl-ops.c: Include <net/sock.h>. + (siocgifXaddr): Return EINVAL unless socket family is AF_INET. + (siocsifXaddr): Likewise. + 2007-10-08 Stefan Siegl <stesie@brokenpipe.de> [task #5470: ``Implement pfinet6''] diff --git a/pfinet/iioctl-ops.c b/pfinet/iioctl-ops.c index a2a37144..a6a0cbc8 100644 --- a/pfinet/iioctl-ops.c +++ b/pfinet/iioctl-ops.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2007 Free Software Foundation, Inc. Written by Marcus Brinkmann. This file is part of the GNU Hurd. @@ -34,6 +34,7 @@ #include <sys/ioctl.h> #include <net/if.h> +#include <net/sock.h> extern struct notifier_block *netdev_chain; @@ -87,17 +88,20 @@ siocgifXaddr (io_t port, sockaddr_t *addr, enum siocgif_type type) { + struct sock_user *user = begin_using_socket_port (port); error_t err = 0; struct device *dev; struct sockaddr_in *sin = (struct sockaddr_in *) addr; uint32_t addrs[4]; - if (!port) + if (!user) return EOPNOTSUPP; dev = get_dev (ifnam); if (!dev) err = ENODEV; + else if (user->sock->sk->family != AF_INET) + err = EINVAL; else { sin->sin_family = AF_INET; @@ -105,7 +109,9 @@ siocgifXaddr (io_t port, inquire_device (dev, &addrs[0], &addrs[1], &addrs[2], &addrs[3]); sin->sin_addr.s_addr = addrs[type]; } + __mutex_unlock (&global_lock); + end_using_socket_port (user); return err; } @@ -142,6 +148,8 @@ siocsifXaddr (io_t port, err = ENODEV; else if (sin->sin_family != AF_INET) err = EINVAL; + else if (user->sock->sk->family != AF_INET) + err = EINVAL; else { inquire_device (dev, &addrs[0], &addrs[1], &addrs[2], &addrs[3]); |