aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-08 03:26:29 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:24 -0500
commit0e11c91e1e912bc4db5b71607d149e7e9a77e756 (patch)
treeb04a580d0dd0598a8188ed6f67673ee5e20e02a0 /net
parent3fbd418acc264e7069483d04165633ed3bfad80c (diff)
[AF_PACKET]: annotate
Weirdness: the third argument of socket() is net-endian here. Oh, well - it's documented in packet(7). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/packet/af_packet.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index f4ccb90e6739..271d2eed0699 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -201,7 +201,7 @@ struct packet_sock {
201 spinlock_t bind_lock; 201 spinlock_t bind_lock;
202 char running; /* prot_hook is attached*/ 202 char running; /* prot_hook is attached*/
203 int ifindex; /* bound device */ 203 int ifindex; /* bound device */
204 unsigned short num; 204 __be16 num;
205#ifdef CONFIG_PACKET_MULTICAST 205#ifdef CONFIG_PACKET_MULTICAST
206 struct packet_mclist *mclist; 206 struct packet_mclist *mclist;
207#endif 207#endif
@@ -331,7 +331,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
331 struct sockaddr_pkt *saddr=(struct sockaddr_pkt *)msg->msg_name; 331 struct sockaddr_pkt *saddr=(struct sockaddr_pkt *)msg->msg_name;
332 struct sk_buff *skb; 332 struct sk_buff *skb;
333 struct net_device *dev; 333 struct net_device *dev;
334 unsigned short proto=0; 334 __be16 proto=0;
335 int err; 335 int err;
336 336
337 /* 337 /*
@@ -704,7 +704,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
704 struct sockaddr_ll *saddr=(struct sockaddr_ll *)msg->msg_name; 704 struct sockaddr_ll *saddr=(struct sockaddr_ll *)msg->msg_name;
705 struct sk_buff *skb; 705 struct sk_buff *skb;
706 struct net_device *dev; 706 struct net_device *dev;
707 unsigned short proto; 707 __be16 proto;
708 unsigned char *addr; 708 unsigned char *addr;
709 int ifindex, err, reserve = 0; 709 int ifindex, err, reserve = 0;
710 710
@@ -858,7 +858,7 @@ static int packet_release(struct socket *sock)
858 * Attach a packet hook. 858 * Attach a packet hook.
859 */ 859 */
860 860
861static int packet_do_bind(struct sock *sk, struct net_device *dev, int protocol) 861static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protocol)
862{ 862{
863 struct packet_sock *po = pkt_sk(sk); 863 struct packet_sock *po = pkt_sk(sk);
864 /* 864 /*
@@ -983,6 +983,7 @@ static int packet_create(struct socket *sock, int protocol)
983{ 983{
984 struct sock *sk; 984 struct sock *sk;
985 struct packet_sock *po; 985 struct packet_sock *po;
986 __be16 proto = (__force __be16)protocol; /* weird, but documented */
986 int err; 987 int err;
987 988
988 if (!capable(CAP_NET_RAW)) 989 if (!capable(CAP_NET_RAW))
@@ -1010,7 +1011,7 @@ static int packet_create(struct socket *sock, int protocol)
1010 1011
1011 po = pkt_sk(sk); 1012 po = pkt_sk(sk);
1012 sk->sk_family = PF_PACKET; 1013 sk->sk_family = PF_PACKET;
1013 po->num = protocol; 1014 po->num = proto;
1014 1015
1015 sk->sk_destruct = packet_sock_destruct; 1016 sk->sk_destruct = packet_sock_destruct;
1016 atomic_inc(&packet_socks_nr); 1017 atomic_inc(&packet_socks_nr);
@@ -1027,8 +1028,8 @@ static int packet_create(struct socket *sock, int protocol)
1027#endif 1028#endif
1028 po->prot_hook.af_packet_priv = sk; 1029 po->prot_hook.af_packet_priv = sk;
1029 1030
1030 if (protocol) { 1031 if (proto) {
1031 po->prot_hook.type = protocol; 1032 po->prot_hook.type = proto;
1032 dev_add_pack(&po->prot_hook); 1033 dev_add_pack(&po->prot_hook);
1033 sock_hold(sk); 1034 sock_hold(sk);
1034 po->running = 1; 1035 po->running = 1;
@@ -1624,7 +1625,8 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing
1624{ 1625{
1625 char **pg_vec = NULL; 1626 char **pg_vec = NULL;
1626 struct packet_sock *po = pkt_sk(sk); 1627 struct packet_sock *po = pkt_sk(sk);
1627 int was_running, num, order = 0; 1628 int was_running, order = 0;
1629 __be16 num;
1628 int err = 0; 1630 int err = 0;
1629 1631
1630 if (req->tp_block_nr) { 1632 if (req->tp_block_nr) {