diff options
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index eb6be5030c70..8a7807dbba01 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -881,20 +881,14 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc | |||
881 | if (protocol == 0) | 881 | if (protocol == 0) |
882 | goto out_unlock; | 882 | goto out_unlock; |
883 | 883 | ||
884 | if (dev) { | 884 | if (!dev || (dev->flags & IFF_UP)) { |
885 | if (dev->flags&IFF_UP) { | ||
886 | dev_add_pack(&po->prot_hook); | ||
887 | sock_hold(sk); | ||
888 | po->running = 1; | ||
889 | } else { | ||
890 | sk->sk_err = ENETDOWN; | ||
891 | if (!sock_flag(sk, SOCK_DEAD)) | ||
892 | sk->sk_error_report(sk); | ||
893 | } | ||
894 | } else { | ||
895 | dev_add_pack(&po->prot_hook); | 885 | dev_add_pack(&po->prot_hook); |
896 | sock_hold(sk); | 886 | sock_hold(sk); |
897 | po->running = 1; | 887 | po->running = 1; |
888 | } else { | ||
889 | sk->sk_err = ENETDOWN; | ||
890 | if (!sock_flag(sk, SOCK_DEAD)) | ||
891 | sk->sk_error_report(sk); | ||
898 | } | 892 | } |
899 | 893 | ||
900 | out_unlock: | 894 | out_unlock: |