and (try to) consistently use u_int8_t for the L3 family.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
        /* User fills in from here down. */
        nf_hookfn *hook;
        struct module *owner;
-       int pf;
-       int hooknum;
+       u_int8_t pf;
+       unsigned int hooknum;
        /* Hooks are ordered in ascending priority. */
        int priority;
 };
 {
        struct list_head list;
 
-       int pf;
+       u_int8_t pf;
 
        /* Non-inclusive ranges: use 0/0/NULL to never get called. */
        int set_optmin;
 
 extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
 
-int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
+int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
                 struct net_device *indev, struct net_device *outdev,
                 int (*okfn)(struct sk_buff *), int thresh);
 
  *     okfn must be invoked by the caller in this case.  Any other return
  *     value indicates the packet has been consumed by the hook.
  */
-static inline int nf_hook_thresh(int pf, unsigned int hook,
+static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
                                 struct sk_buff *skb,
                                 struct net_device *indev,
                                 struct net_device *outdev,
        return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
 }
 
-static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
+static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
                          struct net_device *indev, struct net_device *outdev,
                          int (*okfn)(struct sk_buff *))
 {
        NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
 
 /* Call setsockopt() */
-int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 
+int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
                  int len);
-int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
+int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
                  int *len);
 
-int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
+int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
                char __user *opt, int len);
-int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
+int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
                char __user *opt, int *len);
 
 /* Call this before modifying an existing packet: ensures it is
 extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
 
 static inline void
-nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
+nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
 {
 #ifdef CONFIG_NF_NAT_NEEDED
        void (*decodefn)(struct sk_buff *, struct flowi *);
 #else /* !CONFIG_NETFILTER */
 #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
 #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
-static inline int nf_hook_thresh(int pf, unsigned int hook,
+static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
                                 struct sk_buff *skb,
                                 struct net_device *indev,
                                 struct net_device *outdev,
 {
        return okfn(skb);
 }
-static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
+static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
                          struct net_device *indev, struct net_device *outdev,
                          int (*okfn)(struct sk_buff *))
 {
 }
 struct flowi;
 static inline void
-nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
+nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
+{
+}
 #endif /*CONFIG_NETFILTER*/
 
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
 
        /* Set this to THIS_MODULE if you are a module, otherwise NULL */
        struct module *me;
 
-       int af;         /* address/protocol family */
+       u_int8_t af;            /* address/protocol family */
 };
 
 #include <linux/netfilter_ipv4.h>
                                              struct xt_table_info *newinfo,
                                              int *error);
 
-extern struct xt_match *xt_find_match(int af, const char *name, u8 revision);
-extern struct xt_target *xt_find_target(int af, const char *name, u8 revision);
-extern struct xt_target *xt_request_find_target(int af, const char *name, 
+extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
+extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
+extern struct xt_target *xt_request_find_target(u8 af, const char *name,
                                                u8 revision);
-extern int xt_find_revision(int af, const char *name, u8 revision, int target,
-                           int *err);
+extern int xt_find_revision(u8 af, const char *name, u8 revision,
+                           int target, int *err);
 
-extern struct xt_table *xt_find_table_lock(struct net *net, int af,
+extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
                                           const char *name);
 extern void xt_table_unlock(struct xt_table *t);
 
-extern int xt_proto_init(struct net *net, int af);
-extern void xt_proto_fini(struct net *net, int af);
+extern int xt_proto_init(struct net *net, u_int8_t af);
+extern void xt_proto_fini(struct net *net, u_int8_t af);
 
 extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
 extern void xt_free_table_info(struct xt_table_info *info);
 #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \
                & ~(__alignof__(struct compat_xt_counters)-1))
 
-extern void xt_compat_lock(int af);
-extern void xt_compat_unlock(int af);
+extern void xt_compat_lock(u_int8_t af);
+extern void xt_compat_unlock(u_int8_t af);
 
-extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
-extern void xt_compat_flush_offsets(int af);
-extern short xt_compat_calc_jump(int af, unsigned int offset);
+extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
+extern void xt_compat_flush_offsets(u_int8_t af);
+extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset);
 
 extern int xt_compat_match_offset(const struct xt_match *match);
 extern int xt_compat_match_from_user(struct xt_entry_match *m,
 
 /* This header is used to share core functionality between the
    standalone connection tracking module, and the compatibility layer's use
    of connection tracking. */
-extern unsigned int nf_conntrack_in(int pf,
+extern unsigned int nf_conntrack_in(u_int8_t pf,
                                    unsigned int hooknum,
                                    struct sk_buff *skb);
 
 
 /* Allocate space for an expectation: this is mandatory before calling
    nf_ct_expect_related.  You will have to call put afterwards. */
 struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
-void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int,
+void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
                       const union nf_inet_addr *,
                       const union nf_inet_addr *,
                       u_int8_t, const __be16 *, const __be16 *);
 
                      const struct sk_buff *skb,
                      unsigned int dataoff,
                      enum ip_conntrack_info ctinfo,
-                     int pf,
+                     u_int8_t pf,
                      unsigned int hooknum);
 
        /* Called when a new connection for this protocol found;
 
        int (*error)(struct sk_buff *skb, unsigned int dataoff,
                     enum ip_conntrack_info *ctinfo,
-                    int pf, unsigned int hooknum);
+                    u_int8_t pf, unsigned int hooknum);
 
        /* Print out the per-protocol part of the tuple. Return like seq_* */
        int (*print_tuple)(struct seq_file *s,
 
        } u;
 };
 
-typedef void nf_logfn(unsigned int pf,
+typedef void nf_logfn(u_int8_t pf,
                      unsigned int hooknum,
                      const struct sk_buff *skb,
                      const struct net_device *in,
 };
 
 /* Function to register/unregister log function. */
-int nf_log_register(int pf, const struct nf_logger *logger);
+int nf_log_register(u_int8_t pf, const struct nf_logger *logger);
 void nf_log_unregister(const struct nf_logger *logger);
-void nf_log_unregister_pf(int pf);
+void nf_log_unregister_pf(u_int8_t pf);
 
 /* Calls the registered backend logging function */
-void nf_log_packet(int pf,
+void nf_log_packet(u_int8_t pf,
                   unsigned int hooknum,
                   const struct sk_buff *skb,
                   const struct net_device *in,
 
        unsigned int            id;
 
        struct nf_hook_ops      *elem;
-       int                     pf;
+       u_int8_t                pf;
        unsigned int            hook;
        struct net_device       *indev;
        struct net_device       *outdev;
        char                    *name;
 };
 
-extern int nf_register_queue_handler(int pf,
+extern int nf_register_queue_handler(u_int8_t pf,
                                     const struct nf_queue_handler *qh);
-extern int nf_unregister_queue_handler(int pf,
+extern int nf_unregister_queue_handler(u_int8_t pf,
                                       const struct nf_queue_handler *qh);
 extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
 extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
 
 {
        struct nf_bridge_info *nf_bridge;
        struct net_device *parent;
-       int pf;
+       u_int8_t pf;
 
        if (!skb->nf_bridge)
                return NF_ACCEPT;
 {
        struct nf_bridge_info *nf_bridge = skb->nf_bridge;
        struct net_device *realoutdev = bridge_parent(skb->dev);
-       int pf;
+       u_int8_t pf;
 
 #ifdef CONFIG_NETFILTER_DEBUG
        /* Be very paranoid. This probably won't happen anymore, but let's
 
 
 #define myNIPQUAD(a) a[0], a[1], a[2], a[3]
 static void
-ebt_log_packet(unsigned int pf, unsigned int hooknum,
+ebt_log_packet(u_int8_t pf, unsigned int hooknum,
    const struct sk_buff *skb, const struct net_device *in,
    const struct net_device *out, const struct nf_loginfo *loginfo,
    const char *prefix)
 
 }
 
 /* this function is registered with the netfilter core */
-static void ebt_log_packet(unsigned int pf, unsigned int hooknum,
+static void ebt_log_packet(u_int8_t pf, unsigned int hooknum,
    const struct sk_buff *skb, const struct net_device *in,
    const struct net_device *out, const struct nf_loginfo *li,
    const char *prefix)
 
 };
 
 static void
-ipt_log_packet(unsigned int pf,
+ipt_log_packet(u_int8_t pf,
               unsigned int hooknum,
               const struct sk_buff *skb,
               const struct net_device *in,
 
        return XT_CONTINUE;
 }
 
-static void ipt_logfn(unsigned int pf,
+static void ipt_logfn(u_int8_t pf,
                      unsigned int hooknum,
                      const struct sk_buff *skb,
                      const struct net_device *in,
 
                       const struct sk_buff *skb,
                       unsigned int dataoff,
                       enum ip_conntrack_info ctinfo,
-                      int pf,
+                      u_int8_t pf,
                       unsigned int hooknum)
 {
        /* Try to delete connection immediately after all replies:
 /* Small and modified version of icmp_rcv */
 static int
 icmp_error(struct sk_buff *skb, unsigned int dataoff,
-          enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum)
+          enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum)
 {
        const struct icmphdr *icmph;
        struct icmphdr _ih;
 
 };
 
 static void
-ip6t_log_packet(unsigned int pf,
+ip6t_log_packet(u_int8_t pf,
                unsigned int hooknum,
                const struct sk_buff *skb,
                const struct net_device *in,
 
                       const struct sk_buff *skb,
                       unsigned int dataoff,
                       enum ip_conntrack_info ctinfo,
-                      int pf,
+                      u_int8_t pf,
                       unsigned int hooknum)
 {
        /* Try to delete connection immediately after all replies:
 
 static int
 icmpv6_error(struct sk_buff *skb, unsigned int dataoff,
-            enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum)
+            enum ip_conntrack_info *ctinfo, u_int8_t pf, unsigned int hooknum)
 {
        const struct icmp6hdr *icmp6h;
        struct icmp6hdr _ih;
 
 
 unsigned int nf_iterate(struct list_head *head,
                        struct sk_buff *skb,
-                       int hook,
+                       unsigned int hook,
                        const struct net_device *indev,
                        const struct net_device *outdev,
                        struct list_head **i,
 
 /* Returns 1 if okfn() needs to be executed by the caller,
  * -EPERM for NF_DROP, 0 otherwise. */
-int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
+int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
                 struct net_device *indev,
                 struct net_device *outdev,
                 int (*okfn)(struct sk_buff *),
 
 }
 
 unsigned int
-nf_conntrack_in(int pf, unsigned int hooknum, struct sk_buff *skb)
+nf_conntrack_in(u_int8_t pf, unsigned int hooknum, struct sk_buff *skb)
 {
        struct nf_conn *ct;
        enum ip_conntrack_info ctinfo;
        }
 
        /* rcu_read_lock()ed by nf_hook_slow */
-       l3proto = __nf_ct_l3proto_find((u_int16_t)pf);
+       l3proto = __nf_ct_l3proto_find(pf);
        ret = l3proto->get_l4proto(skb, skb_network_offset(skb),
                                   &dataoff, &protonum);
        if (ret <= 0) {
                return -ret;
        }
 
-       l4proto = __nf_ct_l4proto_find((u_int16_t)pf, protonum);
+       l4proto = __nf_ct_l4proto_find(pf, protonum);
 
        /* It may be an special packet, error, unclean...
         * inverse of the return code tells to the netfilter
 
 EXPORT_SYMBOL_GPL(nf_ct_expect_alloc);
 
 void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,
-                      int family,
+                      u_int8_t family,
                       const union nf_inet_addr *saddr,
                       const union nf_inet_addr *daddr,
                       u_int8_t proto, const __be16 *src, const __be16 *dst)
 
 /* If the calling party is on the same side of the forward-to party,
  * we don't need to track the second call */
 static int callforward_do_filter(const union nf_inet_addr *src,
-                                 const union nf_inet_addr *dst, int family)
+                                const union nf_inet_addr *dst,
+                                u_int8_t family)
 {
        const struct nf_afinfo *afinfo;
        struct flowi fl1, fl2;
 
 
 static int dccp_packet(struct nf_conn *ct, const struct sk_buff *skb,
                       unsigned int dataoff, enum ip_conntrack_info ctinfo,
-                      int pf, unsigned int hooknum)
+                      u_int8_t pf, unsigned int hooknum)
 {
        enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
        struct dccp_hdr _dh, *dh;
 }
 
 static int dccp_error(struct sk_buff *skb, unsigned int dataoff,
-                     enum ip_conntrack_info *ctinfo, int pf,
+                     enum ip_conntrack_info *ctinfo, u_int8_t pf,
                      unsigned int hooknum)
 {
        struct dccp_hdr _dh, *dh;
 
                  const struct sk_buff *skb,
                  unsigned int dataoff,
                  enum ip_conntrack_info ctinfo,
-                 int pf,
+                 u_int8_t pf,
                  unsigned int hooknum)
 {
        nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_generic_timeout);
 
                      const struct sk_buff *skb,
                      unsigned int dataoff,
                      enum ip_conntrack_info ctinfo,
-                     int pf,
+                     u_int8_t pf,
                      unsigned int hooknum)
 {
        /* If we've seen traffic both ways, this is a GRE connection.
 
                       const struct sk_buff *skb,
                       unsigned int dataoff,
                       enum ip_conntrack_info ctinfo,
-                      int pf,
+                      u_int8_t pf,
                       unsigned int hooknum)
 {
        enum sctp_conntrack new_state, old_state;
 
                          const struct sk_buff *skb,
                          unsigned int dataoff,
                          const struct tcphdr *tcph,
-                         int pf)
+                         u_int8_t pf)
 {
        struct ip_ct_tcp_state *sender = &state->seen[dir];
        struct ip_ct_tcp_state *receiver = &state->seen[!dir];
 static int tcp_error(struct sk_buff *skb,
                     unsigned int dataoff,
                     enum ip_conntrack_info *ctinfo,
-                    int pf,
+                    u_int8_t pf,
                     unsigned int hooknum)
 {
        const struct tcphdr *th;
                      const struct sk_buff *skb,
                      unsigned int dataoff,
                      enum ip_conntrack_info ctinfo,
-                     int pf,
+                     u_int8_t pf,
                      unsigned int hooknum)
 {
        struct nf_conntrack_tuple *tuple;
 
                      const struct sk_buff *skb,
                      unsigned int dataoff,
                      enum ip_conntrack_info ctinfo,
-                     int pf,
+                     u_int8_t pf,
                      unsigned int hooknum)
 {
        /* If we've seen traffic both ways, this is some kind of UDP
 
 static int udp_error(struct sk_buff *skb, unsigned int dataoff,
                     enum ip_conntrack_info *ctinfo,
-                    int pf,
+                    u_int8_t pf,
                     unsigned int hooknum)
 {
        unsigned int udplen = skb->len - dataoff;
 
                          const struct sk_buff *skb,
                          unsigned int dataoff,
                          enum ip_conntrack_info ctinfo,
-                         int pf,
+                         u_int8_t pf,
                          unsigned int hooknum)
 {
        /* If we've seen traffic both ways, this is some kind of UDP
 
 static int udplite_error(struct sk_buff *skb, unsigned int dataoff,
                         enum ip_conntrack_info *ctinfo,
-                        int pf,
+                        u_int8_t pf,
                         unsigned int hooknum)
 {
        unsigned int udplen = skb->len - dataoff;
 
 /* core.c */
 extern unsigned int nf_iterate(struct list_head *head,
                                struct sk_buff *skb,
-                               int hook,
+                               unsigned int hook,
                                const struct net_device *indev,
                                const struct net_device *outdev,
                                struct list_head **i,
 /* nf_queue.c */
 extern int nf_queue(struct sk_buff *skb,
                    struct list_head *elem,
-                   int pf, unsigned int hook,
+                   u_int8_t pf, unsigned int hook,
                    struct net_device *indev,
                    struct net_device *outdev,
                    int (*okfn)(struct sk_buff *),
 
 
 /* return EBUSY if somebody else is registered, EEXIST if the same logger
  * is registred, 0 on success. */
-int nf_log_register(int pf, const struct nf_logger *logger)
+int nf_log_register(u_int8_t pf, const struct nf_logger *logger)
 {
        int ret;
 
 }
 EXPORT_SYMBOL(nf_log_register);
 
-void nf_log_unregister_pf(int pf)
+void nf_log_unregister_pf(u_int8_t pf)
 {
        if (pf >= NPROTO)
                return;
 }
 EXPORT_SYMBOL(nf_log_unregister);
 
-void nf_log_packet(int pf,
+void nf_log_packet(u_int8_t pf,
                   unsigned int hooknum,
                   const struct sk_buff *skb,
                   const struct net_device *in,
 
 
 /* return EBUSY when somebody else is registered, return EEXIST if the
  * same handler is registered, return 0 in case of success. */
-int nf_register_queue_handler(int pf, const struct nf_queue_handler *qh)
+int nf_register_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
 {
        int ret;
 
 EXPORT_SYMBOL(nf_register_queue_handler);
 
 /* The caller must flush their queue before this */
-int nf_unregister_queue_handler(int pf, const struct nf_queue_handler *qh)
+int nf_unregister_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
 {
        if (pf >= NPROTO)
                return -EINVAL;
 
 void nf_unregister_queue_handlers(const struct nf_queue_handler *qh)
 {
-       int pf;
+       u_int8_t pf;
 
        mutex_lock(&queue_handler_mutex);
        for (pf = 0; pf < NPROTO; pf++)  {
  */
 static int __nf_queue(struct sk_buff *skb,
                      struct list_head *elem,
-                     int pf, unsigned int hook,
+                     u_int8_t pf, unsigned int hook,
                      struct net_device *indev,
                      struct net_device *outdev,
                      int (*okfn)(struct sk_buff *),
 
 int nf_queue(struct sk_buff *skb,
             struct list_head *elem,
-            int pf, unsigned int hook,
+            u_int8_t pf, unsigned int hook,
             struct net_device *indev,
             struct net_device *outdev,
             int (*okfn)(struct sk_buff *),
 
 }
 EXPORT_SYMBOL(nf_unregister_sockopt);
 
-static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, int pf,
+static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, u_int8_t pf,
                int val, int get)
 {
        struct nf_sockopt_ops *ops;
 }
 
 /* Call get/setsockopt() */
-static int nf_sockopt(struct sock *sk, int pf, int val,
+static int nf_sockopt(struct sock *sk, u_int8_t pf, int val,
                      char __user *opt, int *len, int get)
 {
        struct nf_sockopt_ops *ops;
        return ret;
 }
 
-int nf_setsockopt(struct sock *sk, int pf, int val, char __user *opt,
+int nf_setsockopt(struct sock *sk, u_int8_t pf, int val, char __user *opt,
                  int len)
 {
        return nf_sockopt(sk, pf, val, opt, &len, 0);
 }
 EXPORT_SYMBOL(nf_setsockopt);
 
-int nf_getsockopt(struct sock *sk, int pf, int val, char __user *opt, int *len)
+int nf_getsockopt(struct sock *sk, u_int8_t pf, int val, char __user *opt,
+                 int *len)
 {
        return nf_sockopt(sk, pf, val, opt, len, 1);
 }
 EXPORT_SYMBOL(nf_getsockopt);
 
 #ifdef CONFIG_COMPAT
-static int compat_nf_sockopt(struct sock *sk, int pf, int val,
+static int compat_nf_sockopt(struct sock *sk, u_int8_t pf, int val,
                             char __user *opt, int *len, int get)
 {
        struct nf_sockopt_ops *ops;
        return ret;
 }
 
-int compat_nf_setsockopt(struct sock *sk, int pf,
+int compat_nf_setsockopt(struct sock *sk, u_int8_t pf,
                int val, char __user *opt, int len)
 {
        return compat_nf_sockopt(sk, pf, val, opt, &len, 0);
 }
 EXPORT_SYMBOL(compat_nf_setsockopt);
 
-int compat_nf_getsockopt(struct sock *sk, int pf,
+int compat_nf_getsockopt(struct sock *sk, u_int8_t pf,
                int val, char __user *opt, int *len)
 {
        return compat_nf_sockopt(sk, pf, val, opt, len, 1);
 
 __build_packet_message(struct nfulnl_instance *inst,
                        const struct sk_buff *skb,
                        unsigned int data_len,
-                       unsigned int pf,
+                       u_int8_t pf,
                        unsigned int hooknum,
                        const struct net_device *indev,
                        const struct net_device *outdev,
 
 /* log handler for internal netfilter logging api */
 static void
-nfulnl_log_packet(unsigned int pf,
+nfulnl_log_packet(u_int8_t pf,
                  unsigned int hooknum,
                  const struct sk_buff *skb,
                  const struct net_device *in,
 
 int
 xt_register_target(struct xt_target *target)
 {
-       int ret, af = target->family;
+       u_int8_t af = target->family;
+       int ret;
 
        ret = mutex_lock_interruptible(&xt[af].mutex);
        if (ret != 0)
 void
 xt_unregister_target(struct xt_target *target)
 {
-       int af = target->family;
+       u_int8_t af = target->family;
 
        mutex_lock(&xt[af].mutex);
        list_del(&target->list);
 int
 xt_register_match(struct xt_match *match)
 {
-       int ret, af = match->family;
+       u_int8_t af = match->family;
+       int ret;
 
        ret = mutex_lock_interruptible(&xt[af].mutex);
        if (ret != 0)
 void
 xt_unregister_match(struct xt_match *match)
 {
-       int af =  match->family;
+       u_int8_t af = match->family;
 
        mutex_lock(&xt[af].mutex);
        list_del(&match->list);
  */
 
 /* Find match, grabs ref.  Returns ERR_PTR() on error. */
-struct xt_match *xt_find_match(int af, const char *name, u8 revision)
+struct xt_match *xt_find_match(u8 af, const char *name, u8 revision)
 {
        struct xt_match *m;
        int err = 0;
 EXPORT_SYMBOL(xt_find_match);
 
 /* Find target, grabs ref.  Returns ERR_PTR() on error. */
-struct xt_target *xt_find_target(int af, const char *name, u8 revision)
+struct xt_target *xt_find_target(u8 af, const char *name, u8 revision)
 {
        struct xt_target *t;
        int err = 0;
 }
 EXPORT_SYMBOL(xt_find_target);
 
-struct xt_target *xt_request_find_target(int af, const char *name, u8 revision)
+struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision)
 {
        struct xt_target *target;
 
 }
 EXPORT_SYMBOL_GPL(xt_request_find_target);
 
-static int match_revfn(int af, const char *name, u8 revision, int *bestp)
+static int match_revfn(u8 af, const char *name, u8 revision, int *bestp)
 {
        const struct xt_match *m;
        int have_rev = 0;
        return have_rev;
 }
 
-static int target_revfn(int af, const char *name, u8 revision, int *bestp)
+static int target_revfn(u8 af, const char *name, u8 revision, int *bestp)
 {
        const struct xt_target *t;
        int have_rev = 0;
 }
 
 /* Returns true or false (if no such extension at all) */
-int xt_find_revision(int af, const char *name, u8 revision, int target,
+int xt_find_revision(u8 af, const char *name, u8 revision, int target,
                     int *err)
 {
        int have_rev, best = -1;
 EXPORT_SYMBOL_GPL(xt_check_match);
 
 #ifdef CONFIG_COMPAT
-int xt_compat_add_offset(int af, unsigned int offset, short delta)
+int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta)
 {
        struct compat_delta *tmp;
 
 }
 EXPORT_SYMBOL_GPL(xt_compat_add_offset);
 
-void xt_compat_flush_offsets(int af)
+void xt_compat_flush_offsets(u_int8_t af)
 {
        struct compat_delta *tmp, *next;
 
 }
 EXPORT_SYMBOL_GPL(xt_compat_flush_offsets);
 
-short xt_compat_calc_jump(int af, unsigned int offset)
+short xt_compat_calc_jump(u_int8_t af, unsigned int offset)
 {
        struct compat_delta *tmp;
        short delta;
 EXPORT_SYMBOL(xt_free_table_info);
 
 /* Find table by name, grabs mutex & ref.  Returns ERR_PTR() on error. */
-struct xt_table *xt_find_table_lock(struct net *net, int af, const char *name)
+struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
+                                   const char *name)
 {
        struct xt_table *t;
 
 EXPORT_SYMBOL_GPL(xt_table_unlock);
 
 #ifdef CONFIG_COMPAT
-void xt_compat_lock(int af)
+void xt_compat_lock(u_int8_t af)
 {
        mutex_lock(&xt[af].compat_mutex);
 }
 EXPORT_SYMBOL_GPL(xt_compat_lock);
 
-void xt_compat_unlock(int af)
+void xt_compat_unlock(u_int8_t af)
 {
        mutex_unlock(&xt[af].compat_mutex);
 }
 #ifdef CONFIG_PROC_FS
 struct xt_names_priv {
        struct seq_net_private p;
-       int af;
+       u_int8_t af;
 };
 static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos)
 {
        struct xt_names_priv *priv = seq->private;
        struct net *net = seq_file_net(seq);
-       int af = priv->af;
+       u_int8_t af = priv->af;
 
        mutex_lock(&xt[af].mutex);
        return seq_list_start(&net->xt.tables[af], *pos);
 {
        struct xt_names_priv *priv = seq->private;
        struct net *net = seq_file_net(seq);
-       int af = priv->af;
+       u_int8_t af = priv->af;
 
        return seq_list_next(v, &net->xt.tables[af], pos);
 }
 static void xt_table_seq_stop(struct seq_file *seq, void *v)
 {
        struct xt_names_priv *priv = seq->private;
-       int af = priv->af;
+       u_int8_t af = priv->af;
 
        mutex_unlock(&xt[af].mutex);
 }
 
 #endif /* CONFIG_PROC_FS */
 
-int xt_proto_init(struct net *net, int af)
+int xt_proto_init(struct net *net, u_int8_t af)
 {
 #ifdef CONFIG_PROC_FS
        char buf[XT_FUNCTION_MAXNAMELEN];
 }
 EXPORT_SYMBOL_GPL(xt_proto_init);
 
-void xt_proto_fini(struct net *net, int af)
+void xt_proto_fini(struct net *net, u_int8_t af)
 {
 #ifdef CONFIG_PROC_FS
        char buf[XT_FUNCTION_MAXNAMELEN];
 
 static inline unsigned int
 same_source_net(const union nf_inet_addr *addr,
                const union nf_inet_addr *mask,
-               const union nf_inet_addr *u3, unsigned int family)
+               const union nf_inet_addr *u3, u_int8_t family)
 {
        if (family == AF_INET) {
                return (addr->ip & mask->ip) == (u3->ip & mask->ip);
 
 static inline bool
 conntrack_mt_origsrc(const struct nf_conn *ct,
                      const struct xt_conntrack_mtinfo1 *info,
-                     unsigned int family)
+                    u_int8_t family)
 {
        return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3,
               &info->origsrc_addr, &info->origsrc_mask, family);
 static inline bool
 conntrack_mt_origdst(const struct nf_conn *ct,
                      const struct xt_conntrack_mtinfo1 *info,
-                     unsigned int family)
+                    u_int8_t family)
 {
        return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3,
               &info->origdst_addr, &info->origdst_mask, family);
 static inline bool
 conntrack_mt_replsrc(const struct nf_conn *ct,
                      const struct xt_conntrack_mtinfo1 *info,
-                     unsigned int family)
+                    u_int8_t family)
 {
        return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3,
               &info->replsrc_addr, &info->replsrc_mask, family);
 static inline bool
 conntrack_mt_repldst(const struct nf_conn *ct,
                      const struct xt_conntrack_mtinfo1 *info,
-                     unsigned int family)
+                    u_int8_t family)
 {
        return conntrack_addrcmp(&ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3,
               &info->repldst_addr, &info->repldst_mask, family);
 
 struct xt_hashlimit_htable {
        struct hlist_node node;         /* global list of all htables */
        atomic_t use;
-       int family;
+       u_int8_t family;
 
        struct hashlimit_cfg1 cfg;      /* config */
 
 }
 static void htable_gc(unsigned long htlong);
 
-static int htable_create_v0(struct xt_hashlimit_info *minfo, int family)
+static int htable_create_v0(struct xt_hashlimit_info *minfo, u_int8_t family)
 {
        struct xt_hashlimit_htable *hinfo;
        unsigned int size;
        return 0;
 }
 
-static int htable_create(struct xt_hashlimit_mtinfo1 *minfo,
-                         unsigned int family)
+static int htable_create(struct xt_hashlimit_mtinfo1 *minfo, u_int8_t family)
 {
        struct xt_hashlimit_htable *hinfo;
        unsigned int size;
 }
 
 static struct xt_hashlimit_htable *htable_find_get(const char *name,
-                                                  int family)
+                                                  u_int8_t family)
 {
        struct xt_hashlimit_htable *hinfo;
        struct hlist_node *pos;
        spin_unlock_bh(&htable->lock);
 }
 
-static int dl_seq_real_show(struct dsthash_ent *ent, int family,
+static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family,
                                   struct seq_file *s)
 {
        /* recalculate to show accurate numbers */