diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2009-01-21 18:54:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 18:54:15 -0500 |
commit | 6aba915881918a429d656e874f7fec2efd37ad96 (patch) | |
tree | dd04553bf94de691d6951768240092c122570805 /drivers/net/pppoe.c | |
parent | e2878806227d223467f84f900ef4c6733ee166df (diff) |
net: pppoe - code cleanup and helpers
- Introduce PPPOE_HASH_MASK.
- Remove redundant declaration of pppoe_chan_ops.
- Introduce stage_session helper.
- Tabs, space, long-line-split cleanup.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pppoe.c')
-rw-r--r-- | drivers/net/pppoe.c | 167 |
1 files changed, 86 insertions, 81 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 5efc3d172c8e..c2ceea4f46ba 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -84,32 +84,43 @@ | |||
84 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
85 | 85 | ||
86 | #define PPPOE_HASH_BITS 4 | 86 | #define PPPOE_HASH_BITS 4 |
87 | #define PPPOE_HASH_SIZE (1<<PPPOE_HASH_BITS) | 87 | #define PPPOE_HASH_SIZE (1 << PPPOE_HASH_BITS) |
88 | 88 | #define PPPOE_HASH_MASK (PPPOE_HASH_SIZE - 1) | |
89 | static struct ppp_channel_ops pppoe_chan_ops; | ||
90 | 89 | ||
91 | static int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 90 | static int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
92 | static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb); | 91 | static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb); |
93 | static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb); | 92 | static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb); |
94 | 93 | ||
95 | static const struct proto_ops pppoe_ops; | 94 | static const struct proto_ops pppoe_ops; |
95 | static struct ppp_channel_ops pppoe_chan_ops; | ||
96 | static DEFINE_RWLOCK(pppoe_hash_lock); | 96 | static DEFINE_RWLOCK(pppoe_hash_lock); |
97 | 97 | ||
98 | static struct ppp_channel_ops pppoe_chan_ops; | 98 | /* |
99 | * PPPoE could be in the following stages: | ||
100 | * 1) Discovery stage (to obtain remote MAC and Session ID) | ||
101 | * 2) Session stage (MAC and SID are known) | ||
102 | * | ||
103 | * Ethernet frames have a special tag for this but | ||
104 | * we use simplier approach based on session id | ||
105 | */ | ||
106 | static inline bool stage_session(__be16 sid) | ||
107 | { | ||
108 | return sid != 0; | ||
109 | } | ||
99 | 110 | ||
100 | static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b) | 111 | static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b) |
101 | { | 112 | { |
102 | return (a->sid == b->sid && | 113 | return a->sid == b->sid && |
103 | (memcmp(a->remote, b->remote, ETH_ALEN) == 0)); | 114 | (memcmp(a->remote, b->remote, ETH_ALEN) == 0); |
104 | } | 115 | } |
105 | 116 | ||
106 | static inline int cmp_addr(struct pppoe_addr *a, __be16 sid, char *addr) | 117 | static inline int cmp_addr(struct pppoe_addr *a, __be16 sid, char *addr) |
107 | { | 118 | { |
108 | return (a->sid == sid && | 119 | return a->sid == sid && |
109 | (memcmp(a->remote,addr,ETH_ALEN) == 0)); | 120 | (memcmp(a->remote, addr, ETH_ALEN) == 0); |
110 | } | 121 | } |
111 | 122 | ||
112 | #if 8%PPPOE_HASH_BITS | 123 | #if 8 % PPPOE_HASH_BITS |
113 | #error 8 must be a multiple of PPPOE_HASH_BITS | 124 | #error 8 must be a multiple of PPPOE_HASH_BITS |
114 | #endif | 125 | #endif |
115 | 126 | ||
@@ -118,17 +129,14 @@ static int hash_item(__be16 sid, unsigned char *addr) | |||
118 | unsigned char hash = 0; | 129 | unsigned char hash = 0; |
119 | unsigned int i; | 130 | unsigned int i; |
120 | 131 | ||
121 | for (i = 0 ; i < ETH_ALEN ; i++) { | 132 | for (i = 0; i < ETH_ALEN; i++) |
122 | hash ^= addr[i]; | 133 | hash ^= addr[i]; |
123 | } | 134 | for (i = 0; i < sizeof(sid_t) * 8; i += 8) |
124 | for (i = 0 ; i < sizeof(sid_t)*8 ; i += 8 ){ | 135 | hash ^= (__force __u32)sid >> i; |
125 | hash ^= (__force __u32)sid>>i; | 136 | for (i = 8; (i >>= 1) >= PPPOE_HASH_BITS;) |
126 | } | 137 | hash ^= hash >> i; |
127 | for (i = 8 ; (i>>=1) >= PPPOE_HASH_BITS ; ) { | ||
128 | hash ^= hash>>i; | ||
129 | } | ||
130 | 138 | ||
131 | return hash & ( PPPOE_HASH_SIZE - 1 ); | 139 | return hash & PPPOE_HASH_MASK; |
132 | } | 140 | } |
133 | 141 | ||
134 | /* zeroed because its in .bss */ | 142 | /* zeroed because its in .bss */ |
@@ -146,10 +154,15 @@ static struct pppox_sock *__get_item(__be16 sid, unsigned char *addr, int ifinde | |||
146 | 154 | ||
147 | ret = item_hash_table[hash]; | 155 | ret = item_hash_table[hash]; |
148 | 156 | ||
149 | while (ret && !(cmp_addr(&ret->pppoe_pa, sid, addr) && ret->pppoe_ifindex == ifindex)) | 157 | while (ret) { |
158 | if (cmp_addr(&ret->pppoe_pa, sid, addr) && | ||
159 | ret->pppoe_ifindex == ifindex) | ||
160 | return ret; | ||
161 | |||
150 | ret = ret->next; | 162 | ret = ret->next; |
163 | } | ||
151 | 164 | ||
152 | return ret; | 165 | return NULL; |
153 | } | 166 | } |
154 | 167 | ||
155 | static int __set_item(struct pppox_sock *po) | 168 | static int __set_item(struct pppox_sock *po) |
@@ -159,7 +172,8 @@ static int __set_item(struct pppox_sock *po) | |||
159 | 172 | ||
160 | ret = item_hash_table[hash]; | 173 | ret = item_hash_table[hash]; |
161 | while (ret) { | 174 | while (ret) { |
162 | if (cmp_2_addr(&ret->pppoe_pa, &po->pppoe_pa) && ret->pppoe_ifindex == po->pppoe_ifindex) | 175 | if (cmp_2_addr(&ret->pppoe_pa, &po->pppoe_pa) && |
176 | ret->pppoe_ifindex == po->pppoe_ifindex) | ||
163 | return -EALREADY; | 177 | return -EALREADY; |
164 | 178 | ||
165 | ret = ret->next; | 179 | ret = ret->next; |
@@ -180,7 +194,8 @@ static struct pppox_sock *__delete_item(__be16 sid, char *addr, int ifindex) | |||
180 | src = &item_hash_table[hash]; | 194 | src = &item_hash_table[hash]; |
181 | 195 | ||
182 | while (ret) { | 196 | while (ret) { |
183 | if (cmp_addr(&ret->pppoe_pa, sid, addr) && ret->pppoe_ifindex == ifindex) { | 197 | if (cmp_addr(&ret->pppoe_pa, sid, addr) && |
198 | ret->pppoe_ifindex == ifindex) { | ||
184 | *src = ret->next; | 199 | *src = ret->next; |
185 | break; | 200 | break; |
186 | } | 201 | } |
@@ -217,7 +232,7 @@ static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp) | |||
217 | int ifindex; | 232 | int ifindex; |
218 | 233 | ||
219 | dev = dev_get_by_name(&init_net, sp->sa_addr.pppoe.dev); | 234 | dev = dev_get_by_name(&init_net, sp->sa_addr.pppoe.dev); |
220 | if(!dev) | 235 | if (!dev) |
221 | return NULL; | 236 | return NULL; |
222 | ifindex = dev->ifindex; | 237 | ifindex = dev->ifindex; |
223 | dev_put(dev); | 238 | dev_put(dev); |
@@ -329,7 +344,6 @@ static struct notifier_block pppoe_notifier = { | |||
329 | .notifier_call = pppoe_device_event, | 344 | .notifier_call = pppoe_device_event, |
330 | }; | 345 | }; |
331 | 346 | ||
332 | |||
333 | /************************************************************************ | 347 | /************************************************************************ |
334 | * | 348 | * |
335 | * Do the real work of receiving a PPPoE Session frame. | 349 | * Do the real work of receiving a PPPoE Session frame. |
@@ -383,7 +397,8 @@ static int pppoe_rcv(struct sk_buff *skb, | |||
383 | struct pppox_sock *po; | 397 | struct pppox_sock *po; |
384 | int len; | 398 | int len; |
385 | 399 | ||
386 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 400 | skb = skb_share_check(skb, GFP_ATOMIC); |
401 | if (!skb) | ||
387 | goto out; | 402 | goto out; |
388 | 403 | ||
389 | if (dev_net(dev) != &init_net) | 404 | if (dev_net(dev) != &init_net) |
@@ -432,7 +447,8 @@ static int pppoe_disc_rcv(struct sk_buff *skb, | |||
432 | if (dev_net(dev) != &init_net) | 447 | if (dev_net(dev) != &init_net) |
433 | goto abort; | 448 | goto abort; |
434 | 449 | ||
435 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 450 | skb = skb_share_check(skb, GFP_ATOMIC); |
451 | if (!skb) | ||
436 | goto out; | 452 | goto out; |
437 | 453 | ||
438 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) | 454 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) |
@@ -493,12 +509,11 @@ static struct proto pppoe_sk_proto = { | |||
493 | **********************************************************************/ | 509 | **********************************************************************/ |
494 | static int pppoe_create(struct net *net, struct socket *sock) | 510 | static int pppoe_create(struct net *net, struct socket *sock) |
495 | { | 511 | { |
496 | int error = -ENOMEM; | ||
497 | struct sock *sk; | 512 | struct sock *sk; |
498 | 513 | ||
499 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto); | 514 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto); |
500 | if (!sk) | 515 | if (!sk) |
501 | goto out; | 516 | return -ENOMEM; |
502 | 517 | ||
503 | sock_init_data(sock, sk); | 518 | sock_init_data(sock, sk); |
504 | 519 | ||
@@ -511,8 +526,7 @@ static int pppoe_create(struct net *net, struct socket *sock) | |||
511 | sk->sk_family = PF_PPPOX; | 526 | sk->sk_family = PF_PPPOX; |
512 | sk->sk_protocol = PX_PROTO_OE; | 527 | sk->sk_protocol = PX_PROTO_OE; |
513 | 528 | ||
514 | error = 0; | 529 | return 0; |
515 | out: return error; | ||
516 | } | 530 | } |
517 | 531 | ||
518 | static int pppoe_release(struct socket *sock) | 532 | static int pppoe_release(struct socket *sock) |
@@ -524,7 +538,7 @@ static int pppoe_release(struct socket *sock) | |||
524 | return 0; | 538 | return 0; |
525 | 539 | ||
526 | lock_sock(sk); | 540 | lock_sock(sk); |
527 | if (sock_flag(sk, SOCK_DEAD)){ | 541 | if (sock_flag(sk, SOCK_DEAD)) { |
528 | release_sock(sk); | 542 | release_sock(sk); |
529 | return -EBADF; | 543 | return -EBADF; |
530 | } | 544 | } |
@@ -542,7 +556,7 @@ static int pppoe_release(struct socket *sock) | |||
542 | write_lock_bh(&pppoe_hash_lock); | 556 | write_lock_bh(&pppoe_hash_lock); |
543 | 557 | ||
544 | po = pppox_sk(sk); | 558 | po = pppox_sk(sk); |
545 | if (po->pppoe_pa.sid) { | 559 | if (stage_session(po->pppoe_pa.sid)) { |
546 | __delete_item(po->pppoe_pa.sid, | 560 | __delete_item(po->pppoe_pa.sid, |
547 | po->pppoe_pa.remote, po->pppoe_ifindex); | 561 | po->pppoe_pa.remote, po->pppoe_ifindex); |
548 | } | 562 | } |
@@ -564,7 +578,6 @@ static int pppoe_release(struct socket *sock) | |||
564 | return 0; | 578 | return 0; |
565 | } | 579 | } |
566 | 580 | ||
567 | |||
568 | static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | 581 | static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, |
569 | int sockaddr_len, int flags) | 582 | int sockaddr_len, int flags) |
570 | { | 583 | { |
@@ -582,32 +595,31 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
582 | 595 | ||
583 | /* Check for already bound sockets */ | 596 | /* Check for already bound sockets */ |
584 | error = -EBUSY; | 597 | error = -EBUSY; |
585 | if ((sk->sk_state & PPPOX_CONNECTED) && sp->sa_addr.pppoe.sid) | 598 | if ((sk->sk_state & PPPOX_CONNECTED) && |
599 | stage_session(sp->sa_addr.pppoe.sid)) | ||
586 | goto end; | 600 | goto end; |
587 | 601 | ||
588 | /* Check for already disconnected sockets, on attempts to disconnect */ | 602 | /* Check for already disconnected sockets, on attempts to disconnect */ |
589 | error = -EALREADY; | 603 | error = -EALREADY; |
590 | if ((sk->sk_state & PPPOX_DEAD) && !sp->sa_addr.pppoe.sid ) | 604 | if ((sk->sk_state & PPPOX_DEAD) && |
605 | !stage_session(sp->sa_addr.pppoe.sid)) | ||
591 | goto end; | 606 | goto end; |
592 | 607 | ||
593 | error = 0; | 608 | error = 0; |
594 | if (po->pppoe_pa.sid) { | ||
595 | pppox_unbind_sock(sk); | ||
596 | 609 | ||
597 | /* Delete the old binding */ | 610 | /* Delete the old binding */ |
598 | delete_item(po->pppoe_pa.sid,po->pppoe_pa.remote,po->pppoe_ifindex); | 611 | if (stage_session(po->pppoe_pa.sid)) { |
599 | 612 | pppox_unbind_sock(sk); | |
600 | if(po->pppoe_dev) | 613 | delete_item(po->pppoe_pa.sid, po->pppoe_pa.remote, po->pppoe_ifindex); |
614 | if (po->pppoe_dev) | ||
601 | dev_put(po->pppoe_dev); | 615 | dev_put(po->pppoe_dev); |
602 | |||
603 | memset(sk_pppox(po) + 1, 0, | 616 | memset(sk_pppox(po) + 1, 0, |
604 | sizeof(struct pppox_sock) - sizeof(struct sock)); | 617 | sizeof(struct pppox_sock) - sizeof(struct sock)); |
605 | |||
606 | sk->sk_state = PPPOX_NONE; | 618 | sk->sk_state = PPPOX_NONE; |
607 | } | 619 | } |
608 | 620 | ||
609 | /* Don't re-bind if sid==0 */ | 621 | /* Re-bind in session stage only */ |
610 | if (sp->sa_addr.pppoe.sid != 0) { | 622 | if (stage_session(sp->sa_addr.pppoe.sid)) { |
611 | dev = dev_get_by_name(&init_net, sp->sa_addr.pppoe.dev); | 623 | dev = dev_get_by_name(&init_net, sp->sa_addr.pppoe.dev); |
612 | 624 | ||
613 | error = -ENODEV; | 625 | error = -ENODEV; |
@@ -618,7 +630,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
618 | po->pppoe_ifindex = dev->ifindex; | 630 | po->pppoe_ifindex = dev->ifindex; |
619 | 631 | ||
620 | write_lock_bh(&pppoe_hash_lock); | 632 | write_lock_bh(&pppoe_hash_lock); |
621 | if (!(dev->flags & IFF_UP)){ | 633 | if (!(dev->flags & IFF_UP)) { |
622 | write_unlock_bh(&pppoe_hash_lock); | 634 | write_unlock_bh(&pppoe_hash_lock); |
623 | goto err_put; | 635 | goto err_put; |
624 | } | 636 | } |
@@ -648,7 +660,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
648 | 660 | ||
649 | po->num = sp->sa_addr.pppoe.sid; | 661 | po->num = sp->sa_addr.pppoe.sid; |
650 | 662 | ||
651 | end: | 663 | end: |
652 | release_sock(sk); | 664 | release_sock(sk); |
653 | return error; | 665 | return error; |
654 | err_put: | 666 | err_put: |
@@ -659,7 +671,6 @@ err_put: | |||
659 | goto end; | 671 | goto end; |
660 | } | 672 | } |
661 | 673 | ||
662 | |||
663 | static int pppoe_getname(struct socket *sock, struct sockaddr *uaddr, | 674 | static int pppoe_getname(struct socket *sock, struct sockaddr *uaddr, |
664 | int *usockaddr_len, int peer) | 675 | int *usockaddr_len, int peer) |
665 | { | 676 | { |
@@ -678,7 +689,6 @@ static int pppoe_getname(struct socket *sock, struct sockaddr *uaddr, | |||
678 | return 0; | 689 | return 0; |
679 | } | 690 | } |
680 | 691 | ||
681 | |||
682 | static int pppoe_ioctl(struct socket *sock, unsigned int cmd, | 692 | static int pppoe_ioctl(struct socket *sock, unsigned int cmd, |
683 | unsigned long arg) | 693 | unsigned long arg) |
684 | { | 694 | { |
@@ -709,7 +719,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, | |||
709 | break; | 719 | break; |
710 | 720 | ||
711 | err = -EFAULT; | 721 | err = -EFAULT; |
712 | if (get_user(val,(int __user *) arg)) | 722 | if (get_user(val, (int __user *)arg)) |
713 | break; | 723 | break; |
714 | 724 | ||
715 | if (val < (po->pppoe_dev->mtu | 725 | if (val < (po->pppoe_dev->mtu |
@@ -722,7 +732,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, | |||
722 | 732 | ||
723 | case PPPIOCSFLAGS: | 733 | case PPPIOCSFLAGS: |
724 | err = -EFAULT; | 734 | err = -EFAULT; |
725 | if (get_user(val, (int __user *) arg)) | 735 | if (get_user(val, (int __user *)arg)) |
726 | break; | 736 | break; |
727 | err = 0; | 737 | err = 0; |
728 | break; | 738 | break; |
@@ -749,7 +759,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, | |||
749 | 759 | ||
750 | err = -EINVAL; | 760 | err = -EINVAL; |
751 | if (po->pppoe_relay.sa_family != AF_PPPOX || | 761 | if (po->pppoe_relay.sa_family != AF_PPPOX || |
752 | po->pppoe_relay.sa_protocol!= PX_PROTO_OE) | 762 | po->pppoe_relay.sa_protocol != PX_PROTO_OE) |
753 | break; | 763 | break; |
754 | 764 | ||
755 | /* Check that the socket referenced by the address | 765 | /* Check that the socket referenced by the address |
@@ -781,7 +791,6 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, | |||
781 | return err; | 791 | return err; |
782 | } | 792 | } |
783 | 793 | ||
784 | |||
785 | static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, | 794 | static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, |
786 | struct msghdr *m, size_t total_len) | 795 | struct msghdr *m, size_t total_len) |
787 | { | 796 | { |
@@ -808,7 +817,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
808 | dev = po->pppoe_dev; | 817 | dev = po->pppoe_dev; |
809 | 818 | ||
810 | error = -EMSGSIZE; | 819 | error = -EMSGSIZE; |
811 | if (total_len > (dev->mtu + dev->hard_header_len)) | 820 | if (total_len > (dev->mtu + dev->hard_header_len)) |
812 | goto end; | 821 | goto end; |
813 | 822 | ||
814 | 823 | ||
@@ -853,7 +862,6 @@ end: | |||
853 | return error; | 862 | return error; |
854 | } | 863 | } |
855 | 864 | ||
856 | |||
857 | /************************************************************************ | 865 | /************************************************************************ |
858 | * | 866 | * |
859 | * xmit function for internal use. | 867 | * xmit function for internal use. |
@@ -903,7 +911,6 @@ abort: | |||
903 | return 1; | 911 | return 1; |
904 | } | 912 | } |
905 | 913 | ||
906 | |||
907 | /************************************************************************ | 914 | /************************************************************************ |
908 | * | 915 | * |
909 | * xmit function called by generic PPP driver | 916 | * xmit function called by generic PPP driver |
@@ -916,7 +923,6 @@ static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
916 | return __pppoe_xmit(sk, skb); | 923 | return __pppoe_xmit(sk, skb); |
917 | } | 924 | } |
918 | 925 | ||
919 | |||
920 | static struct ppp_channel_ops pppoe_chan_ops = { | 926 | static struct ppp_channel_ops pppoe_chan_ops = { |
921 | .start_xmit = pppoe_xmit, | 927 | .start_xmit = pppoe_xmit, |
922 | }; | 928 | }; |
@@ -976,9 +982,9 @@ out: | |||
976 | static __inline__ struct pppox_sock *pppoe_get_idx(loff_t pos) | 982 | static __inline__ struct pppox_sock *pppoe_get_idx(loff_t pos) |
977 | { | 983 | { |
978 | struct pppox_sock *po; | 984 | struct pppox_sock *po; |
979 | int i = 0; | 985 | int i; |
980 | 986 | ||
981 | for (; i < PPPOE_HASH_SIZE; i++) { | 987 | for (i = 0; i < PPPOE_HASH_SIZE; i++) { |
982 | po = item_hash_table[i]; | 988 | po = item_hash_table[i]; |
983 | while (po) { | 989 | while (po) { |
984 | if (!pos--) | 990 | if (!pos--) |
@@ -1064,32 +1070,31 @@ static inline int pppoe_proc_init(void) { return 0; } | |||
1064 | #endif /* CONFIG_PROC_FS */ | 1070 | #endif /* CONFIG_PROC_FS */ |
1065 | 1071 | ||
1066 | static const struct proto_ops pppoe_ops = { | 1072 | static const struct proto_ops pppoe_ops = { |
1067 | .family = AF_PPPOX, | 1073 | .family = AF_PPPOX, |
1068 | .owner = THIS_MODULE, | 1074 | .owner = THIS_MODULE, |
1069 | .release = pppoe_release, | 1075 | .release = pppoe_release, |
1070 | .bind = sock_no_bind, | 1076 | .bind = sock_no_bind, |
1071 | .connect = pppoe_connect, | 1077 | .connect = pppoe_connect, |
1072 | .socketpair = sock_no_socketpair, | 1078 | .socketpair = sock_no_socketpair, |
1073 | .accept = sock_no_accept, | 1079 | .accept = sock_no_accept, |
1074 | .getname = pppoe_getname, | 1080 | .getname = pppoe_getname, |
1075 | .poll = datagram_poll, | 1081 | .poll = datagram_poll, |
1076 | .listen = sock_no_listen, | 1082 | .listen = sock_no_listen, |
1077 | .shutdown = sock_no_shutdown, | 1083 | .shutdown = sock_no_shutdown, |
1078 | .setsockopt = sock_no_setsockopt, | 1084 | .setsockopt = sock_no_setsockopt, |
1079 | .getsockopt = sock_no_getsockopt, | 1085 | .getsockopt = sock_no_getsockopt, |
1080 | .sendmsg = pppoe_sendmsg, | 1086 | .sendmsg = pppoe_sendmsg, |
1081 | .recvmsg = pppoe_recvmsg, | 1087 | .recvmsg = pppoe_recvmsg, |
1082 | .mmap = sock_no_mmap, | 1088 | .mmap = sock_no_mmap, |
1083 | .ioctl = pppox_ioctl, | 1089 | .ioctl = pppox_ioctl, |
1084 | }; | 1090 | }; |
1085 | 1091 | ||
1086 | static struct pppox_proto pppoe_proto = { | 1092 | static struct pppox_proto pppoe_proto = { |
1087 | .create = pppoe_create, | 1093 | .create = pppoe_create, |
1088 | .ioctl = pppoe_ioctl, | 1094 | .ioctl = pppoe_ioctl, |
1089 | .owner = THIS_MODULE, | 1095 | .owner = THIS_MODULE, |
1090 | }; | 1096 | }; |
1091 | 1097 | ||
1092 | |||
1093 | static int __init pppoe_init(void) | 1098 | static int __init pppoe_init(void) |
1094 | { | 1099 | { |
1095 | int err = proto_register(&pppoe_sk_proto, 0); | 1100 | int err = proto_register(&pppoe_sk_proto, 0); |
@@ -1097,7 +1102,7 @@ static int __init pppoe_init(void) | |||
1097 | if (err) | 1102 | if (err) |
1098 | goto out; | 1103 | goto out; |
1099 | 1104 | ||
1100 | err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto); | 1105 | err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto); |
1101 | if (err) | 1106 | if (err) |
1102 | goto out_unregister_pppoe_proto; | 1107 | goto out_unregister_pppoe_proto; |
1103 | 1108 | ||