]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
Beautify check for valid CAN netdevices.
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Thu, 1 Sep 2011 09:18:54 +0000 (09:18 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Thu, 1 Sep 2011 09:18:54 +0000 (09:18 +0000)
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1269 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/net/can/gw.c

index 5e2a459869f1b44e47f08fb955f0f11848f4f556..d7257ccbcb1439336914242d8991f5e9a4512659 100644 (file)
@@ -821,10 +821,8 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
        if (!gwj->src.dev)
                goto out;
 
        if (!gwj->src.dev)
                goto out;
 
-       if (gwj->src.dev->type != ARPHRD_CAN)
-               goto put_src_out;
-
-       if (gwj->src.dev->header_ops)
+       /* check for CAN netdev not using header_ops - see gw_rcv() */
+       if (gwj->src.dev->type != ARPHRD_CAN || gwj->src.dev->header_ops)
                goto put_src_out;
 
        gwj->dst.dev = dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
                goto put_src_out;
 
        gwj->dst.dev = dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
@@ -832,10 +830,8 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
        if (!gwj->dst.dev)
                goto put_src_out;
 
        if (!gwj->dst.dev)
                goto put_src_out;
 
-       if (gwj->dst.dev->type != ARPHRD_CAN)
-               goto put_src_dst_out;
-
-       if (gwj->dst.dev->header_ops)
+       /* check for CAN netdev not using header_ops - see gw_rcv() */
+       if (gwj->dst.dev->type != ARPHRD_CAN || gwj->dst.dev->header_ops)
                goto put_src_dst_out;
 
        ASSERT_RTNL();
                goto put_src_dst_out;
 
        ASSERT_RTNL();