Loading net/packet/af_packet.c +5 −20 Original line number Original line Diff line number Diff line Loading @@ -83,8 +83,6 @@ #include <net/inet_common.h> #include <net/inet_common.h> #endif #endif #define CONFIG_SOCK_PACKET 1 /* /* Assumptions: Assumptions: - if device has no dev->hard_header routine, it adds and removes ll header - if device has no dev->hard_header routine, it adds and removes ll header Loading Loading @@ -246,7 +244,6 @@ static void packet_sock_destruct(struct sock *sk) static const struct proto_ops packet_ops; static const struct proto_ops packet_ops; #ifdef CONFIG_SOCK_PACKET static const struct proto_ops packet_ops_spkt; static const struct proto_ops packet_ops_spkt; static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) Loading Loading @@ -418,7 +415,6 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, dev_put(dev); dev_put(dev); return err; return err; } } #endif static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, unsigned int res) unsigned int res) Loading Loading @@ -917,8 +913,6 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc * Bind a packet socket to a device * Bind a packet socket to a device */ */ #ifdef CONFIG_SOCK_PACKET static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) { { struct sock *sk=sock->sk; struct sock *sk=sock->sk; Loading @@ -941,7 +935,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add } } return err; return err; } } #endif static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { { Loading Loading @@ -993,11 +986,8 @@ static int packet_create(struct socket *sock, int protocol) if (!capable(CAP_NET_RAW)) if (!capable(CAP_NET_RAW)) return -EPERM; return -EPERM; if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW && #ifdef CONFIG_SOCK_PACKET sock->type != SOCK_PACKET) && sock->type != SOCK_PACKET #endif ) return -ESOCKTNOSUPPORT; return -ESOCKTNOSUPPORT; sock->state = SS_UNCONNECTED; sock->state = SS_UNCONNECTED; Loading @@ -1008,10 +998,9 @@ static int packet_create(struct socket *sock, int protocol) goto out; goto out; sock->ops = &packet_ops; sock->ops = &packet_ops; #ifdef CONFIG_SOCK_PACKET if (sock->type == SOCK_PACKET) if (sock->type == SOCK_PACKET) sock->ops = &packet_ops_spkt; sock->ops = &packet_ops_spkt; #endif sock_init_data(sock, sk); sock_init_data(sock, sk); po = pkt_sk(sk); po = pkt_sk(sk); Loading @@ -1027,10 +1016,10 @@ static int packet_create(struct socket *sock, int protocol) spin_lock_init(&po->bind_lock); spin_lock_init(&po->bind_lock); po->prot_hook.func = packet_rcv; po->prot_hook.func = packet_rcv; #ifdef CONFIG_SOCK_PACKET if (sock->type == SOCK_PACKET) if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; po->prot_hook.func = packet_rcv_spkt; #endif po->prot_hook.af_packet_priv = sk; po->prot_hook.af_packet_priv = sk; if (proto) { if (proto) { Loading Loading @@ -1150,7 +1139,6 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, return err; return err; } } #ifdef CONFIG_SOCK_PACKET static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) int *uaddr_len, int peer) { { Loading @@ -1171,7 +1159,6 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, return 0; return 0; } } #endif static int packet_getname(struct socket *sock, struct sockaddr *uaddr, static int packet_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) int *uaddr_len, int peer) Loading Loading @@ -1833,7 +1820,6 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st #endif #endif #ifdef CONFIG_SOCK_PACKET static const struct proto_ops packet_ops_spkt = { static const struct proto_ops packet_ops_spkt = { .family = PF_PACKET, .family = PF_PACKET, .owner = THIS_MODULE, .owner = THIS_MODULE, Loading @@ -1854,7 +1840,6 @@ static const struct proto_ops packet_ops_spkt = { .mmap = sock_no_mmap, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage, }; }; #endif static const struct proto_ops packet_ops = { static const struct proto_ops packet_ops = { .family = PF_PACKET, .family = PF_PACKET, Loading Loading
net/packet/af_packet.c +5 −20 Original line number Original line Diff line number Diff line Loading @@ -83,8 +83,6 @@ #include <net/inet_common.h> #include <net/inet_common.h> #endif #endif #define CONFIG_SOCK_PACKET 1 /* /* Assumptions: Assumptions: - if device has no dev->hard_header routine, it adds and removes ll header - if device has no dev->hard_header routine, it adds and removes ll header Loading Loading @@ -246,7 +244,6 @@ static void packet_sock_destruct(struct sock *sk) static const struct proto_ops packet_ops; static const struct proto_ops packet_ops; #ifdef CONFIG_SOCK_PACKET static const struct proto_ops packet_ops_spkt; static const struct proto_ops packet_ops_spkt; static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) Loading Loading @@ -418,7 +415,6 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, dev_put(dev); dev_put(dev); return err; return err; } } #endif static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, unsigned int res) unsigned int res) Loading Loading @@ -917,8 +913,6 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc * Bind a packet socket to a device * Bind a packet socket to a device */ */ #ifdef CONFIG_SOCK_PACKET static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) { { struct sock *sk=sock->sk; struct sock *sk=sock->sk; Loading @@ -941,7 +935,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add } } return err; return err; } } #endif static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { { Loading Loading @@ -993,11 +986,8 @@ static int packet_create(struct socket *sock, int protocol) if (!capable(CAP_NET_RAW)) if (!capable(CAP_NET_RAW)) return -EPERM; return -EPERM; if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW && #ifdef CONFIG_SOCK_PACKET sock->type != SOCK_PACKET) && sock->type != SOCK_PACKET #endif ) return -ESOCKTNOSUPPORT; return -ESOCKTNOSUPPORT; sock->state = SS_UNCONNECTED; sock->state = SS_UNCONNECTED; Loading @@ -1008,10 +998,9 @@ static int packet_create(struct socket *sock, int protocol) goto out; goto out; sock->ops = &packet_ops; sock->ops = &packet_ops; #ifdef CONFIG_SOCK_PACKET if (sock->type == SOCK_PACKET) if (sock->type == SOCK_PACKET) sock->ops = &packet_ops_spkt; sock->ops = &packet_ops_spkt; #endif sock_init_data(sock, sk); sock_init_data(sock, sk); po = pkt_sk(sk); po = pkt_sk(sk); Loading @@ -1027,10 +1016,10 @@ static int packet_create(struct socket *sock, int protocol) spin_lock_init(&po->bind_lock); spin_lock_init(&po->bind_lock); po->prot_hook.func = packet_rcv; po->prot_hook.func = packet_rcv; #ifdef CONFIG_SOCK_PACKET if (sock->type == SOCK_PACKET) if (sock->type == SOCK_PACKET) po->prot_hook.func = packet_rcv_spkt; po->prot_hook.func = packet_rcv_spkt; #endif po->prot_hook.af_packet_priv = sk; po->prot_hook.af_packet_priv = sk; if (proto) { if (proto) { Loading Loading @@ -1150,7 +1139,6 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, return err; return err; } } #ifdef CONFIG_SOCK_PACKET static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) int *uaddr_len, int peer) { { Loading @@ -1171,7 +1159,6 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, return 0; return 0; } } #endif static int packet_getname(struct socket *sock, struct sockaddr *uaddr, static int packet_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) int *uaddr_len, int peer) Loading Loading @@ -1833,7 +1820,6 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st #endif #endif #ifdef CONFIG_SOCK_PACKET static const struct proto_ops packet_ops_spkt = { static const struct proto_ops packet_ops_spkt = { .family = PF_PACKET, .family = PF_PACKET, .owner = THIS_MODULE, .owner = THIS_MODULE, Loading @@ -1854,7 +1840,6 @@ static const struct proto_ops packet_ops_spkt = { .mmap = sock_no_mmap, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, .sendpage = sock_no_sendpage, }; }; #endif static const struct proto_ops packet_ops = { static const struct proto_ops packet_ops = { .family = PF_PACKET, .family = PF_PACKET, Loading