aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/packet/af_packet.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 99b55e641e8d..f8b83014ccca 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -83,8 +83,6 @@
83#include <net/inet_common.h> 83#include <net/inet_common.h>
84#endif 84#endif
85 85
86#define CONFIG_SOCK_PACKET 1
87
88/* 86/*
89 Assumptions: 87 Assumptions:
90 - if device has no dev->hard_header routine, it adds and removes ll header 88 - if device has no dev->hard_header routine, it adds and removes ll header
@@ -246,7 +244,6 @@ static void packet_sock_destruct(struct sock *sk)
246 244
247static const struct proto_ops packet_ops; 245static const struct proto_ops packet_ops;
248 246
249#ifdef CONFIG_SOCK_PACKET
250static const struct proto_ops packet_ops_spkt; 247static const struct proto_ops packet_ops_spkt;
251 248
252static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) 249static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
@@ -418,7 +415,6 @@ out_unlock:
418 dev_put(dev); 415 dev_put(dev);
419 return err; 416 return err;
420} 417}
421#endif
422 418
423static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, 419static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk,
424 unsigned int res) 420 unsigned int res)
@@ -917,8 +913,6 @@ out_unlock:
917 * Bind a packet socket to a device 913 * Bind a packet socket to a device
918 */ 914 */
919 915
920#ifdef CONFIG_SOCK_PACKET
921
922static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) 916static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len)
923{ 917{
924 struct sock *sk=sock->sk; 918 struct sock *sk=sock->sk;
@@ -941,7 +935,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add
941 } 935 }
942 return err; 936 return err;
943} 937}
944#endif
945 938
946static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 939static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
947{ 940{
@@ -993,11 +986,8 @@ static int packet_create(struct socket *sock, int protocol)
993 986
994 if (!capable(CAP_NET_RAW)) 987 if (!capable(CAP_NET_RAW))
995 return -EPERM; 988 return -EPERM;
996 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW 989 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW &&
997#ifdef CONFIG_SOCK_PACKET 990 sock->type != SOCK_PACKET)
998 && sock->type != SOCK_PACKET
999#endif
1000 )
1001 return -ESOCKTNOSUPPORT; 991 return -ESOCKTNOSUPPORT;
1002 992
1003 sock->state = SS_UNCONNECTED; 993 sock->state = SS_UNCONNECTED;
@@ -1008,10 +998,9 @@ static int packet_create(struct socket *sock, int protocol)
1008 goto out; 998 goto out;
1009 999
1010 sock->ops = &packet_ops; 1000 sock->ops = &packet_ops;
1011#ifdef CONFIG_SOCK_PACKET
1012 if (sock->type == SOCK_PACKET) 1001 if (sock->type == SOCK_PACKET)
1013 sock->ops = &packet_ops_spkt; 1002 sock->ops = &packet_ops_spkt;
1014#endif 1003
1015 sock_init_data(sock, sk); 1004 sock_init_data(sock, sk);
1016 1005
1017 po = pkt_sk(sk); 1006 po = pkt_sk(sk);
@@ -1027,10 +1016,10 @@ static int packet_create(struct socket *sock, int protocol)
1027 1016
1028 spin_lock_init(&po->bind_lock); 1017 spin_lock_init(&po->bind_lock);
1029 po->prot_hook.func = packet_rcv; 1018 po->prot_hook.func = packet_rcv;
1030#ifdef CONFIG_SOCK_PACKET 1019
1031 if (sock->type == SOCK_PACKET) 1020 if (sock->type == SOCK_PACKET)
1032 po->prot_hook.func = packet_rcv_spkt; 1021 po->prot_hook.func = packet_rcv_spkt;
1033#endif 1022
1034 po->prot_hook.af_packet_priv = sk; 1023 po->prot_hook.af_packet_priv = sk;
1035 1024
1036 if (proto) { 1025 if (proto) {
@@ -1150,7 +1139,6 @@ out:
1150 return err; 1139 return err;
1151} 1140}
1152 1141
1153#ifdef CONFIG_SOCK_PACKET
1154static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, 1142static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
1155 int *uaddr_len, int peer) 1143 int *uaddr_len, int peer)
1156{ 1144{
@@ -1171,7 +1159,6 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
1171 1159
1172 return 0; 1160 return 0;
1173} 1161}
1174#endif
1175 1162
1176static int packet_getname(struct socket *sock, struct sockaddr *uaddr, 1163static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
1177 int *uaddr_len, int peer) 1164 int *uaddr_len, int peer)
@@ -1833,7 +1820,6 @@ out:
1833#endif 1820#endif
1834 1821
1835 1822
1836#ifdef CONFIG_SOCK_PACKET
1837static const struct proto_ops packet_ops_spkt = { 1823static const struct proto_ops packet_ops_spkt = {
1838 .family = PF_PACKET, 1824 .family = PF_PACKET,
1839 .owner = THIS_MODULE, 1825 .owner = THIS_MODULE,
@@ -1854,7 +1840,6 @@ static const struct proto_ops packet_ops_spkt = {
1854 .mmap = sock_no_mmap, 1840 .mmap = sock_no_mmap,
1855 .sendpage = sock_no_sendpage, 1841 .sendpage = sock_no_sendpage,
1856}; 1842};
1857#endif
1858 1843
1859static const struct proto_ops packet_ops = { 1844static const struct proto_ops packet_ops = {
1860 .family = PF_PACKET, 1845 .family = PF_PACKET,