summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
authorJohannes Stezenbach <devnull@localhost>2004-01-30 15:34:06 +0000
committerJohannes Stezenbach <devnull@localhost>2004-01-30 15:34:06 +0000
commitde5d035b7644dccbb780dc5cba0f48655d56c63c (patch)
treecfe9255f613a8378ee8d254871d3e2f02aa30cab /linux/drivers/media/dvb/dvb-core
parente505cd85c749e55982171f622fa2fb134231fd63 (diff)
downloadmediapointer-dvb-s2-de5d035b7644dccbb780dc5cba0f48655d56c63c.tar.gz
mediapointer-dvb-s2-de5d035b7644dccbb780dc5cba0f48655d56c63c.tar.bz2
- fix NET_GET_IF Oops on 2.6.x
- do less error checking for incoming MPE sections (some ISPs set reserved bits and the current/next indicator wrong)
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index 9d7f40fbe..93bf8f699 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -112,30 +112,38 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
{
u8 *eth;
struct sk_buff *skb;
+ struct net_device_stats *stats = &(((struct dvb_net_priv *) dev->priv)->stats);
/* note: pkt_len includes a 32bit checksum */
if (pkt_len < 16) {
printk("%s: IP/MPE packet length = %d too small.\n",
dev->name, pkt_len);
- ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++;
- ((struct dvb_net_priv *) dev->priv)->stats.rx_length_errors++;
+ stats->rx_errors++;
+ stats->rx_length_errors++;
return;
}
+/* it seems some ISPs manage to screw up here, so we have to
+ * relax the error checks... */
+#if 0
if ((pkt[5] & 0xfd) != 0xc1) {
/* drop scrambled or broken packets */
- ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++;
- ((struct dvb_net_priv *) dev->priv)->stats.rx_crc_errors++;
+#else
+ if ((pkt[5] & 0x3c) != 0x00) {
+ /* drop scrambled */
+#endif
+ stats->rx_errors++;
+ stats->rx_crc_errors++;
return;
}
if (pkt[5] & 0x02) {
//FIXME: handle LLC/SNAP
- ((struct dvb_net_priv *)dev->priv)->stats.rx_dropped++;
+ stats->rx_dropped++;
return;
}
if (pkt[7]) {
/* FIXME: assemble datagram from multiple sections */
- ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++;
- ((struct dvb_net_priv *) dev->priv)->stats.rx_frame_errors++;
+ stats->rx_errors++;
+ stats->rx_frame_errors++;
return;
}
@@ -144,7 +152,7 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
*/
if (!(skb = dev_alloc_skb(pkt_len - 4 - 12 + 14 + 2))) {
//printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
- ((struct dvb_net_priv *) dev->priv)->stats.rx_dropped++;
+ stats->rx_dropped++;
return;
}
skb_reserve(skb, 2); /* longword align L3 header */
@@ -168,12 +176,12 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
eth[13] = 0x00;
skb->protocol = dvb_net_eth_type_trans(skb, dev);
-
- ((struct dvb_net_priv *)dev->priv)->stats.rx_packets++;
- ((struct dvb_net_priv *)dev->priv)->stats.rx_bytes+=skb->len;
+
+ stats->rx_packets++;
+ stats->rx_bytes+=skb->len;
netif_rx(skb);
}
-
+
static int dvb_net_callback(const u8 *buffer1, size_t buffer1_len,
const u8 *buffer2, size_t buffer2_len,
struct dmx_section_filter *filter,
@@ -651,9 +659,13 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
if (dvbnetif->if_num >= DVB_NET_DEVICES_MAX ||
!dvbnet->state[dvbnetif->if_num])
- return -EFAULT;
+ return -EINVAL;
- netdev=(struct net_device*)&dvbnet->device[dvbnetif->if_num];
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ netdev = &dvbnet->device[dvbnetif->if_num];
+#else
+ netdev = dvbnet->device[dvbnetif->if_num];
+#endif
priv_data=(struct dvb_net_priv*)netdev->priv;
dvbnetif->pid=priv_data->pid;
break;
@@ -663,7 +675,7 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
return -EPERM;
return dvb_net_remove_if(dvbnet, (int) (long) parg);
default:
- return -EINVAL;
+ return -ENOTTY;
}
return 0;
}