@@ -1270,8 +1270,10 @@ static int handle_ip_over_ddp(struct sk_buff *skb)
12701270 struct net_device_stats * stats ;
12711271
12721272 /* This needs to be able to handle ipddp"N" devices */
1273- if (!dev )
1274- return - ENODEV ;
1273+ if (!dev ) {
1274+ kfree_skb (skb );
1275+ return NET_RX_DROP ;
1276+ }
12751277
12761278 skb -> protocol = htons (ETH_P_IP );
12771279 skb_pull (skb , 13 );
@@ -1281,18 +1283,16 @@ static int handle_ip_over_ddp(struct sk_buff *skb)
12811283 stats = netdev_priv (dev );
12821284 stats -> rx_packets ++ ;
12831285 stats -> rx_bytes += skb -> len + 13 ;
1284- netif_rx (skb ); /* Send the SKB up to a higher place. */
1285- return 0 ;
1286+ return netif_rx (skb ); /* Send the SKB up to a higher place. */
12861287}
12871288#else
12881289/* make it easy for gcc to optimize this test out, i.e. kill the code */
12891290#define is_ip_over_ddp (skb ) 0
12901291#define handle_ip_over_ddp (skb ) 0
12911292#endif
12921293
1293- static void atalk_route_packet (struct sk_buff * skb , struct net_device * dev ,
1294- struct ddpehdr * ddp , __u16 len_hops ,
1295- int origlen )
1294+ static int atalk_route_packet (struct sk_buff * skb , struct net_device * dev ,
1295+ struct ddpehdr * ddp , __u16 len_hops , int origlen )
12961296{
12971297 struct atalk_route * rt ;
12981298 struct atalk_addr ta ;
@@ -1359,8 +1359,6 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
13591359 /* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */
13601360 struct sk_buff * nskb = skb_realloc_headroom (skb , 32 );
13611361 kfree_skb (skb );
1362- if (!nskb )
1363- goto out ;
13641362 skb = nskb ;
13651363 } else
13661364 skb = skb_unshare (skb , GFP_ATOMIC );
@@ -1369,12 +1367,16 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
13691367 * If the buffer didn't vanish into the lack of space bitbucket we can
13701368 * send it.
13711369 */
1372- if (skb && aarp_send_ddp (rt -> dev , skb , & ta , NULL ) == -1 )
1373- goto free_it ;
1374- out :
1375- return ;
1370+ if (skb == NULL )
1371+ goto drop ;
1372+
1373+ if (aarp_send_ddp (rt -> dev , skb , & ta , NULL ) == NET_XMIT_DROP )
1374+ return NET_RX_DROP ;
1375+ return NET_XMIT_SUCCESS ;
13761376free_it :
13771377 kfree_skb (skb );
1378+ drop :
1379+ return NET_RX_DROP ;
13781380}
13791381
13801382/**
@@ -1448,8 +1450,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
14481450 /* Not ours, so we route the packet via the correct
14491451 * AppleTalk iface
14501452 */
1451- atalk_route_packet (skb , dev , ddp , len_hops , origlen );
1452- return NET_RX_SUCCESS ;
1453+ return atalk_route_packet (skb , dev , ddp , len_hops , origlen );
14531454 }
14541455
14551456 /* if IP over DDP is not selected this code will be optimized out */
@@ -1655,10 +1656,10 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
16551656 if (skb2 ) {
16561657 loopback = 1 ;
16571658 SOCK_DEBUG (sk , "SK %p: send out(copy).\n" , sk );
1658- if ( aarp_send_ddp ( dev , skb2 ,
1659- & usat -> sat_addr , NULL ) == -1 )
1660- kfree_skb ( skb2 );
1661- /* else queued/sent above in the aarp queue */
1659+ /*
1660+ * If it fails it is queued/sent above in the aarp queue
1661+ */
1662+ aarp_send_ddp ( dev , skb2 , & usat -> sat_addr , NULL );
16621663 }
16631664 }
16641665
@@ -1688,9 +1689,10 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
16881689 usat = & gsat ;
16891690 }
16901691
1691- if (aarp_send_ddp (dev , skb , & usat -> sat_addr , NULL ) == -1 )
1692- kfree_skb (skb );
1693- /* else queued/sent above in the aarp queue */
1692+ /*
1693+ * If it fails it is queued/sent above in the aarp queue
1694+ */
1695+ aarp_send_ddp (dev , skb , & usat -> sat_addr , NULL );
16941696 }
16951697 SOCK_DEBUG (sk , "SK %p: Done write (%Zd).\n" , sk , len );
16961698
@@ -1868,7 +1870,6 @@ static struct packet_type ppptalk_packet_type __read_mostly = {
18681870static unsigned char ddp_snap_id [] = { 0x08 , 0x00 , 0x07 , 0x80 , 0x9B };
18691871
18701872/* Export symbols for use by drivers when AppleTalk is a module */
1871- EXPORT_SYMBOL (aarp_send_ddp );
18721873EXPORT_SYMBOL (atrtr_get_dev );
18731874EXPORT_SYMBOL (atalk_find_dev_addr );
18741875
0 commit comments