]> err.no Git - linux-2.6/blobdiff - net/atm/mpc.c
Merge git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6] / net / atm / mpc.c
index 0968430a7f58274dfb459737c0eb4db660e3d311..9c7f712fc7e9c331e4dcd3c3b1d9c0fbdae3b01b 100644 (file)
@@ -244,7 +244,7 @@ static struct net_device *find_lec_by_itfnum(int itf)
        char name[IFNAMSIZ];
 
        sprintf(name, "lec%d", itf);
-       dev = dev_get_by_name(name);
+       dev = dev_get_by_name(&init_net, name);
 
        return dev;
 }
@@ -542,6 +542,13 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
        if (eth->h_proto != htons(ETH_P_IP))
                goto non_ip; /* Multi-Protocol Over ATM :-) */
 
+       /* Weed out funny packets (e.g., AF_PACKET or raw). */
+       if (skb->len < ETH_HLEN + sizeof(struct iphdr))
+               goto non_ip;
+       skb_set_network_header(skb, ETH_HLEN);
+       if (skb->len < ETH_HLEN + ip_hdr(skb)->ihl * 4 || ip_hdr(skb)->ihl < 5)
+               goto non_ip;
+
        while (i < mpc->number_of_mps_macs) {
                if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
                        if ( send_via_shortcut(skb, mpc) == 0 )           /* try shortcut */