patch-2.4.0-test3 linux/net/ipv4/raw.c
Next file: linux/net/ipv4/route.c
Previous file: linux/net/ipv4/proc.c
Back to the patch index
Back to the overall index
- Lines: 66
- Date:
Sun Jul 9 22:30:41 2000
- Orig file:
v2.4.0-test2/linux/net/ipv4/raw.c
- Orig date:
Thu May 11 15:30:08 2000
diff -u --recursive --new-file v2.4.0-test2/linux/net/ipv4/raw.c linux/net/ipv4/raw.c
@@ -5,7 +5,7 @@
*
* RAW - implementation of IP "raw" sockets.
*
- * Version: $Id: raw.c,v 1.50 2000/05/03 06:37:06 davem Exp $
+ * Version: $Id: raw.c,v 1.52 2000/07/08 00:20:43 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -502,7 +502,7 @@
if (err)
goto done;
- sk->stamp=skb->stamp;
+ sock_recv_timestamp(msg, sk, skb);
/* Copy the address. */
if (sin) {
@@ -580,6 +580,36 @@
return -ENOPROTOOPT;
}
+static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
+{
+ switch(cmd) {
+ case SIOCOUTQ:
+ {
+ int amount = atomic_read(&sk->wmem_alloc);
+ return put_user(amount, (int *)arg);
+ }
+ case SIOCINQ:
+ {
+ struct sk_buff *skb;
+ int amount = 0;
+
+ spin_lock_irq(&sk->receive_queue.lock);
+ skb = skb_peek(&sk->receive_queue);
+ if (skb != NULL)
+ amount = skb->len;
+ spin_unlock_irq(&sk->receive_queue.lock);
+ return put_user(amount, (int *)arg);
+ }
+
+ default:
+#ifdef CONFIG_IP_MROUTE
+ return ipmr_ioctl(sk, cmd, arg);
+#else
+ return -ENOIOCTLCMD;
+#endif
+ }
+}
+
static void get_raw_sock(struct sock *sp, char *tmpbuf, int i)
{
unsigned int dest, src;
@@ -648,9 +678,7 @@
close: raw_close,
connect: udp_connect,
disconnect: udp_disconnect,
-#ifdef CONFIG_IP_MROUTE
- ioctl: ipmr_ioctl,
-#endif
+ ioctl: raw_ioctl,
init: raw_init,
setsockopt: raw_setsockopt,
getsockopt: raw_getsockopt,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)