extern int     arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
 extern void     arp_send(int type, int ptype, __be32 dest_ip,
                         struct net_device *dev, __be32 src_ip,
-                        unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
+                        const unsigned char *dest_hw,
+                        const unsigned char *src_hw, const unsigned char *th);
 extern int     arp_bind_neighbour(struct dst_entry *dst);
 extern int     arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
 extern void    arp_ifdown(struct net_device *dev);
 
 extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
                                  struct net_device *dev, __be32 src_ip,
-                                 unsigned char *dest_hw, unsigned char *src_hw,
-                                 unsigned char *target_hw);
+                                 const unsigned char *dest_hw,
+                                 const unsigned char *src_hw,
+                                 const unsigned char *target_hw);
 extern void arp_xmit(struct sk_buff *skb);
 
 extern struct neigh_ops arp_broken_ops;
 
 static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *in,
    const struct net_device *out, const void *data, unsigned int datalen)
 {
-       struct ebt_802_3_info *info = (struct ebt_802_3_info *)data;
-       struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb);
+       const struct ebt_802_3_info *info = data;
+       const struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb);
        __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type;
 
        if (info->bitmask & EBT_802_3_SAP) {
 static int ebt_802_3_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_802_3_info *info = (struct ebt_802_3_info *)data;
+       const struct ebt_802_3_info *info = data;
 
        if (datalen < sizeof(struct ebt_802_3_info))
                return -EINVAL;
 
        const struct ebt_mac_wormhash_tuple *p;
        int start, limit, i;
        uint32_t cmp[2] = { 0, 0 };
-       int key = (const unsigned char) mac[5];
+       int key = ((const unsigned char *)mac)[5];
 
        memcpy(((char *) cmp) + 2, mac, 6);
        start = wh->table[key];
 static int get_ip_dst(const struct sk_buff *skb, __be32 *addr)
 {
        if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) {
-               struct iphdr _iph, *ih;
+               const struct iphdr *ih;
+               struct iphdr _iph;
 
                ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
                if (ih == NULL)
                        return -1;
                *addr = ih->daddr;
        } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
-               struct arphdr _arph, *ah;
-               __be32 buf, *bp;
+               const struct arphdr *ah;
+               struct arphdr _arph;
+               const __be32 *bp;
+               __be32 buf;
 
                ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
                if (ah == NULL ||
 static int get_ip_src(const struct sk_buff *skb, __be32 *addr)
 {
        if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) {
-               struct iphdr _iph, *ih;
+               const struct iphdr *ih;
+               struct iphdr _iph;
 
                ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
                if (ih == NULL)
                        return -1;
                *addr = ih->saddr;
        } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
-               struct arphdr _arph, *ah;
-               __be32 buf, *bp;
+               const struct arphdr *ah;
+               struct arphdr _arph;
+               const __be32 *bp;
+               __be32 buf;
 
                ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
                if (ah == NULL ||
                            const struct net_device *out, const void *data,
                            unsigned int datalen)
 {
-       struct ebt_among_info *info = (struct ebt_among_info *) data;
+       const struct ebt_among_info *info = data;
        const char *dmac, *smac;
        const struct ebt_mac_wormhash *wh_dst, *wh_src;
        __be32 dip = 0, sip = 0;
                           const struct ebt_entry *e, void *data,
                           unsigned int datalen)
 {
-       struct ebt_among_info *info = (struct ebt_among_info *) data;
+       const struct ebt_among_info *info = data;
        int expected_length = sizeof(struct ebt_among_info);
        const struct ebt_mac_wormhash *wh_dst, *wh_src;
        int err;
 
 static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in,
    const struct net_device *out, const void *data, unsigned int datalen)
 {
-       struct ebt_arp_info *info = (struct ebt_arp_info *)data;
-       struct arphdr _arph, *ah;
+       const struct ebt_arp_info *info = data;
+       const struct arphdr *ah;
+       struct arphdr _arph;
 
        ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
        if (ah == NULL)
                return EBT_NOMATCH;
 
        if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_GRAT)) {
-               __be32 saddr, daddr, *sap, *dap;
+               const __be32 *sap, *dap;
+               __be32 saddr, daddr;
 
                if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP))
                        return EBT_NOMATCH;
        }
 
        if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) {
-               unsigned char _mac[ETH_ALEN], *mp;
+               const unsigned char *mp;
+               unsigned char _mac[ETH_ALEN];
                uint8_t verdict, i;
 
                if (ah->ar_hln != ETH_ALEN || ah->ar_hrd != htons(ARPHRD_ETHER))
 static int ebt_arp_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_arp_info *info = (struct ebt_arp_info *)data;
+       const struct ebt_arp_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_arp_info)))
                return -EINVAL;
 
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data;
-       __be32 _sip, *siptr, _dip, *diptr;
-       struct arphdr _ah, *ap;
-       unsigned char _sha[ETH_ALEN], *shp;
+       struct ebt_arpreply_info *info = (void *)data;
+       const __be32 *siptr, *diptr;
+       __be32 _sip, _dip;
+       const struct arphdr *ap;
+       struct arphdr _ah;
+       const unsigned char *shp;
+       unsigned char _sha[ETH_ALEN];
 
        ap = skb_header_pointer(skb, 0, sizeof(_ah), &_ah);
        if (ap == NULL)
 static int ebt_target_reply_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data;
+       const struct ebt_arpreply_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_arpreply_info)))
                return -EINVAL;
 
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_nat_info *info = (struct ebt_nat_info *)data;
+       const struct ebt_nat_info *info = data;
 
        if (skb_make_writable(skb, 0))
                return NF_DROP;
 static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_nat_info *info = (struct ebt_nat_info *)data;
+       const struct ebt_nat_info *info = data;
 
        if (BASE_CHAIN && info->target == EBT_RETURN)
                return -EINVAL;
 
    const struct net_device *out, const void *data,
    unsigned int datalen)
 {
-       struct ebt_ip_info *info = (struct ebt_ip_info *)data;
-       struct iphdr _iph, *ih;
-       struct tcpudphdr _ports, *pptr;
+       const struct ebt_ip_info *info = data;
+       const struct iphdr *ih;
+       struct iphdr _iph;
+       const struct tcpudphdr *pptr;
+       struct tcpudphdr _ports;
 
        ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
        if (ih == NULL)
 static int ebt_ip_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_ip_info *info = (struct ebt_ip_info *)data;
+       const struct ebt_ip_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_ip_info)))
                return -EINVAL;
 
 static int ebt_limit_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_limit_info *info = (struct ebt_limit_info *)data;
+       struct ebt_limit_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_limit_info)))
                return -EINVAL;
 
 static int ebt_log_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_log_info *info = (struct ebt_log_info *)data;
+       struct ebt_log_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_log_info)))
                return -EINVAL;
        unsigned char ip_dst[4];
 };
 
-static void print_MAC(unsigned char *p)
+static void print_MAC(const unsigned char *p)
 {
        int i;
 
 
        if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto ==
           htons(ETH_P_IP)){
-               struct iphdr _iph, *ih;
+               const struct iphdr *ih;
+               struct iphdr _iph;
 
                ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
                if (ih == NULL) {
                    ih->protocol == IPPROTO_UDPLITE ||
                    ih->protocol == IPPROTO_SCTP ||
                    ih->protocol == IPPROTO_DCCP) {
-                       struct tcpudphdr _ports, *pptr;
+                       const struct tcpudphdr *pptr;
+                       struct tcpudphdr _ports;
 
                        pptr = skb_header_pointer(skb, ih->ihl*4,
                                                  sizeof(_ports), &_ports);
        if ((bitmask & EBT_LOG_ARP) &&
            ((eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) ||
             (eth_hdr(skb)->h_proto == htons(ETH_P_RARP)))) {
-               struct arphdr _arph, *ah;
+               const struct arphdr *ah;
+               struct arphdr _arph;
 
                ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
                if (ah == NULL) {
                if (ah->ar_hrd == htons(1) &&
                    ah->ar_hln == ETH_ALEN &&
                    ah->ar_pln == sizeof(__be32)) {
-                       struct arppayload _arpp, *ap;
+                       const struct arppayload *ap;
+                       struct arppayload _arpp;
 
                        ap = skb_header_pointer(skb, sizeof(_arph),
                                                sizeof(_arpp), &_arpp);
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_log_info *info = (struct ebt_log_info *)data;
+       const struct ebt_log_info *info = data;
        struct nf_loginfo li;
 
        li.type = NF_LOG_TYPE_LOG;
 
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data;
+       const struct ebt_mark_t_info *info = data;
        int action = info->target & -16;
 
        if (action == MARK_SET_VALUE)
 static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data;
+       const struct ebt_mark_t_info *info = data;
        int tmp;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_t_info)))
 
    const struct net_device *in, const struct net_device *out, const void *data,
    unsigned int datalen)
 {
-       struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data;
+       const struct ebt_mark_m_info *info = data;
 
        if (info->bitmask & EBT_MARK_OR)
                return !(!!(skb->mark & info->mask) ^ info->invert);
 static int ebt_mark_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data;
+       const struct ebt_mark_m_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info)))
                return -EINVAL;
 
    const void *data,
    unsigned int datalen)
 {
-       struct ebt_pkttype_info *info = (struct ebt_pkttype_info *)data;
+       const struct ebt_pkttype_info *info = data;
 
        return (skb->pkt_type != info->pkt_type) ^ info->invert;
 }
 static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_pkttype_info *info = (struct ebt_pkttype_info *)data;
+       const struct ebt_pkttype_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_pkttype_info)))
                return -EINVAL;
 
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_redirect_info *info = (struct ebt_redirect_info *)data;
+       const struct ebt_redirect_info *info = data;
 
        if (skb_make_writable(skb, 0))
                return NF_DROP;
 static int ebt_target_redirect_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_redirect_info *info = (struct ebt_redirect_info *)data;
+       const struct ebt_redirect_info *info = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_redirect_info)))
                return -EINVAL;
 
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_nat_info *info = (struct ebt_nat_info *) data;
+       const struct ebt_nat_info *info = data;
 
        if (skb_make_writable(skb, 0))
                return NF_DROP;
        memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
        if (!(info->target & NAT_ARP_BIT) &&
            eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
-               struct arphdr _ah, *ap;
+               const struct arphdr *ap;
+               struct arphdr _ah;
 
                ap = skb_header_pointer(skb, 0, sizeof(_ah), &_ah);
                if (ap == NULL)
 static int ebt_target_snat_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_nat_info *info = (struct ebt_nat_info *) data;
+       const struct ebt_nat_info *info = data;
        int tmp;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_nat_info)))
 
 #define NR16(p) (p[0] << 8 | p[1])
 #define NR32(p) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3])
 
-static int ebt_filter_config(struct ebt_stp_info *info,
-   struct stp_config_pdu *stpc)
+static int ebt_filter_config(const struct ebt_stp_info *info,
+   const struct stp_config_pdu *stpc)
 {
-       struct ebt_stp_config_info *c;
+       const struct ebt_stp_config_info *c;
        uint16_t v16;
        uint32_t v32;
        int verdict, i;
 static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in,
    const struct net_device *out, const void *data, unsigned int datalen)
 {
-       struct ebt_stp_info *info = (struct ebt_stp_info *)data;
-       struct stp_header _stph, *sp;
-       uint8_t header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00};
+       const struct ebt_stp_info *info = data;
+       const struct stp_header *sp;
+       struct stp_header _stph;
+       const uint8_t header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00};
 
        sp = skb_header_pointer(skb, 0, sizeof(_stph), &_stph);
        if (sp == NULL)
 
        if (sp->type == BPDU_TYPE_CONFIG &&
            info->bitmask & EBT_STP_CONFIG_MASK) {
-               struct stp_config_pdu _stpc, *st;
+               const struct stp_config_pdu *st;
+               struct stp_config_pdu _stpc;
 
                st = skb_header_pointer(skb, sizeof(_stph),
                                        sizeof(_stpc), &_stpc);
 static int ebt_stp_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_stp_info *info = (struct ebt_stp_info *)data;
-       int len = EBT_ALIGN(sizeof(struct ebt_stp_info));
-       uint8_t bridge_ula[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
-       uint8_t msk[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+       const struct ebt_stp_info *info = data;
+       const unsigned int len = EBT_ALIGN(sizeof(struct ebt_stp_info));
+       const uint8_t bridge_ula[6] = {0x01, 0x80, 0xc2, 0x00, 0x00, 0x00};
+       const uint8_t msk[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
        if (info->bitmask & ~EBT_STP_MASK || info->invflags & ~EBT_STP_MASK ||
            !(info->bitmask & EBT_STP_MASK))
 
    const struct net_device *in, const struct net_device *out,
    const void *data, unsigned int datalen)
 {
-       struct ebt_ulog_info *uloginfo = (struct ebt_ulog_info *)data;
+       const struct ebt_ulog_info *uloginfo = data;
 
        ebt_ulog_packet(hooknr, skb, in, out, uloginfo, NULL);
 }
 static int ebt_ulog_check(const char *tablename, unsigned int hookmask,
    const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_ulog_info *uloginfo = (struct ebt_ulog_info *)data;
+       struct ebt_ulog_info *uloginfo = data;
 
        if (datalen != EBT_ALIGN(sizeof(struct ebt_ulog_info)) ||
            uloginfo->nlgroup > 31)
 
                const struct net_device *out,
                const void *data, unsigned int datalen)
 {
-       struct ebt_vlan_info *info = (struct ebt_vlan_info *) data;
-       struct vlan_hdr _frame, *fp;
+       const struct ebt_vlan_info *info = data;
+       const struct vlan_hdr *fp;
+       struct vlan_hdr _frame;
 
        unsigned short TCI;     /* Whole TCI, given from parsed frame */
        unsigned short id;      /* VLAN ID, given from frame TCI */
               unsigned int hooknr,
               const struct ebt_entry *e, void *data, unsigned int datalen)
 {
-       struct ebt_vlan_info *info = (struct ebt_vlan_info *) data;
+       struct ebt_vlan_info *info = data;
 
        /* Parameters buffer overflow check */
        if (datalen != EBT_ALIGN(sizeof(struct ebt_vlan_info))) {
 
  */
 struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
                           struct net_device *dev, __be32 src_ip,
-                          unsigned char *dest_hw, unsigned char *src_hw,
-                          unsigned char *target_hw)
+                          const unsigned char *dest_hw,
+                          const unsigned char *src_hw,
+                          const unsigned char *target_hw)
 {
        struct sk_buff *skb;
        struct arphdr *arp;
  */
 void arp_send(int type, int ptype, __be32 dest_ip,
              struct net_device *dev, __be32 src_ip,
-             unsigned char *dest_hw, unsigned char *src_hw,
-             unsigned char *target_hw)
+             const unsigned char *dest_hw, const unsigned char *src_hw,
+             const unsigned char *target_hw)
 {
        struct sk_buff *skb;