summaryrefslogtreecommitdiff
path: root/pfinet/linux-src/net
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2000-02-04 06:32:39 +0000
committerRoland McGrath <roland@gnu.org>2000-02-04 06:32:39 +0000
commitdb9a26cbd125ec106e040ea6084911f9bc0c0198 (patch)
tree8394aedf0addf9de2afd46d00c192d20d9eb9092 /pfinet/linux-src/net
parent8880a73970b23f10c720011cb910c0e0e1e02975 (diff)
2000-02-03 Roland McGrath <roland@baalperazim.frob.com>
Complete overhaul of pfinet based on the IPv4 networking code from the Linux 2.2.12 kernel sources. This page describes a single unified set of interdependent changes, but there are so many changes that I have broken up the log entry into paragraphs based on rough topical divisions of the work involved. Subset of verbatim Linux 2.2.12 sources imported on a vendor branch. * linux-src: New directory, see README for details. * README: New file, describes linux-src layout and procedures for tracking Linux source updates. Light modifications to linux-src files to avoid really bending over backwards with the glue macros. All modifications to files in linux-src are conditionalized by #ifdef _HURD_. * linux-src/include/linux/net.h [_HURD_] (struct socket): New members refcnt and identity; elide members fasync_list, file. * linux-src/include/linux/rtnetlink.h [! CONFIG_RTNETLINK] (rtnl_shlock, rtnl_shunlock) [! _HURD_]: Conditionalize contents on this, making these no-ops #ifdef _HURD_. * linux-src/net/core/dev.c [_HURD_] (dev_ioctl): Don't define the function, instead #define it to 0. * linux-src/net/ipv4/af_inet.c [_HURD_] (inet_ioctl): Likewise. * linux-src/net/ipv4/arp.c [_HURD_] (arp_ioctl): Likewise. * linux-src/net/ipv4/udp.c [_HURD_] (udp_ioctl): Likewise. * linux-src/net/ipv4/tcp.c [_HURD_] (tcp_ioctl): Likewise. [_HURD_] (tcp_tiocinq): New function, TIOCINQ code from tcp_ioctl. * linux-src/net/ipv4/devinet.c [_HURD_] (devinet_ioctl): Don't define the function, instead #define it to 0. [_HURD_] (configure_device): New function, cobbled from SIOCSIFADDR and SIOCSIFNETMASK code from devinet_ioctl. * glue-include/asm, glue-include/linux: New directories. These contain glue kludge headers that replace all of the Linux <asm/*.h> headers except checksum.h, and several of the Linux <linux/*.h> headers (the remainder come from linux-src/include/linux and are mostly unmodified). * glue-include/asm/atomic.h: New file, glue replacement header. * glue-include/asm/bitops.h: New file, glue replacement header. * glue-include/asm/byteorder.h: New file, glue replacement header. * glue-include/asm/checksum.h: New file, glue replacement header. * glue-include/asm/errno.h: New file, glue replacement header. * glue-include/asm/hardirq.h: New file, glue replacement header. * glue-include/asm/init.h: New file, glue replacement header. * glue-include/asm/segment.h: New file, glue replacement header. * glue-include/asm/spinlock.h: New file, glue replacement header. * glue-include/asm/system.h: New file, glue replacement header. * glue-include/asm/types.h: New file, glue replacement header. * glue-include/asm/uaccess.h: New file, glue replacement header. * glue-include/linux/autoconf.h: New file, glue replacement header. * glue-include/linux/binfmts.h: New file, glue replacement header. * glue-include/linux/config.h: New file, glue replacement header. * glue-include/linux/errno.h: New file, glue replacement header. * glue-include/linux/fcntl.h: New file, glue replacement header. * glue-include/linux/fs.h: New file, glue replacement header. * glue-include/linux/in.h: New file, glue replacement header. * glue-include/linux/in6.h: New file, glue replacement header. * glue-include/linux/interrupt.h: New file, glue replacement header. * glue-include/linux/ioctl.h: New file, glue replacement header. * glue-include/linux/ipv6.h: New file, glue replacement header. * glue-include/linux/kernel.h: New file, glue replacement header. * glue-include/linux/limits.h: New file, glue replacement header. * glue-include/linux/major.h: New file, glue replacement header. * glue-include/linux/malloc.h: New file, glue replacement header. * glue-include/linux/mm.h: New file, glue replacement header. * glue-include/linux/param.h: New file, glue replacement header. * glue-include/linux/personality.h: New file, glue replacement header. * glue-include/linux/poll.h: New file, glue replacement header. * glue-include/linux/proc_fs.h: New file, glue replacement header. * glue-include/linux/sched.h: New file, glue replacement header. * glue-include/linux/slab.h: New file, glue replacement header. * glue-include/linux/socket.h: New file, glue replacement header. * glue-include/linux/sockios.h: New file, glue replacement header. * glue-include/linux/stat.h: New file, glue replacement header. * glue-include/linux/string.h: New file, glue replacement header. * glue-include/linux/termios.h: New file, glue replacement header. * glue-include/linux/time.h: New file, glue replacement header. * glue-include/linux/timer.h: New file, glue replacement header. * glue-include/linux/timex.h: New file, glue replacement header. * glue-include/linux/types.h: New file, glue replacement header. * glue-include/linux/un.h: New file, glue replacement header. * glue-include/linux/version.h: New file, glue replacement header. * glue-include/linux/wait.h: New file, glue replacement header. * kmem_cache.c: New file. Glue code replaces Linux kmem_cache_t et al. * stubs.c: New file. No-op functions and stub variables for a few things the Linux networking code needs to link. * Makefile (core-srcs, arch-lib-srcs, ethernet-srcs, ipv4-srcs): New variables, listing sources used from linux-src subdirectories. (LINUXSRCS): Define using those. (SRCS): Remove devices.c; add kmem_cache.c, stubs.c. (UNUSEDSRC): Variable removed. (vpath %.c): Remove vpath for $(srcdir)/linux-inet directory. Add vpaths for $(srcdir)/linux-src subdirectories. (CPPFLAGS): Add -D_HURD_SYSTYPE defining it to $(asm_syntax) as a double-quoted string. Add -I's for glue-include and linux-src/include. * pfinet.h: Include <sys/socket.h>, and not <linux/netdevice.h>. (master_device): Remove decl. (global_lock, packet_queue_lock): Remove common defns. (global_lock, net_bh_lock): Declare them as externs. (struct sockaddr): Remove len member, make address member just a struct sockaddr rather than a 0-length array. (setup_loopback_device, become_task_protid, become_task): Remove decls. (ethernet_initialize): Declare it. (input_work_thread): Remove decl. (net_bh_thread): Declare it. (tcp_readable): Remove decl. (tcp_tiocinq): Declare it. * config.h: Rewritten based on Linux 2.2.12 set of CONFIG_* options. (CONFIG_NET, CONFIG_INET, CONFIG_SKB_LARGE): These are the only Linux config options we set. (CONFIG_IP_NOSIOCRT): New macro (not a proper config option, but used conveniently in the code). * ethernet.c (ethernet_set_multi): Take only one parameter. Remove assert, since we always get passed IGMP_ALL_HOSTS. (ethernet_thread): Make static. (ethernet_demuxer): Use __mutex_lock in place of mutex_lock, so as to get cthreads instead of linux/spinlock.h glue macros. Lock net_bh_lock instead of global_lock. Set SKB->protocol with eth_type_trans before calling netif_rx. (ethernet_initialize): New function, one-time initialization broken out of ethernet_open. (ethernet_open): Ports setup moved to ethernet_initialize. Don't use `errno' to avoid glue conflicts. Use get_privileged_ports here to get the master device port, and deallocate it after calling device_open. (ethernet_xmit): Use assert_perror. Only one arg to dev_kfree_skb now. (setup_ethernet_device): Change initializations for structure changes. Call dev_init_buffers and register_netdevice on the device. * timer-emul.c (all functions): Use __mutex_lock instead of mutex_lock. Adjust for renaming of `prevp' member to `prev' in struct timer_list. (mod_timer): New function. * socket.c (proto_ops): Variable removed. (net_families): New variable replaces it. (sock_register): Rewritten for new calling convention, set net_families rather than proto_ops. (make_sock_user, clean_socketport, sock_alloc, sock_release): Functions moved here from misc.c. * sched.c (packet_queue_lock): Variable removed. (net_bh_lock, net_bh_wakeup): New variables. (current): Variable removed (now a macro in the glue headers). (interruptible_sleep_on, wake_up_interruptible): Functions removed. They are replaced by inlines in the glue headers. (become_task, become_task_protid): Functions removed; they are replaced by macros in glue-include/linux/sched.h. (net_bh_worker): New function. * loopback.c: Completely rewritten, mostly copied from linux-2.2.12's drivers/net/loopback.c source file. * io-ops.c (all functions): Use __mutex_lock in place of mutex_lock. (S_io_write): Call ops->sendmsg instead of ops->write, which no longer exists. If O_NONBLOCK is set, set MSG_DONTWAIT in msg_flags. (S_io_read): Call ops->recvmsg instead of ops->read, which no longer exists If O_NONBLOCK is set, pass MSG_DONTWAIT. (S_io_readable): Use USER->sock->data in place of USER->sock->sk. For SOCK_STREAM and SOCK_SEQPACKET types, call tcp_tiocinq. (S_io_set_all_openmodes, S_io_get_openmodes, S_io_set_some_openmodes, S_io_clear_some_openmodes): Member USER->sock->userflags is now renamed USER->sock->flags. (S_io_select): Completely rewritten using ops->poll. (select_wait): Function removed. (S_io_stat): Set st_mode to reflect S_IFSOCK. * socket-ops.c (all functions): Use __mutex_lock instead of mutex_lock. (S_socket_create): Don't set SOCK->ops or call SOCK->ops->create. Instead, call net_families[PF_INET]->create. (S_socket_listen): Remove extra checks; just call ops->listen. (S_socket_accept): Remove extra checks before ops->accept call. Avoid use of goto. (S_socket_connect): Remove extra checks; just call ops->connect. (S_socket_bind): Adjust for struct sock_addr changes. (S_socket_create_address): Likewise. (S_socket_whatis_address): Likewise. (S_socket_connect2): Don't diddle data structures after ops->socketpair call. (S_socket_getopt): Use sock_getsockopt if LEVEL is SOL_SOCKET. Accept any data size, not just sizeof (int). (S_socket_setopt): Use sock_setsockopt if LEVEL is SOL_SOCKET. (S_socket_send): Always use ops->sendmsg instead of ops->send or ops->sendto, which no longer exist. If O_NONBLOCK is set, set MSG_DONTWAIT in msg_flags. (S_socket_recv): Always use ops->recvmsg instead of ops->recv, which no longer exists. If O_NONBLOCK is set, set MSG_DONTWAIT in flags. Check for error from S_socket_create_address. * main.c (find_device): Don't try to set ether_dev.pa_mask (it's gone). (main): Don't call init_devices. Call ethernet_initialize. Start net_bh_worker instead of input_work_thread. Don't call setup_loopback_device. Instead, take global_lock, do prepare_current, and then call sk_init, skb_init, inet_proto_init, and net_dev_init. Keep global_lock held while calling argp_parse. Call arrange_shutdown_notification only after all that. Fix error call for "contacting parent" to pass ERR instead of errno. * options.c (ADDR): #undef before defining macro. (parse_opt): #if 0 out EDESTADDRREQ check (I don't understand it). To apply settings, call configure_devices. (ADD_ADDR_OPT): #if 0 --address and --netmask options. Needs fixed. * misc.c (make_sock_user, clean_socketport, sock_alloc, sock_release): Functions moved to socket.c. (sock_release_peer): Function removed. (make_sockaddr_port): Use struct sockaddr_storage to size buffer. Fix size calculation for new struct sock_addr layout. Initialize sa_family and sa_len of new struct sock_addr. Remove the old Linux (2.0.??) network stack and the glue code for it. * linux-inet, asm, linux: Directories and all files removed. Some of the new files in glue-include came from the old glue headers in the asm and linux directories, but most were substantially modified. * devices.c: File removed. The equivalent glue is now elsewhere.
Diffstat (limited to 'pfinet/linux-src/net')
-rw-r--r--pfinet/linux-src/net/core/dev.c200
-rw-r--r--pfinet/linux-src/net/ipv4/af_inet.c116
-rw-r--r--pfinet/linux-src/net/ipv4/arp.c64
-rw-r--r--pfinet/linux-src/net/ipv4/devinet.c70
-rw-r--r--pfinet/linux-src/net/ipv4/tcp.c159
-rw-r--r--pfinet/linux-src/net/ipv4/udp.c104
6 files changed, 401 insertions, 312 deletions
diff --git a/pfinet/linux-src/net/core/dev.c b/pfinet/linux-src/net/core/dev.c
index cc9584a1..1dba3926 100644
--- a/pfinet/linux-src/net/core/dev.c
+++ b/pfinet/linux-src/net/core/dev.c
@@ -115,7 +115,7 @@ const char *if_port_text[] = {
* and the routines to invoke.
*
* Why 16. Because with 16 the only overlap we get on a hash of the
- * low nibble of the protocol value is RARP/SNAP/X.25.
+ * low nibble of the protocol value is RARP/SNAP/X.25.
*
* 0800 IP
* 0001 802.3
@@ -137,13 +137,13 @@ struct packet_type *ptype_all = NULL; /* Taps */
* Device list lock. Setting it provides that interface
* will not disappear unexpectedly while kernel sleeps.
*/
-
+
atomic_t dev_lockct = ATOMIC_INIT(0);
/*
* Our notifier list
*/
-
+
static struct notifier_block *netdev_chain=NULL;
/*
@@ -189,7 +189,7 @@ int netdev_nit=0;
* change it and subsequent readers will get broken packet.
* --ANK (980803)
*/
-
+
void dev_add_pack(struct packet_type *pt)
{
int hash;
@@ -207,7 +207,7 @@ void dev_add_pack(struct packet_type *pt)
ptype_all=pt;
}
else
- {
+ {
hash=ntohs(pt->type)&15;
pt->next = ptype_base[hash];
ptype_base[hash] = pt;
@@ -218,7 +218,7 @@ void dev_add_pack(struct packet_type *pt)
/*
* Remove a protocol ID from the list.
*/
-
+
void dev_remove_pack(struct packet_type *pt)
{
struct packet_type **pt1;
@@ -251,15 +251,15 @@ void dev_remove_pack(struct packet_type *pt)
******************************************************************************************/
-/*
+/*
* Find an interface by name.
*/
-
+
struct device *dev_get(const char *name)
{
struct device *dev;
- for (dev = dev_base; dev != NULL; dev = dev->next)
+ for (dev = dev_base; dev != NULL; dev = dev->next)
{
if (strcmp(dev->name, name) == 0)
return(dev);
@@ -271,7 +271,7 @@ struct device * dev_get_by_index(int ifindex)
{
struct device *dev;
- for (dev = dev_base; dev != NULL; dev = dev->next)
+ for (dev = dev_base; dev != NULL; dev = dev->next)
{
if (dev->ifindex == ifindex)
return(dev);
@@ -283,7 +283,7 @@ struct device *dev_getbyhwaddr(unsigned short type, char *ha)
{
struct device *dev;
- for (dev = dev_base; dev != NULL; dev = dev->next)
+ for (dev = dev_base; dev != NULL; dev = dev->next)
{
if (dev->type == type &&
memcmp(dev->dev_addr, ha, dev->addr_len) == 0)
@@ -311,7 +311,7 @@ int dev_alloc_name(struct device *dev, const char *name)
}
return -ENFILE; /* Over 100 of the things .. bail out! */
}
-
+
struct device *dev_alloc(const char *name, int *err)
{
struct device *dev=kmalloc(sizeof(struct device)+16, GFP_KERNEL);
@@ -340,7 +340,7 @@ void netdev_state_change(struct device *dev)
/*
* Find and possibly load an interface.
*/
-
+
#ifdef CONFIG_KMOD
void dev_load(const char *name)
@@ -363,9 +363,9 @@ static int default_rebuild_header(struct sk_buff *skb)
}
/*
- * Prepare an interface for use.
+ * Prepare an interface for use.
*/
-
+
int dev_open(struct device *dev)
{
int ret = 0;
@@ -380,15 +380,15 @@ int dev_open(struct device *dev)
/*
* Call device private open method
*/
-
- if (dev->open)
+
+ if (dev->open)
ret = dev->open(dev);
/*
* If it went open OK then:
*/
-
- if (ret == 0)
+
+ if (ret == 0)
{
/*
* nil rebuild_header routine,
@@ -404,7 +404,7 @@ int dev_open(struct device *dev)
dev->flags |= (IFF_UP | IFF_RUNNING);
/*
- * Initialize multicasting status
+ * Initialize multicasting status
*/
dev_mc_upload(dev);
@@ -448,7 +448,7 @@ void dev_clear_fastroute(struct device *dev)
/*
* Completely shutdown an interface.
*/
-
+
int dev_close(struct device *dev)
{
if (!(dev->flags&IFF_UP))
@@ -462,7 +462,7 @@ int dev_close(struct device *dev)
* Call the device specific close. This cannot fail.
* Only if device is UP
*/
-
+
if (dev->stop)
dev->stop(dev);
@@ -513,7 +513,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct device *dev)
struct packet_type *ptype;
get_fast_time(&skb->stamp);
- for (ptype = ptype_all; ptype!=NULL; ptype = ptype->next)
+ for (ptype = ptype_all; ptype!=NULL; ptype = ptype->next)
{
/* Never send packets back to the socket
* they originated from - MvS (miquels@drinkel.ow.org)
@@ -558,7 +558,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct device *dev)
/*
* Fast path for loopback frames.
*/
-
+
void dev_loopback_xmit(struct sk_buff *skb)
{
struct sk_buff *newskb=skb_clone(skb, GFP_ATOMIC);
@@ -608,7 +608,7 @@ int dev_queue_xmit(struct sk_buff *skb)
made by us here.
*/
if (dev->flags&IFF_UP) {
- if (netdev_nit)
+ if (netdev_nit)
dev_queue_xmit_nit(skb,dev);
if (dev->hard_start_xmit(skb, dev) == 0) {
end_bh_atomic();
@@ -723,7 +723,7 @@ static void dev_clear_backlog(struct device *dev)
*
* It looks better to use net_bh trick, at least
* to be sure, that we keep interrupt latency really low. --ANK (980727)
- */
+ */
if (backlog.qlen) {
start_bh_atomic();
@@ -751,7 +751,7 @@ static void dev_clear_backlog(struct device *dev)
/*
* Receive a packet from a device driver and queue it for the upper
- * (protocol) levels. It always succeeds.
+ * (protocol) levels. It always succeeds.
*/
void netif_rx(struct sk_buff *skb)
@@ -802,13 +802,13 @@ static inline void handle_bridge(struct sk_buff *skb, unsigned short type)
* We pass the bridge a complete frame. This means
* recovering the MAC header first.
*/
-
+
int offset;
skb=skb_clone(skb, GFP_ATOMIC);
- if(skb==NULL)
+ if(skb==NULL)
return;
-
+
offset=skb->data-skb->mac.raw;
skb_push(skb,offset); /* Put header back on for bridge */
@@ -828,7 +828,7 @@ static inline void handle_bridge(struct sk_buff *skb, unsigned short type)
* This is run as a bottom half after an interrupt handler that does
* mark_bh(NET_BH);
*/
-
+
void net_bh(void)
{
struct packet_type *ptype;
@@ -854,7 +854,7 @@ void net_bh(void)
if (qdisc_head.forw != &qdisc_head)
qdisc_run_queues();
-
+
/*
* Any data left to process. This may occur because a
* mark_bh() is done after we empty the queue including
@@ -869,7 +869,7 @@ void net_bh(void)
* disabling interrupts.
*/
- while (!skb_queue_empty(&backlog))
+ while (!skb_queue_empty(&backlog))
{
struct sk_buff * skb;
@@ -904,7 +904,7 @@ void net_bh(void)
/*
* Bump the pointer to the next structure.
- *
+ *
* On entry to the protocol layer. skb->data and
* skb->nh.raw point to the MAC and encapsulated data
*/
@@ -919,7 +919,7 @@ void net_bh(void)
}
/*
- * Fetch the packet protocol ID.
+ * Fetch the packet protocol ID.
*/
type = skb->protocol;
@@ -930,7 +930,7 @@ void net_bh(void)
* bridging code (if this protocol is to be bridged).
* If it is bridged then move on
*/
- handle_bridge(skb, type);
+ handle_bridge(skb, type);
#endif
/*
@@ -953,7 +953,7 @@ void net_bh(void)
}
}
- for (ptype = ptype_base[ntohs(type)&15]; ptype != NULL; ptype = ptype->next)
+ for (ptype = ptype_base[ntohs(type)&15]; ptype != NULL; ptype = ptype->next)
{
if (ptype->type == type && (!ptype->dev || ptype->dev==skb->dev))
{
@@ -989,16 +989,16 @@ void net_bh(void)
/*
* Has an unknown packet has been received ?
*/
-
+
else {
kfree_skb(skb);
}
} /* End of queue loop */
-
+
/*
* We have emptied the queue
*/
-
+
/*
* One last output flush.
*/
@@ -1067,9 +1067,9 @@ static int dev_ifname(struct ifreq *arg)
int err;
/*
- * Fetch the caller's info block.
+ * Fetch the caller's info block.
*/
-
+
err = copy_from_user(&ifr, arg, sizeof(struct ifreq));
if (err)
return -EFAULT;
@@ -1100,9 +1100,9 @@ static int dev_ifconf(char *arg)
int i;
/*
- * Fetch the caller's info block.
+ * Fetch the caller's info block.
*/
-
+
if (copy_from_user(&ifc, arg, sizeof(struct ifconf)))
return -EFAULT;
@@ -1110,7 +1110,7 @@ static int dev_ifconf(char *arg)
len = ifc.ifc_len;
/*
- * Loop over the interfaces, and write an info block for each.
+ * Loop over the interfaces, and write an info block for each.
*/
total = 0;
@@ -1131,14 +1131,14 @@ static int dev_ifconf(char *arg)
}
/*
- * All done. Write the updated control block back to the caller.
+ * All done. Write the updated control block back to the caller.
*/
ifc.ifc_len = total;
if (copy_to_user(arg, &ifc, sizeof(struct ifconf)))
- return -EFAULT;
+ return -EFAULT;
- /*
+ /*
* Both BSD and Solaris return 0 here, so we do too.
*/
return 0;
@@ -1154,7 +1154,7 @@ static int sprintf_stats(char *buffer, struct device *dev)
{
struct net_device_stats *stats = (dev->get_stats ? dev->get_stats(dev): NULL);
int size;
-
+
if (stats)
size = sprintf(buffer, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu %8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
dev->name,
@@ -1181,31 +1181,31 @@ static int sprintf_stats(char *buffer, struct device *dev)
* Called from the PROCfs module. This now uses the new arbitrary sized /proc/net interface
* to create /proc/net/dev
*/
-
+
int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len=0;
off_t begin=0;
off_t pos=0;
int size;
-
+
struct device *dev;
- size = sprintf(buffer,
+ size = sprintf(buffer,
"Inter-| Receive | Transmit\n"
" face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed\n");
-
+
pos+=size;
len+=size;
-
- for (dev = dev_base; dev != NULL; dev = dev->next)
+
+ for (dev = dev_base; dev != NULL; dev = dev->next)
{
size = sprintf_stats(buffer+len, dev);
len+=size;
pos=begin+len;
-
+
if(pos<offset)
{
len=0;
@@ -1214,7 +1214,7 @@ int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy
if(pos>offset+length)
break;
}
-
+
*start=buffer+(offset-begin); /* Start of wanted data */
len-=(offset-begin); /* Start slop */
if(len>length)
@@ -1305,17 +1305,17 @@ int dev_get_wireless_info(char * buffer, char **start, off_t offset,
off_t begin = 0;
off_t pos = 0;
int size;
-
+
struct device * dev;
size = sprintf(buffer,
"Inter-|sta| Quality | Discarded packets\n"
" face |tus|link level noise| nwid crypt misc\n");
-
+
pos+=size;
len+=size;
- for(dev = dev_base; dev != NULL; dev = dev->next)
+ for(dev = dev_base; dev != NULL; dev = dev->next)
{
size = sprintf_wireless_stats(buffer+len, dev);
len+=size;
@@ -1388,7 +1388,7 @@ int dev_change_flags(struct device *dev, unsigned flags)
/*
* Load in the correct multicast list now the flags have changed.
- */
+ */
dev_mc_upload(dev);
@@ -1403,7 +1403,7 @@ int dev_change_flags(struct device *dev, unsigned flags)
{
ret = ((old_flags & IFF_UP) ? dev_close : dev_open)(dev);
- if (ret == 0)
+ if (ret == 0)
dev_mc_upload(dev);
}
@@ -1430,10 +1430,16 @@ int dev_change_flags(struct device *dev, unsigned flags)
return ret;
}
+#ifdef _HURD_
+
+#define dev_ioctl 0
+
+#else
+
/*
- * Perform the SIOCxIFxxx calls.
+ * Perform the SIOCxIFxxx calls.
*/
-
+
static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
{
struct device *dev;
@@ -1442,7 +1448,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
if ((dev = dev_get(ifr->ifr_name)) == NULL)
return -ENODEV;
- switch(cmd)
+ switch(cmd)
{
case SIOCGIFFLAGS: /* Get interface flags */
ifr->ifr_flags = (dev->flags&~(IFF_PROMISC|IFF_ALLMULTI))
@@ -1451,18 +1457,18 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
case SIOCSIFFLAGS: /* Set interface flags */
return dev_change_flags(dev, ifr->ifr_flags);
-
+
case SIOCGIFMETRIC: /* Get the metric on the interface (currently unused) */
ifr->ifr_metric = 0;
return 0;
-
+
case SIOCSIFMETRIC: /* Set the metric on the interface (currently unused) */
return -EOPNOTSUPP;
-
+
case SIOCGIFMTU: /* Get the MTU of a device */
ifr->ifr_mtu = dev->mtu;
return 0;
-
+
case SIOCSIFMTU: /* Set the MTU of a device */
if (ifr->ifr_mtu == dev->mtu)
return 0;
@@ -1470,7 +1476,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
/*
* MTU must be positive.
*/
-
+
if (ifr->ifr_mtu<=0)
return -EINVAL;
@@ -1488,7 +1494,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
memcpy(ifr->ifr_hwaddr.sa_data,dev->dev_addr, MAX_ADDR_LEN);
ifr->ifr_hwaddr.sa_family=dev->type;
return 0;
-
+
case SIOCSIFHWADDR:
if(dev->set_mac_address==NULL)
return -EOPNOTSUPP;
@@ -1498,7 +1504,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
if (!err)
notifier_call_chain(&netdev_chain, NETDEV_CHANGEADDR, dev);
return err;
-
+
case SIOCSIFHWBROADCAST:
if(ifr->ifr_hwaddr.sa_family!=dev->type)
return -EINVAL;
@@ -1514,12 +1520,12 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
ifr->ifr_map.dma=dev->dma;
ifr->ifr_map.port=dev->if_port;
return 0;
-
+
case SIOCSIFMAP:
if (dev->set_config)
return dev->set_config(dev,&ifr->ifr_map);
return -EOPNOTSUPP;
-
+
case SIOCADDMULTI:
if(dev->set_multicast_list==NULL ||
ifr->ifr_hwaddr.sa_family!=AF_UNSPEC)
@@ -1598,7 +1604,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
and requires shared lock, because it sleeps writing
to user space.
*/
-
+
if (cmd == SIOCGIFCONF) {
rtnl_shlock();
ret = dev_ifconf((char *) arg);
@@ -1619,10 +1625,10 @@ int dev_ioctl(unsigned int cmd, void *arg)
*colon = 0;
/*
- * See which interface the caller is talking about.
+ * See which interface the caller is talking about.
*/
-
- switch(cmd)
+
+ switch(cmd)
{
/*
* These ioctl calls:
@@ -1630,7 +1636,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
* - atomic and do not require locking.
* - return a value
*/
-
+
case SIOCGIFFLAGS:
case SIOCGIFMETRIC:
case SIOCGIFMTU:
@@ -1655,7 +1661,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
* - require strict serialization.
* - do not return a value
*/
-
+
case SIOCSIFFLAGS:
case SIOCSIFMETRIC:
case SIOCSIFMTU:
@@ -1674,7 +1680,7 @@ int dev_ioctl(unsigned int cmd, void *arg)
ret = dev_ifsioc(&ifr, cmd);
rtnl_unlock();
return ret;
-
+
case SIOCGIFMEM:
/* Get the per device memory space. We can add this but currently
do not support it */
@@ -1685,8 +1691,8 @@ int dev_ioctl(unsigned int cmd, void *arg)
/*
* Unknown or private ioctl.
- */
-
+ */
+
default:
if (cmd >= SIOCDEVPRIVATE &&
cmd <= SIOCDEVPRIVATE + 15) {
@@ -1719,6 +1725,8 @@ int dev_ioctl(unsigned int cmd, void *arg)
}
}
+#endif
+
int dev_new_index(void)
{
static int ifindex;
@@ -1740,7 +1748,7 @@ int register_netdevice(struct device *dev)
if (dev_boot_phase) {
/* This is NOT bug, but I am not sure, that all the
devices, initialized before netdev module is started
- are sane.
+ are sane.
Now they are chained to device boot list
and probed later. If a module is initialized
@@ -1838,7 +1846,7 @@ int unregister_netdevice(struct device *dev)
/*
* Initialize the DEV module. At boot time this walks the device list and
- * unhooks any devices that fail to initialise (normally hardware not
+ * unhooks any devices that fail to initialise (normally hardware not
* present) and leaves us with a valid list of present and active devices.
*
*/
@@ -1892,17 +1900,17 @@ __initfunc(int net_dev_init(void))
/*
* Initialise the packet receive queue.
*/
-
+
skb_queue_head_init(&backlog);
-
+
/*
* The bridge has to be up before the devices
*/
-#ifdef CONFIG_BRIDGE
+#ifdef CONFIG_BRIDGE
br_init();
-#endif
-
+#endif
+
/*
* This is Very Ugly(tm).
*
@@ -1914,7 +1922,7 @@ __initfunc(int net_dev_init(void))
#endif
#if defined(CONFIG_DMASCC)
dmascc_init();
-#endif
+#endif
#if defined(CONFIG_BPQETHER)
bpq_init();
#endif
@@ -1952,13 +1960,13 @@ __initfunc(int net_dev_init(void))
* SLHC if present needs attaching so other people see it
* even if not opened.
*/
-
-#ifdef CONFIG_INET
+
+#ifdef CONFIG_INET
#if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
|| defined(CONFIG_PPP) \
|| (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
slhc_install();
-#endif
+#endif
#endif
#ifdef CONFIG_NET_PROFILE
@@ -1980,14 +1988,14 @@ __initfunc(int net_dev_init(void))
while ((dev = *dp) != NULL)
{
dev->iflink = -1;
- if (dev->init && dev->init(dev))
+ if (dev->init && dev->init(dev))
{
/*
* It failed to come up. Unhook it.
*/
*dp = dev->next;
synchronize_bh();
- }
+ }
else
{
dp = &dev->next;
diff --git a/pfinet/linux-src/net/ipv4/af_inet.c b/pfinet/linux-src/net/ipv4/af_inet.c
index e37eb6bd..04e05107 100644
--- a/pfinet/linux-src/net/ipv4/af_inet.c
+++ b/pfinet/linux-src/net/ipv4/af_inet.c
@@ -23,10 +23,10 @@
* when accept() ed
* Alan Cox : Semantics of SO_LINGER aren't state moved
* to close when you look carefully. With
- * this fixed and the accept bug fixed
+ * this fixed and the accept bug fixed
* some RPC stuff seems happier.
* Niibe Yutaka : 4.4BSD style write async I/O
- * Alan Cox,
+ * Alan Cox,
* Tony Gale : Fixed reuse semantics.
* Alan Cox : bind() shouldn't abort existing but dead
* sockets. Stops FTP netin:.. I hope.
@@ -141,7 +141,7 @@ int (*rarp_ioctl_hook)(unsigned int,void*) = NULL;
/*
* Destroy an AF_INET socket
*/
-
+
static __inline__ void kill_sk_queues(struct sock *sk)
{
struct sk_buff *skb;
@@ -177,12 +177,12 @@ static __inline__ void kill_sk_later(struct sock *sk)
{
/* this should never happen. */
/* actually it can if an ack has just been sent. */
- /*
+ /*
* It's more normal than that...
* It can happen because a skb is still in the device queues
* [PR]
*/
-
+
NETDEBUG(printk(KERN_DEBUG "Socket destroy delayed (r=%d w=%d)\n",
atomic_read(&sk->rmem_alloc),
atomic_read(&sk->wmem_alloc)));
@@ -223,12 +223,12 @@ void destroy_sock(struct sock *sk)
* socket object. Mostly it punts to the subprotocols of IP to do
* the work.
*/
-
+
/*
* Set socket options on an inet socket.
*/
-
+
int inet_setsockopt(struct socket *sock, int level, int optname,
char *optval, int optlen)
{
@@ -275,7 +275,7 @@ static int inet_autobind(struct sock *sk)
/*
* Move a socket into listening state.
*/
-
+
int inet_listen(struct socket *sock, int backlog)
{
struct sock *sk = sock->sk;
@@ -330,7 +330,7 @@ static int inet_create(struct socket *sock, int protocol)
/* Compatibility */
if (sock->type == SOCK_PACKET) {
- static int warned;
+ static int warned;
if (net_families[PF_PACKET]==NULL)
{
#if defined(CONFIG_KMOD) && defined(CONFIG_PACKET_MODULE)
@@ -348,7 +348,7 @@ static int inet_create(struct socket *sock, int protocol)
sock->state = SS_UNCONNECTED;
sk = sk_alloc(PF_INET, GFP_KERNEL, 1);
- if (sk == NULL)
+ if (sk == NULL)
goto do_oom;
switch (sock->type) {
@@ -392,13 +392,13 @@ static int inet_create(struct socket *sock, int protocol)
}
sock_init_data(sock,sk);
-
+
sk->destruct = NULL;
sk->zapped=0;
#ifdef CONFIG_TCP_NAGLE_OFF
sk->nonagle = 1;
-#endif
+#endif
sk->family = PF_INET;
sk->protocol = protocol;
@@ -414,7 +414,7 @@ static int inet_create(struct socket *sock, int protocol)
sk->ip_mc_ttl=1;
sk->ip_mc_index=0;
sk->ip_mc_list=NULL;
-
+
if (sk->num) {
/* It assumes that any protocol which allows
* the user to assign a number at socket
@@ -459,7 +459,7 @@ do_oom:
* function we are destroying the object and from then on nobody
* should refer to it.
*/
-
+
int inet_release(struct socket *sock, struct socket *peersock)
{
struct sock *sk = sock->sk;
@@ -505,13 +505,13 @@ static int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
/* If the socket has its own bind function then use it. (RAW) */
if(sk->prot->bind)
return sk->prot->bind(sk, uaddr, addr_len);
-
+
/* Check these errors (active socket, bad address length, double bind). */
if ((sk->state != TCP_CLOSE) ||
(addr_len < sizeof(struct sockaddr_in)) ||
(sk->num != 0))
return -EINVAL;
-
+
chk_addr_ret = inet_addr_type(addr->sin_addr.s_addr);
if (addr->sin_addr.s_addr != 0 && chk_addr_ret != RTN_LOCAL &&
chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) {
@@ -538,10 +538,10 @@ static int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
/* The kernel masquerader needs some ports. */
if((snum >= PORT_MASQ_BEGIN) && (snum <= PORT_MASQ_END))
return -EADDRINUSE;
-#endif
+#endif
if (snum && snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE))
return(-EACCES);
-
+
/* Make sure we are allowed to bind here. */
if (sk->prot->get_port(sk, snum) != 0)
return -EADDRINUSE;
@@ -564,10 +564,10 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr,
if (inet_autobind(sk) != 0)
return(-EAGAIN);
- if (sk->prot->connect == NULL)
+ if (sk->prot->connect == NULL)
return(-EOPNOTSUPP);
err = sk->prot->connect(sk, (struct sockaddr *)uaddr, addr_len);
- if (err < 0)
+ if (err < 0)
return(err);
return(0);
}
@@ -594,7 +594,7 @@ static void inet_wait_for_connect(struct sock *sk)
* Connect to a remote host. There is regrettably still a little
* TCP 'magic' in here.
*/
-
+
int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
int addr_len, int flags)
{
@@ -609,7 +609,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
if(sock->state == SS_CONNECTING) {
/* Note: tcp_connected contains SYN_RECV, which may cause
- bogus results here. -AK */
+ bogus results here. -AK */
if(tcp_connected(sk->state)) {
sock->state = SS_CONNECTED;
return 0;
@@ -619,7 +619,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
if (flags & O_NONBLOCK)
return -EALREADY;
} else {
- if (sk->prot->connect == NULL)
+ if (sk->prot->connect == NULL)
return(-EOPNOTSUPP);
/* We may need to bind the socket. */
@@ -635,11 +635,11 @@ int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
return(err);
sock->state = SS_CONNECTING;
}
-
+
if (sk->state > TCP_FIN_WAIT2 && sock->state == SS_CONNECTING)
goto sock_error;
- if (sk->state != TCP_ESTABLISHED && (flags & O_NONBLOCK))
+ if (sk->state != TCP_ESTABLISHED && (flags & O_NONBLOCK))
return (-EINPROGRESS);
if (sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV) {
@@ -650,15 +650,15 @@ int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
sock->state = SS_CONNECTED;
if ((sk->state != TCP_ESTABLISHED) && sk->err)
- goto sock_error;
+ goto sock_error;
return(0);
-sock_error:
+sock_error:
/* This is ugly but needed to fix a race in the ICMP error handler */
- if (sk->zapped && sk->state != TCP_CLOSE) {
- lock_sock(sk);
+ if (sk->zapped && sk->state != TCP_CLOSE) {
+ lock_sock(sk);
tcp_set_state(sk, TCP_CLOSE);
- release_sock(sk);
+ release_sock(sk);
sk->zapped = 0;
}
sock->state = SS_UNCONNECTED;
@@ -735,16 +735,16 @@ do_err:
/*
* This does both peername and sockname.
*/
-
+
static int inet_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct sock *sk = sock->sk;
struct sockaddr_in *sin = (struct sockaddr_in *)uaddr;
-
+
sin->sin_family = AF_INET;
if (peer) {
- if (!tcp_connected(sk->state))
+ if (!tcp_connected(sk->state))
return(-ENOTCONN);
sin->sin_port = sk->dport;
sin->sin_addr.s_addr = sk->daddr;
@@ -767,10 +767,10 @@ int inet_recvmsg(struct socket *sock, struct msghdr *msg, int size,
struct sock *sk = sock->sk;
int addr_len = 0;
int err;
-
+
if (sock->flags & SO_ACCEPTCON)
return(-EINVAL);
- if (sk->prot->recvmsg == NULL)
+ if (sk->prot->recvmsg == NULL)
return(-EOPNOTSUPP);
/* We may need to bind the socket. */
if (inet_autobind(sk) != 0)
@@ -793,7 +793,7 @@ int inet_sendmsg(struct socket *sock, struct msghdr *msg, int size,
send_sig(SIGPIPE, current, 1);
return(-EPIPE);
}
- if (sk->prot->sendmsg == NULL)
+ if (sk->prot->sendmsg == NULL)
return(-EOPNOTSUPP);
if(sk->err)
return sock_error(sk);
@@ -822,7 +822,7 @@ int inet_shutdown(struct socket *sock, int how)
return(-ENOTCONN);
if (sock->state == SS_CONNECTING && sk->state == TCP_ESTABLISHED)
sock->state = SS_CONNECTED;
- if (!tcp_connected(sk->state))
+ if (!tcp_connected(sk->state))
return(-ENOTCONN);
sk->shutdown |= how;
if (sk->prot->shutdown)
@@ -842,6 +842,10 @@ unsigned int inet_poll(struct file * file, struct socket *sock, poll_table *wait
return sk->prot->poll(file, sock, wait);
}
+#ifdef _HURD_
+#define inet_ioctl 0
+#else
+
/*
* ioctl() calls you can issue on an INET socket. Most of these are
* device configuration and stuff and very rarely used. Some ioctls
@@ -858,14 +862,14 @@ static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
int err;
int pid;
- switch(cmd)
+ switch(cmd)
{
case FIOSETOWN:
case SIOCSPGRP:
err = get_user(pid, (int *) arg);
if (err)
- return err;
- if (current->pid != pid && current->pgrp != -pid &&
+ return err;
+ if (current->pid != pid && current->pgrp != -pid &&
!capable(CAP_NET_ADMIN))
return -EPERM;
sk->proc = pid;
@@ -905,18 +909,18 @@ static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCSIFNETMASK:
case SIOCGIFDSTADDR:
case SIOCSIFDSTADDR:
- case SIOCSIFPFLAGS:
- case SIOCGIFPFLAGS:
+ case SIOCSIFPFLAGS:
+ case SIOCGIFPFLAGS:
case SIOCSIFFLAGS:
return(devinet_ioctl(cmd,(void *) arg));
case SIOCGIFBR:
case SIOCSIFBR:
-#ifdef CONFIG_BRIDGE
+#ifdef CONFIG_BRIDGE
return(br_ioctl(cmd,(void *) arg));
#else
return -ENOPKG;
-#endif
-
+#endif
+
case SIOCADDDLCI:
case SIOCDELDLCI:
#ifdef CONFIG_DLCI
@@ -946,13 +950,15 @@ static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
#endif
if (sk->prot->ioctl==NULL || (err=sk->prot->ioctl(sk, cmd, arg))==-ENOIOCTLCMD)
- return(dev_ioctl(cmd,(void *) arg));
+ return(dev_ioctl(cmd,(void *) arg));
return err;
}
/*NOTREACHED*/
return(0);
}
+#endif
+
struct proto_ops inet_stream_ops = {
PF_INET,
@@ -962,7 +968,7 @@ struct proto_ops inet_stream_ops = {
inet_stream_connect,
sock_no_socketpair,
inet_accept,
- inet_getname,
+ inet_getname,
inet_poll,
inet_ioctl,
inet_listen,
@@ -983,7 +989,7 @@ struct proto_ops inet_dgram_ops = {
inet_dgram_connect,
sock_no_socketpair,
sock_no_accept,
- inet_getname,
+ inet_getname,
datagram_poll,
inet_ioctl,
sock_no_listen,
@@ -1053,9 +1059,9 @@ extern void tcp_v4_init(struct net_proto_family *);
/*
- * Called by socket.c on kernel startup.
+ * Called by socket.c on kernel startup.
*/
-
+
__initfunc(void inet_proto_init(struct net_proto *pro))
{
struct sk_buff *dummy_skb;
@@ -1070,17 +1076,17 @@ __initfunc(void inet_proto_init(struct net_proto *pro))
}
/*
- * Tell SOCKET that we are alive...
+ * Tell SOCKET that we are alive...
*/
-
+
(void) sock_register(&inet_family_ops);
/*
- * Add all the protocols.
+ * Add all the protocols.
*/
printk(KERN_INFO "IP Protocols: ");
- for(p = inet_protocol_base; p != NULL;)
+ for(p = inet_protocol_base; p != NULL;)
{
struct inet_protocol *tmp = (struct inet_protocol *) p->next;
inet_add_protocol(p);
@@ -1132,7 +1138,7 @@ __initfunc(void inet_proto_init(struct net_proto *pro))
#ifdef CONFIG_IP_MASQUERADE
ip_masq_init();
#endif
-
+
/*
* Initialise the multicast router
*/
diff --git a/pfinet/linux-src/net/ipv4/arp.c b/pfinet/linux-src/net/ipv4/arp.c
index 27d2f802..045513a8 100644
--- a/pfinet/linux-src/net/ipv4/arp.c
+++ b/pfinet/linux-src/net/ipv4/arp.c
@@ -15,9 +15,9 @@
* 2 of the License, or (at your option) any later version.
*
* Fixes:
- * Alan Cox : Removed the Ethernet assumptions in
+ * Alan Cox : Removed the Ethernet assumptions in
* Florian's code
- * Alan Cox : Fixed some small errors in the ARP
+ * Alan Cox : Fixed some small errors in the ARP
* logic
* Alan Cox : Allow >4K in /proc
* Alan Cox : Make ARP add its own protocol entry
@@ -39,18 +39,18 @@
* Jonathan Naylor : Only lookup the hardware address for
* the correct hardware type.
* Germano Caronni : Assorted subtle races.
- * Craig Schlenter : Don't modify permanent entry
+ * Craig Schlenter : Don't modify permanent entry
* during arp_rcv.
* Russ Nelson : Tidied up a few bits.
* Alexey Kuznetsov: Major changes to caching and behaviour,
- * eg intelligent arp probing and
+ * eg intelligent arp probing and
* generation
* of host down events.
* Alan Cox : Missing unlock in device events.
* Eckes : ARP ioctl control errors.
* Alexey Kuznetsov: Arp free fix.
* Manuel Rodriguez: Gratuitous ARP.
- * Jonathan Layes : Added arpd support through kerneld
+ * Jonathan Layes : Added arpd support through kerneld
* message queue (960314)
* Mike Shaver : /proc/sys/net/ipv4/arp_* support
* Mike McLagan : Routing by source
@@ -77,7 +77,7 @@
unresolved IP address. (OK)
950727 -- MS
*/
-
+
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
@@ -257,7 +257,7 @@ static int arp_constructor(struct neighbour *neigh)
switch (dev->type) {
default:
break;
- case ARPHRD_ROSE:
+ case ARPHRD_ROSE:
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
case ARPHRD_AX25:
#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
@@ -419,8 +419,8 @@ int arp_bind_neighbour(struct dst_entry *dst)
* message.
*/
-void arp_send(int type, int ptype, u32 dest_ip,
- struct device *dev, u32 src_ip,
+void arp_send(int type, int ptype, u32 dest_ip,
+ struct device *dev, u32 src_ip,
unsigned char *dest_hw, unsigned char *src_hw,
unsigned char *target_hw)
{
@@ -431,14 +431,14 @@ void arp_send(int type, int ptype, u32 dest_ip,
/*
* No arp on this interface.
*/
-
+
if (dev->flags&IFF_NOARP)
return;
/*
* Allocate a buffer
*/
-
+
skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4)
+ dev->hard_header_len + 15, GFP_ATOMIC);
if (skb == NULL)
@@ -544,10 +544,10 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
* of the device. Similarly, the hardware types should match. The
* device should be ARP-able. Also, if pln is not 4, then the lookup
* is not from an IP number. We can't currently handle this, so toss
- * it.
- */
+ * it.
+ */
if (in_dev == NULL ||
- arp->ar_hln != dev->addr_len ||
+ arp->ar_hln != dev->addr_len ||
dev->flags & IFF_NOARP ||
skb->pkt_type == PACKET_OTHERHOST ||
skb->pkt_type == PACKET_LOOPBACK ||
@@ -555,7 +555,7 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
goto out;
switch (dev_type) {
- default:
+ default:
if (arp->ar_pro != __constant_htons(ETH_P_IP))
goto out;
if (htons(dev_type) != arp->ar_hrd)
@@ -622,7 +622,7 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
tha=arp_ptr;
arp_ptr += dev->addr_len;
memcpy(&tip, arp_ptr, 4);
-/*
+/*
* Check for bad requests for 127.x.x.x and requests for multicast
* addresses. If this is one such, delete it.
*/
@@ -633,16 +633,16 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
* Process entry. The idea here is we want to send a reply if it is a
* request for us or if it is a request for someone else that we hold
* a proxy for. We want to add an entry to our cache if it is a reply
- * to us or if it is a request for our address.
- * (The assumption for this last is that if someone is requesting our
- * address, they are probably intending to talk to us, so it saves time
- * if we cache their address. Their address is also probably not in
+ * to us or if it is a request for our address.
+ * (The assumption for this last is that if someone is requesting our
+ * address, they are probably intending to talk to us, so it saves time
+ * if we cache their address. Their address is also probably not in
* our cache, since ours is not in their cache.)
- *
+ *
* Putting this another way, we only care about replies if they are to
* us, in which case we add them to the cache. For requests, we care
* about those for us and those for our proxies. We reply to both,
- * and in the case of requests for us we add the requester to the arp
+ * and in the case of requests for us we add the requester to the arp
* cache.
*/
@@ -781,7 +781,7 @@ int arp_req_set(struct arpreq *r, struct device * dev)
if (!dev)
return -EINVAL;
}
- if (r->arp_ha.sa_family != dev->type)
+ if (r->arp_ha.sa_family != dev->type)
return -EINVAL;
err = -ENOBUFS;
@@ -878,6 +878,9 @@ int arp_req_delete(struct arpreq *r, struct device * dev)
return err;
}
+#ifdef _HURD_
+#define arp_ioctl 0
+#else
/*
* Handle an ARP layer I/O control request.
*/
@@ -945,6 +948,7 @@ out:
rtnl_unlock();
return err;
}
+#endif
/*
* Write the contents of the ARP cache to a PROCfs file.
@@ -998,7 +1002,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy
hbuffer[k++]=':';
}
hbuffer[--k]=0;
-
+
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
}
#endif
@@ -1015,7 +1019,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy
"%-17s0x%-10x0x%-10x%s",
in_ntoa(*(u32*)n->primary_key),
hatype,
- arp_state_to_flags(n),
+ arp_state_to_flags(n),
hbuffer);
size += sprintf(buffer+len+size,
" %-17s %s\n",
@@ -1023,7 +1027,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy
len += size;
pos += size;
-
+
if (pos <= offset)
len=0;
if (pos >= offset+length)
@@ -1049,7 +1053,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy
len += size;
pos += size;
-
+
if (pos <= offset)
len=0;
if (pos >= offset+length)
@@ -1059,7 +1063,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy
done:
neigh_table_unlock(&arp_tbl);
-
+
*start = buffer+len-(pos-offset); /* Start of wanted data */
len = pos-offset; /* Start slop */
if (len>length)
@@ -1133,14 +1137,14 @@ char *ax2asc(ax25_address *a)
if (c != ' ') *s++ = c;
}
-
+
*s++ = '-';
if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) {
*s++ = '1';
n -= 10;
}
-
+
*s++ = n + '0';
*s++ = '\0';
diff --git a/pfinet/linux-src/net/ipv4/devinet.c b/pfinet/linux-src/net/ipv4/devinet.c
index a50ee3bd..ccae0c58 100644
--- a/pfinet/linux-src/net/ipv4/devinet.c
+++ b/pfinet/linux-src/net/ipv4/devinet.c
@@ -23,7 +23,7 @@
*/
#include <linux/config.h>
-
+
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/bitops.h>
@@ -370,8 +370,8 @@ inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
#endif
-/*
- * Determine a default network mask, based on the IP address.
+/*
+ * Determine a default network mask, based on the IP address.
*/
static __inline__ int inet_abc_len(u32 addr)
@@ -380,21 +380,63 @@ static __inline__ int inet_abc_len(u32 addr)
return 0;
addr = ntohl(addr);
- if (IN_CLASSA(addr))
+ if (IN_CLASSA(addr))
return 8;
- if (IN_CLASSB(addr))
+ if (IN_CLASSB(addr))
return 16;
- if (IN_CLASSC(addr))
+ if (IN_CLASSC(addr))
return 24;
/*
- * Something else, probably a multicast.
+ * Something else, probably a multicast.
*/
-
+
return -1;
}
+#ifdef _HURD_
+
+#define devinet_ioctl 0
+
+error_t
+configure_device (struct device *dev,
+ uint32_t addr, uint32_t netmask)
+{
+ struct in_device *in_dev = dev->ip_ptr;
+ struct in_ifaddr *ifa = in_dev ? in_dev->ifa_list : 0;
+
+ if (ifa)
+ {
+ inet_del_ifa (in_dev, &in_dev->ifa_list, 0);
+ ifa->ifa_broadcast = 0;
+ ifa->ifa_anycast = 0;
+ }
+ else
+ {
+ ifa = inet_alloc_ifa ();
+ if (!ifa)
+ return ENOBUFS;
+ memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
+ }
+
+ if (addr != INADDR_NONE)
+ ifa->ifa_address = ifa->ifa_local = addr;
+ if (netmask != INADDR_NONE)
+ {
+ ifa->ifa_mask = netmask;
+ ifa->ifa_prefixlen = inet_mask_len (ifa->ifa_mask);
+ if ((dev->flags&IFF_BROADCAST) && ifa->ifa_prefixlen < 31)
+ ifa->ifa_broadcast = ifa->ifa_address|~ifa->ifa_mask;
+ else
+ ifa->ifa_broadcast = 0;
+ }
+
+ return - inet_set_ifa (dev, ifa);
+}
+
+#else
+
int devinet_ioctl(unsigned int cmd, void *arg)
{
struct ifreq ifr;
@@ -514,7 +556,7 @@ int devinet_ioctl(unsigned int cmd, void *arg)
#endif
ret = dev_change_flags(dev, ifr.ifr_flags);
break;
-
+
case SIOCSIFADDR: /* Set interface address (and family) */
if (inet_abc_len(sin->sin_addr.s_addr) < 0) {
ret = -EINVAL;
@@ -563,7 +605,7 @@ int devinet_ioctl(unsigned int cmd, void *arg)
inet_insert_ifa(in_dev, ifa);
}
break;
-
+
case SIOCSIFDSTADDR: /* Set the destination address */
if (ifa->ifa_address != sin->sin_addr.s_addr) {
if (inet_abc_len(sin->sin_addr.s_addr) < 0) {
@@ -605,6 +647,8 @@ rarok:
return 0;
}
+#endif
+
static int
inet_gifconf(struct device *dev, char *buf, int len)
{
@@ -657,7 +701,7 @@ u32 inet_select_addr(struct device *dev, u32 dst, int scope)
if (!addr)
addr = ifa->ifa_local;
} endfor_ifa(in_dev);
-
+
if (addr || scope >= RT_SCOPE_LINK)
return addr;
@@ -691,7 +735,7 @@ int unregister_inetaddr_notifier(struct notifier_block *nb)
{
return notifier_chain_unregister(&inetaddr_chain,nb);
}
-
+
static int inetdev_event(struct notifier_block *this, unsigned long event, void *ptr)
{
struct device *dev = ptr;
@@ -725,7 +769,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, void
case NETDEV_DOWN:
ip_mc_down(in_dev);
break;
- case NETDEV_CHANGEMTU:
+ case NETDEV_CHANGEMTU:
if (dev->mtu >= 68)
break;
/* MTU falled under minimal IP mtu. Disable IP. */
diff --git a/pfinet/linux-src/net/ipv4/tcp.c b/pfinet/linux-src/net/ipv4/tcp.c
index 65763215..89e1bbbf 100644
--- a/pfinet/linux-src/net/ipv4/tcp.c
+++ b/pfinet/linux-src/net/ipv4/tcp.c
@@ -202,7 +202,7 @@
* Eric Schenk : Fix fast close down bug with
* shutdown() followed by close().
* Andi Kleen : Make poll agree with SIGIO
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
@@ -249,8 +249,8 @@
* for violations and the like. tcp.c is just too big... If I say something
* "does?" or "doesn't?", it means I'm not sure, and will have to hash it out
* with Alan. -- MS 950903
- * [Note: Most of the TCP code has been rewriten/redesigned since this
- * RFC1122 check. It is probably not correct anymore. It should be redone
+ * [Note: Most of the TCP code has been rewriten/redesigned since this
+ * RFC1122 check. It is probably not correct anymore. It should be redone
* before 2.2. -AK]
*
* Use of PSH (4.2.2.2)
@@ -384,14 +384,14 @@
*
* ICMP messages (4.2.3.9)
* MUST act on ICMP errors. (does)
- * MUST slow transmission upon receipt of a Source Quench. (doesn't anymore
+ * MUST slow transmission upon receipt of a Source Quench. (doesn't anymore
* because that is deprecated now by the IETF, can be turned on)
* MUST NOT abort connection upon receipt of soft Destination
* Unreachables (0, 1, 5), Time Exceededs and Parameter
* Problems. (doesn't)
* SHOULD report soft Destination Unreachables etc. to the
* application. (does, except during SYN_RECV and may drop messages
- * in some rare cases before accept() - ICMP is unreliable)
+ * in some rare cases before accept() - ICMP is unreliable)
* SHOULD abort connection upon receipt of hard Destination Unreachable
* messages (2, 3, 4). (does, but see above)
*
@@ -435,20 +435,20 @@ kmem_cache_t *tcp_timewait_cachep;
* the socket locked or with interrupts disabled
*/
-static struct open_request *tcp_find_established(struct tcp_opt *tp,
+static struct open_request *tcp_find_established(struct tcp_opt *tp,
struct open_request **prevp)
{
struct open_request *req = tp->syn_wait_queue;
- struct open_request *prev = (struct open_request *)&tp->syn_wait_queue;
+ struct open_request *prev = (struct open_request *)&tp->syn_wait_queue;
while(req) {
- if (req->sk &&
+ if (req->sk &&
((1 << req->sk->state) &
~(TCPF_SYN_SENT|TCPF_SYN_RECV)))
break;
- prev = req;
+ prev = req;
req = req->dl_next;
}
- *prevp = prev;
+ *prevp = prev;
return req;
}
@@ -539,7 +539,7 @@ static unsigned int tcp_listen_poll(struct sock *sk, poll_table *wait)
}
/*
- * Compute minimal free write space needed to queue new packets.
+ * Compute minimal free write space needed to queue new packets.
*/
#define tcp_min_write_space(__sk) \
(atomic_read(&(__sk)->wmem_alloc) / 2)
@@ -605,12 +605,12 @@ unsigned int tcp_poll(struct file * file, struct socket *sock, poll_table *wait)
/*
* Socket write_space callback.
- * This (or rather the sock_wake_async) should agree with poll.
+ * This (or rather the sock_wake_async) should agree with poll.
*/
void tcp_write_space(struct sock *sk)
{
if (sk->dead)
- return;
+ return;
wake_up_interruptible(sk->sleep);
if (sock_wspace(sk) >=
@@ -619,6 +619,23 @@ void tcp_write_space(struct sock *sk)
}
+#ifdef _HURD_
+
+#define tcp_ioctl 0
+
+error_t
+tcp_tiocinq(struct sock *sk, mach_msg_type_number_t *amount)
+{
+ if (sk->state == TCP_LISTEN)
+ return EINVAL;
+ lock_sock(sk);
+ *amount = tcp_readable(sk);
+ release_sock(sk);
+ return 0;
+}
+
+#else
+
int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{
int answ;
@@ -652,6 +669,8 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
return put_user(answ, (int *)arg);
}
+#endif
+
/*
* Wait for a socket to get into the connected state
*
@@ -727,20 +746,20 @@ static void wait_for_tcp_memory(struct sock * sk)
/*
* Wait for a buffer.
- */
-static int wait_for_buffer(struct sock *sk)
-{
- struct wait_queue wait = { current, NULL };
-
- release_sock(sk);
- add_wait_queue(sk->sleep, &wait);
- current->state = TASK_INTERRUPTIBLE;
- schedule();
- current->state = TASK_RUNNING;
+ */
+static int wait_for_buffer(struct sock *sk)
+{
+ struct wait_queue wait = { current, NULL };
+
+ release_sock(sk);
+ add_wait_queue(sk->sleep, &wait);
+ current->state = TASK_INTERRUPTIBLE;
+ schedule();
+ current->state = TASK_RUNNING;
remove_wait_queue(sk->sleep, &wait);
- lock_sock(sk);
- return 0;
-}
+ lock_sock(sk);
+ return 0;
+}
/* When all user supplied data has been queued set the PSH bit */
#define PSH_NEEDED (seglen == 0 && iovlen == 0)
@@ -781,7 +800,7 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
iovlen = msg->msg_iovlen;
iov = msg->msg_iov;
copied = 0;
-
+
while(--iovlen >= 0) {
int seglen=iov->iov_len;
unsigned char * from=iov->iov_base;
@@ -801,7 +820,7 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
/* Make sure that we are established. */
if (sk->shutdown & SEND_SHUTDOWN)
goto do_shutdown;
-
+
/* Now we need to check if we have a half
* built packet we can tack some data onto.
*/
@@ -809,7 +828,7 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
skb = sk->write_queue.prev;
copy = skb->len;
/* If the remote does SWS avoidance we should
- * queue the best we can if not we should in
+ * queue the best we can if not we should in
* fact send multiple packets...
* A method for detecting this would be most
* welcome.
@@ -819,21 +838,21 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
tp->snd_nxt < TCP_SKB_CB(skb)->end_seq) {
int last_byte_was_odd = (copy % 4);
- /*
+ /*
* Check for parallel writers sleeping in user access.
- */
- if (tp->partial_writers++ > 0) {
+ */
+ if (tp->partial_writers++ > 0) {
wait_for_buffer(sk);
tp->partial_writers--;
- continue;
+ continue;
}
-
+
copy = mss_now - copy;
if(copy > skb_tailroom(skb))
copy = skb_tailroom(skb);
if(copy > seglen)
copy = seglen;
-
+
if(last_byte_was_odd) {
if(copy_from_user(skb_put(skb, copy),
from, copy))
@@ -846,7 +865,7 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
from, skb_put(skb, copy),
copy, skb->csum, &err);
}
-
+
/*
* FIXME: the *_user functions should
* return how much data was
@@ -867,8 +886,8 @@ int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg)
if (PSH_NEEDED)
TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
- if (--tp->partial_writers > 0)
- wake_up_interruptible(sk->sleep);
+ if (--tp->partial_writers > 0)
+ wake_up_interruptible(sk->sleep);
continue;
}
@@ -1012,7 +1031,7 @@ out:
* this with tcp_send_ack().
* This is called for delayed acks also.
*/
-
+
void tcp_read_wakeup(struct sock *sk)
{
/* If we're closed, don't send an ack, or we'll get a RST
@@ -1028,7 +1047,7 @@ void tcp_read_wakeup(struct sock *sk)
*/
static int tcp_recv_urg(struct sock * sk, int nonblock,
- struct msghdr *msg, int len, int flags,
+ struct msghdr *msg, int len, int flags,
int *addr_len)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
@@ -1050,15 +1069,15 @@ static int tcp_recv_urg(struct sock * sk, int nonblock,
lock_sock(sk);
if (tp->urg_data & URG_VALID) {
- int err = 0;
+ int err = 0;
char c = tp->urg_data;
if (!(flags & MSG_PEEK))
tp->urg_data = URG_READ;
-
+
if(msg->msg_name)
tp->af_specific->addr2sockaddr(sk, (struct sockaddr *)
- msg->msg_name);
+ msg->msg_name);
if(addr_len)
*addr_len = tp->af_specific->sockaddr_len;
@@ -1075,8 +1094,8 @@ static int tcp_recv_urg(struct sock * sk, int nonblock,
}
else
msg->msg_flags|=MSG_TRUNC;
-
- /* N.B. Is this right?? If len == 0 we didn't read any data */
+
+ /* N.B. Is this right?? If len == 0 we didn't read any data */
return err ? -EFAULT : 1;
}
release_sock(sk);
@@ -1111,7 +1130,7 @@ static inline void tcp_eat_skb(struct sock *sk, struct sk_buff * skb)
static void cleanup_rbuf(struct sock *sk, int copied)
{
struct sk_buff *skb;
-
+
/* NOTE! The socket must be locked, so that we don't get
* a messed-up receive queue.
*/
@@ -1143,9 +1162,9 @@ static void cleanup_rbuf(struct sock *sk, int copied)
/*
- * This routine copies from a sock struct into the user buffer.
+ * This routine copies from a sock struct into the user buffer.
*/
-
+
int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
int len, int nonblock, int flags, int *addr_len)
{
@@ -1155,7 +1174,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
u32 peek_seq;
volatile u32 *seq; /* So gcc doesn't overoptimise */
unsigned long used;
- int err = 0;
+ int err = 0;
int target = 1; /* Read at least this many bytes */
if (sk->err)
@@ -1176,20 +1195,20 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
seq = &tp->copied_seq;
if (flags & MSG_PEEK)
seq = &peek_seq;
-
+
/* Handle the POSIX bogosity MSG_WAITALL. */
if (flags & MSG_WAITALL)
target=len;
add_wait_queue(sk->sleep, &wait);
lock_sock(sk);
-
+
/*
* BUG BUG BUG
- * This violates 1003.1g compliance. We must wait for
+ * This violates 1003.1g compliance. We must wait for
* data to exist even if we read none!
*/
-
+
while (len > 0) {
struct sk_buff * skb;
u32 offset;
@@ -1219,7 +1238,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
if (!skb)
break;
- /* Now that we have two receive queues this
+ /* Now that we have two receive queues this
* shouldn't happen.
*/
if (before(*seq, TCP_SKB_CB(skb)->seq)) {
@@ -1366,7 +1385,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
if(copied >= 0 && msg->msg_name) {
tp->af_specific->addr2sockaddr(sk, (struct sockaddr *)
- msg->msg_name);
+ msg->msg_name);
if(addr_len)
*addr_len = tp->af_specific->sockaddr_len;
}
@@ -1483,13 +1502,13 @@ static void tcp_close_pending (struct sock *sk)
while(req) {
struct open_request *iter;
-
+
if (req->sk)
tcp_close(req->sk, 0);
iter = req;
req = req->dl_next;
-
+
(*iter->class->destructor)(iter);
tcp_dec_slow_timer(TCP_SLT_SYNACK);
sk->ack_backlog--;
@@ -1583,7 +1602,7 @@ void tcp_close(struct sock *sk, long timeout)
tsk->state = TASK_RUNNING;
remove_wait_queue(sk->sleep, &wait);
-
+
lock_sock(sk);
}
@@ -1613,7 +1632,7 @@ static struct open_request * wait_for_connect(struct sock * sk,
schedule();
lock_sock(sk);
req = tcp_find_established(&(sk->tp_pinfo.af_tcp), pprev);
- if (req)
+ if (req)
break;
if (signal_pending(current))
break;
@@ -1636,7 +1655,7 @@ struct sock *tcp_accept(struct sock *sk, int flags)
struct sock *newsk = NULL;
int error;
- lock_sock(sk);
+ lock_sock(sk);
/* We need to make sure that this socket is listening,
* and that it has something pending.
@@ -1652,10 +1671,10 @@ struct sock *tcp_accept(struct sock *sk, int flags)
error = EAGAIN;
if (flags & O_NONBLOCK)
goto out;
-
+
error = ERESTARTSYS;
req = wait_for_connect(sk, &prev);
- if (!req)
+ if (!req)
goto out;
}
@@ -1663,7 +1682,7 @@ struct sock *tcp_accept(struct sock *sk, int flags)
newsk = req->sk;
req->class->destructor(req);
tcp_openreq_free(req);
- sk->ack_backlog--;
+ sk->ack_backlog--;
if(sk->keepopen)
tcp_inc_slow_timer(TCP_SLT_KEEPALIVE);
@@ -1673,26 +1692,26 @@ struct sock *tcp_accept(struct sock *sk, int flags)
out:
/* sk should be in LISTEN state, thus accept can use sk->err for
* internal purposes without stomping one anyone's feed.
- */
- sk->err = error;
+ */
+ sk->err = error;
release_sock(sk);
return newsk;
}
/*
- * Socket option code for TCP.
+ * Socket option code for TCP.
*/
-
-int tcp_setsockopt(struct sock *sk, int level, int optname, char *optval,
+
+int tcp_setsockopt(struct sock *sk, int level, int optname, char *optval,
int optlen)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
int val;
if (level != SOL_TCP)
- return tp->af_specific->setsockopt(sk, level, optname,
+ return tp->af_specific->setsockopt(sk, level, optname,
optval, optlen);
-
+
if(optlen<sizeof(int))
return -EINVAL;
diff --git a/pfinet/linux-src/net/ipv4/udp.c b/pfinet/linux-src/net/ipv4/udp.c
index 909e858f..87ff84ce 100644
--- a/pfinet/linux-src/net/ipv4/udp.c
+++ b/pfinet/linux-src/net/ipv4/udp.c
@@ -19,8 +19,8 @@
* for udp at least is 'valid'.
* Alan Cox : Fixed icmp handling properly
* Alan Cox : Correct error for oversized datagrams
- * Alan Cox : Tidied select() semantics.
- * Alan Cox : udp_err() fixed properly, also now
+ * Alan Cox : Tidied select() semantics.
+ * Alan Cox : udp_err() fixed properly, also now
* select and read wake correctly on errors
* Alan Cox : udp_send verify_area moved to avoid mem leak
* Alan Cox : UDP can count its memory
@@ -55,7 +55,7 @@
* does have a high hit rate.
* Olaf Kirch : Don't linearise iovec on sendmsg.
* Andi Kleen : Some cleanups, cache destination entry
- * for connect.
+ * for connect.
* Vitaly E. Lavrov : Transparent proxy revived after year coma.
* Melvin Smith : Check msg_name not msg_namelen in sendto(),
* return ENOTCONN for unconnected sockets (POSIX)
@@ -68,10 +68,10 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
-
+
/* RFC1122 Status:
4.1.3.1 (Ports):
- SHOULD send ICMP_PORT_UNREACHABLE in response to datagrams to
+ SHOULD send ICMP_PORT_UNREACHABLE in response to datagrams to
an un-listened port. (OK)
4.1.3.2 (IP Options)
MUST pass IP options from IP -> application (OK)
@@ -399,7 +399,7 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk,
* This routine is called by the ICMP module when it gets some
* sort of error condition. If err < 0 then the socket should
* be closed and the error returned to the user. If err > 0
- * it's just the icmp type << 8 | icmp code.
+ * it's just the icmp type << 8 | icmp code.
* Header points to the ip header of the error packet. We move
* on past this. Then (as it used to claim before adjustment)
* header points to the first 8 bytes of the udp header. We need
@@ -463,16 +463,16 @@ void udp_err(struct sk_buff *skb, unsigned char *dp, int len)
}
/*
- * Various people wanted BSD UDP semantics. Well they've come
+ * Various people wanted BSD UDP semantics. Well they've come
* back out because they slow down response to stuff like dead
* or unreachable name servers and they screw term users something
- * chronic. Oh and it violates RFC1122. So basically fix your
+ * chronic. Oh and it violates RFC1122. So basically fix your
* client code people.
*/
-
+
/*
- * RFC1122: OK. Passes ICMP errors back to application, as per
- * 4.1.3.3. After the comment above, that should be no surprise.
+ * RFC1122: OK. Passes ICMP errors back to application, as per
+ * 4.1.3.3. After the comment above, that should be no surprise.
*/
if (!harderr && !sk->ip_recverr)
@@ -497,7 +497,7 @@ static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr,
return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base));
}
-struct udpfakehdr
+struct udpfakehdr
{
struct udphdr uh;
u32 saddr;
@@ -512,8 +512,8 @@ struct udpfakehdr
* card and provide an additional callback mode for direct user->board I/O
* transfers. That one will be fun.
*/
-
-static int udp_getfrag(const void *p, char * to, unsigned int offset, unsigned int fraglen)
+
+static int udp_getfrag(const void *p, char * to, unsigned int offset, unsigned int fraglen)
{
struct udpfakehdr *ufh = (struct udpfakehdr *)p;
if (offset==0) {
@@ -522,7 +522,7 @@ static int udp_getfrag(const void *p, char * to, unsigned int offset, unsigned i
return -EFAULT;
ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr),
ufh->wcheck);
- ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr,
+ ufh->uh.check = csum_tcpudp_magic(ufh->saddr, ufh->daddr,
ntohs(ufh->uh.len),
IPPROTO_UDP, ufh->wcheck);
if (ufh->uh.check == 0)
@@ -542,8 +542,8 @@ static int udp_getfrag(const void *p, char * to, unsigned int offset, unsigned i
* CONFIG_FAST_NET set for >10Mb/second boards to activate this sort of coding.
* Timing needed to verify if this is a valid decision.
*/
-
-static int udp_getfrag_nosum(const void *p, char * to, unsigned int offset, unsigned int fraglen)
+
+static int udp_getfrag_nosum(const void *p, char * to, unsigned int offset, unsigned int fraglen)
{
struct udpfakehdr *ufh = (struct udpfakehdr *)p;
@@ -582,7 +582,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len)
if (len < 0 || len > 0xFFFF)
return -EMSGSIZE;
- /*
+ /*
* Check the flags.
*/
@@ -600,9 +600,9 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len)
#endif
/*
- * Get and verify the address.
+ * Get and verify the address.
*/
-
+
if (msg->msg_name) {
struct sockaddr_in * usin = (struct sockaddr_in*)msg->msg_name;
if (msg->msg_namelen < sizeof(*usin))
@@ -673,7 +673,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len)
connected = 0;
}
tos = RT_TOS(sk->ip_tos);
- if (sk->localroute || (msg->msg_flags&MSG_DONTROUTE) ||
+ if (sk->localroute || (msg->msg_flags&MSG_DONTROUTE) ||
(ipc.opt && ipc.opt->is_strictroute)) {
tos |= RTO_ONLINK;
connected = 0;
@@ -703,11 +703,11 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len)
(msg->msg_flags&MSG_PROXY ? RTO_TPROXY : 0) |
#endif
tos, ipc.oif);
- if (err)
+ if (err)
goto out;
err = -EACCES;
- if (rt->rt_flags&RTCF_BROADCAST && !sk->broadcast)
+ if (rt->rt_flags&RTCF_BROADCAST && !sk->broadcast)
goto out;
if (connected && sk->dst_cache == NULL)
sk->dst_cache = dst_clone(&rt->u.dst);
@@ -739,13 +739,19 @@ out:
return err;
}
+#ifdef _HURD_
+
+#define udp_ioctl 0
+
+#else
+
/*
* IOCTL requests applicable to the UDP protocol
*/
-
+
int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{
- switch(cmd)
+ switch(cmd)
{
case TIOCOUTQ:
{
@@ -782,6 +788,8 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)
return(0);
}
+#endif
+
#ifndef HAVE_CSUM_COPY_USER
#undef CONFIG_UDP_DELAY_CSUM
#endif
@@ -809,7 +817,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb)
goto out;
-
+
copied = skb->len - sizeof(struct udphdr);
if (copied > len) {
copied = len;
@@ -824,7 +832,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov,
copied);
} else if (copied > msg->msg_iov[0].iov_len || (msg->msg_flags&MSG_TRUNC)) {
- if ((unsigned short)csum_fold(csum_partial(skb->h.raw, skb->len, skb->csum)))
+ if ((unsigned short)csum_fold(csum_partial(skb->h.raw, skb->len, skb->csum)))
goto csum_copy_err;
err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov,
copied);
@@ -833,11 +841,11 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
err = 0;
csum = csum_partial(skb->h.raw, sizeof(struct udphdr), skb->csum);
- csum = csum_and_copy_to_user((char*)&skb->h.uh[1], msg->msg_iov[0].iov_base,
+ csum = csum_and_copy_to_user((char*)&skb->h.uh[1], msg->msg_iov[0].iov_base,
copied, csum, &err);
if (err)
goto out_free;
- if ((unsigned short)csum_fold(csum))
+ if ((unsigned short)csum_fold(csum))
goto csum_copy_err;
}
#endif
@@ -851,7 +859,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
/*
* Check any passed addresses
*/
- if (addr_len)
+ if (addr_len)
*addr_len=sizeof(*sin);
sin->sin_family = AF_INET;
@@ -878,7 +886,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len,
if (sk->ip_cmsg_flags)
ip_cmsg_recv(msg, skb);
err = copied;
-
+
out_free:
skb_free_datagram(sk, skb);
out:
@@ -889,11 +897,11 @@ csum_copy_err:
udp_statistics.UdpInErrors++;
skb_free_datagram(sk, skb);
- /*
+ /*
* Error for blocking case is chosen to masquerade
* as some normal condition.
*/
- return (flags&MSG_DONTWAIT) ? -EAGAIN : -EHOSTUNREACH;
+ return (flags&MSG_DONTWAIT) ? -EAGAIN : -EHOSTUNREACH;
#endif
}
@@ -903,14 +911,14 @@ int udp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
struct rtable *rt;
int err;
-
- if (addr_len < sizeof(*usin))
+
+ if (addr_len < sizeof(*usin))
return(-EINVAL);
/*
* 1003.1g - break association.
*/
-
+
if (usin->sin_family==AF_UNSPEC)
{
sk->saddr=INADDR_ANY;
@@ -922,7 +930,7 @@ int udp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
return 0;
}
- if (usin->sin_family && usin->sin_family != AF_INET)
+ if (usin->sin_family && usin->sin_family != AF_INET)
return(-EAFNOSUPPORT);
dst_release(xchg(&sk->dst_cache, NULL));
@@ -1056,9 +1064,9 @@ int udp_chkaddr(struct sk_buff *skb)
#endif
/*
- * All we need to do is get the socket, and then do a checksum.
+ * All we need to do is get the socket, and then do a checksum.
*/
-
+
int udp_rcv(struct sk_buff *skb, unsigned short len)
{
struct sock *sk;
@@ -1076,7 +1084,7 @@ int udp_rcv(struct sk_buff *skb, unsigned short len)
/*
* Get the header.
*/
-
+
uh = skb->h.uh;
__skb_pull(skb, skb->h.raw - skb->data);
@@ -1085,7 +1093,7 @@ int udp_rcv(struct sk_buff *skb, unsigned short len)
/*
* Validate the packet and the UDP length.
*/
-
+
ulen = ntohs(uh->len);
if (ulen > len || ulen < sizeof(*uh)) {
@@ -1100,13 +1108,13 @@ int udp_rcv(struct sk_buff *skb, unsigned short len)
if (uh->check &&
(((skb->ip_summed==CHECKSUM_HW)&&udp_check(uh,ulen,saddr,daddr,skb->csum)) ||
((skb->ip_summed==CHECKSUM_NONE) &&
- (udp_check(uh,ulen,saddr,daddr, csum_partial((char*)uh, ulen, 0))))))
+ (udp_check(uh,ulen,saddr,daddr, csum_partial((char*)uh, ulen, 0))))))
goto csum_error;
#else
if (uh->check==0)
skb->ip_summed = CHECKSUM_UNNECESSARY;
else if (skb->ip_summed==CHECKSUM_HW) {
- if (udp_check(uh,ulen,saddr,daddr,skb->csum))
+ if (udp_check(uh,ulen,saddr,daddr,skb->csum))
goto csum_error;
skb->ip_summed = CHECKSUM_UNNECESSARY;
} else if (skb->ip_summed != CHECKSUM_UNNECESSARY)
@@ -1124,11 +1132,11 @@ int udp_rcv(struct sk_buff *skb, unsigned short len)
else
#endif
sk = udp_v4_lookup(saddr, uh->source, daddr, uh->dest, skb->dev->ifindex);
-
+
if (sk == NULL) {
#ifdef CONFIG_UDP_DELAY_CSUM
if (skb->ip_summed != CHECKSUM_UNNECESSARY &&
- (unsigned short)csum_fold(csum_partial((char*)uh, ulen, skb->csum)))
+ (unsigned short)csum_fold(csum_partial((char*)uh, ulen, skb->csum)))
goto csum_error;
#endif
udp_statistics.UdpNoPorts++;
@@ -1145,9 +1153,9 @@ int udp_rcv(struct sk_buff *skb, unsigned short len)
return 0;
csum_error:
- /*
- * RFC1122: OK. Discards the bad packet silently (as far as
- * the network is concerned, anyway) as per 4.1.3.4 (MUST).
+ /*
+ * RFC1122: OK. Discards the bad packet silently (as far as
+ * the network is concerned, anyway) as per 4.1.3.4 (MUST).
*/
NETDEBUG(printk(KERN_DEBUG "UDP: bad checksum. From %d.%d.%d.%d:%d to %d.%d.%d.%d:%d ulen %d\n",
NIPQUAD(saddr),