Commit d1ed6a3e authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [NETLABEL]: Fix build failure.
  [IPV6]: Give sit driver an appropriate module alias.
  [IPV6]: Add ndisc_netdev_notifier unregister.
  [NET]: __alloc_pages() failures reported due to fragmentation
  [PKTGEN]: TCI endianness fixes
  [TG3]: Fix 2nd ifup failure on 5752M.
  [NETFILTER] bug: skb->protocol is already net-endian
  [NETFILTER] bug: nfulnl_msg_config_mode ->copy_range is 32bit
  [NETFILTER] bug: NFULA_CFG_QTHRESH uses 32bit
  [IPV6]: Fix ECN bug on big-endian
  [IPX]: Annotate and fix IPX checksum
  [IPX]: Trivial parts of endianness annotations
parents 59359ff8 38c94377
...@@ -68,8 +68,8 @@ ...@@ -68,8 +68,8 @@
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.67" #define DRV_MODULE_VERSION "3.68"
#define DRV_MODULE_RELDATE "October 18, 2006" #define DRV_MODULE_RELDATE "November 02, 2006"
#define TG3_DEF_MAC_MODE 0 #define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0 #define TG3_DEF_RX_MODE 0
...@@ -6014,7 +6014,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) ...@@ -6014,7 +6014,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
tg3_abort_hw(tp, 1); tg3_abort_hw(tp, 1);
} }
if ((tp->tg3_flags2 & TG3_FLG2_MII_SERDES) && reset_phy) if (reset_phy)
tg3_phy_reset(tp); tg3_phy_reset(tp);
err = tg3_chip_reset(tp); err = tg3_chip_reset(tp);
...@@ -6574,7 +6574,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) ...@@ -6574,7 +6574,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl); tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
} }
err = tg3_setup_phy(tp, reset_phy); err = tg3_setup_phy(tp, 0);
if (err) if (err)
return err; return err;
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
struct sockaddr_ipx { struct sockaddr_ipx {
sa_family_t sipx_family; sa_family_t sipx_family;
__u16 sipx_port; __be16 sipx_port;
__u32 sipx_network; __be32 sipx_network;
unsigned char sipx_node[IPX_NODE_LEN]; unsigned char sipx_node[IPX_NODE_LEN];
__u8 sipx_type; __u8 sipx_type;
unsigned char sipx_zero; /* 16 byte fill */ unsigned char sipx_zero; /* 16 byte fill */
...@@ -23,13 +23,13 @@ struct sockaddr_ipx { ...@@ -23,13 +23,13 @@ struct sockaddr_ipx {
#define IPX_CRTITF 1 #define IPX_CRTITF 1
struct ipx_route_definition { struct ipx_route_definition {
__u32 ipx_network; __be32 ipx_network;
__u32 ipx_router_network; __be32 ipx_router_network;
unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_router_node[IPX_NODE_LEN];
}; };
struct ipx_interface_definition { struct ipx_interface_definition {
__u32 ipx_network; __be32 ipx_network;
unsigned char ipx_device[16]; unsigned char ipx_device[16];
unsigned char ipx_dlink_type; unsigned char ipx_dlink_type;
#define IPX_FRAME_NONE 0 #define IPX_FRAME_NONE 0
...@@ -55,8 +55,8 @@ struct ipx_config_data { ...@@ -55,8 +55,8 @@ struct ipx_config_data {
*/ */
struct ipx_route_def { struct ipx_route_def {
__u32 ipx_network; __be32 ipx_network;
__u32 ipx_router_network; __be32 ipx_router_network;
#define IPX_ROUTE_NO_ROUTER 0 #define IPX_ROUTE_NO_ROUTER 0
unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_router_node[IPX_NODE_LEN];
unsigned char ipx_device[16]; unsigned char ipx_device[16];
......
...@@ -48,7 +48,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner) ...@@ -48,7 +48,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
#define IP6_ECN_flow_xmit(sk, label) do { \ #define IP6_ECN_flow_xmit(sk, label) do { \
if (INET_ECN_is_capable(inet_sk(sk)->tos)) \ if (INET_ECN_is_capable(inet_sk(sk)->tos)) \
(label) |= __constant_htons(INET_ECN_ECT_0 << 4); \ (label) |= htonl(INET_ECN_ECT_0 << 20); \
} while (0) } while (0)
static inline int IP_ECN_set_ce(struct iphdr *iph) static inline int IP_ECN_set_ce(struct iphdr *iph)
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#include <linux/list.h> #include <linux/list.h>
struct ipx_address { struct ipx_address {
__u32 net; __be32 net;
__u8 node[IPX_NODE_LEN]; __u8 node[IPX_NODE_LEN];
__u16 sock; __be16 sock;
}; };
#define ipx_broadcast_node "\377\377\377\377\377\377" #define ipx_broadcast_node "\377\377\377\377\377\377"
...@@ -26,9 +26,9 @@ struct ipx_address { ...@@ -26,9 +26,9 @@ struct ipx_address {
#define IPX_MAX_PPROP_HOPS 8 #define IPX_MAX_PPROP_HOPS 8
struct ipxhdr { struct ipxhdr {
__u16 ipx_checksum __attribute__ ((packed)); __be16 ipx_checksum __attribute__ ((packed));
#define IPX_NO_CHECKSUM 0xFFFF #define IPX_NO_CHECKSUM __constant_htons(0xFFFF)
__u16 ipx_pktsize __attribute__ ((packed)); __be16 ipx_pktsize __attribute__ ((packed));
__u8 ipx_tctrl; __u8 ipx_tctrl;
__u8 ipx_type; __u8 ipx_type;
#define IPX_TYPE_UNKNOWN 0x00 #define IPX_TYPE_UNKNOWN 0x00
...@@ -48,14 +48,14 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) ...@@ -48,14 +48,14 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
struct ipx_interface { struct ipx_interface {
/* IPX address */ /* IPX address */
__u32 if_netnum; __be32 if_netnum;
unsigned char if_node[IPX_NODE_LEN]; unsigned char if_node[IPX_NODE_LEN];
atomic_t refcnt; atomic_t refcnt;
/* physical device info */ /* physical device info */
struct net_device *if_dev; struct net_device *if_dev;
struct datalink_proto *if_dlink; struct datalink_proto *if_dlink;
unsigned short if_dlink_type; __be16 if_dlink_type;
/* socket support */ /* socket support */
unsigned short if_sknum; unsigned short if_sknum;
...@@ -71,7 +71,7 @@ struct ipx_interface { ...@@ -71,7 +71,7 @@ struct ipx_interface {
}; };
struct ipx_route { struct ipx_route {
__u32 ir_net; __be32 ir_net;
struct ipx_interface *ir_intrfc; struct ipx_interface *ir_intrfc;
unsigned char ir_routed; unsigned char ir_routed;
unsigned char ir_router_node[IPX_NODE_LEN]; unsigned char ir_router_node[IPX_NODE_LEN];
...@@ -82,10 +82,10 @@ struct ipx_route { ...@@ -82,10 +82,10 @@ struct ipx_route {
#ifdef __KERNEL__ #ifdef __KERNEL__
struct ipx_cb { struct ipx_cb {
u8 ipx_tctrl; u8 ipx_tctrl;
u32 ipx_dest_net; __be32 ipx_dest_net;
u32 ipx_source_net; __be32 ipx_source_net;
struct { struct {
u32 netnum; __be32 netnum;
int index; int index;
} last_hop; } last_hop;
}; };
...@@ -97,7 +97,7 @@ struct ipx_sock { ...@@ -97,7 +97,7 @@ struct ipx_sock {
struct sock sk; struct sock sk;
struct ipx_address dest_addr; struct ipx_address dest_addr;
struct ipx_interface *intrfc; struct ipx_interface *intrfc;
unsigned short port; __be16 port;
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
unsigned char node[IPX_NODE_LEN]; unsigned char node[IPX_NODE_LEN];
#endif #endif
...@@ -132,7 +132,7 @@ extern struct ipx_interface *ipx_primary_net; ...@@ -132,7 +132,7 @@ extern struct ipx_interface *ipx_primary_net;
extern int ipx_proc_init(void); extern int ipx_proc_init(void);
extern void ipx_proc_exit(void); extern void ipx_proc_exit(void);
extern const char *ipx_frame_name(unsigned short); extern const char *ipx_frame_name(__be16);
extern const char *ipx_device_name(struct ipx_interface *intrfc); extern const char *ipx_device_name(struct ipx_interface *intrfc);
static __inline__ void ipxitf_hold(struct ipx_interface *intrfc) static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
......
...@@ -63,6 +63,7 @@ config INET ...@@ -63,6 +63,7 @@ config INET
if INET if INET
source "net/ipv4/Kconfig" source "net/ipv4/Kconfig"
source "net/ipv6/Kconfig" source "net/ipv6/Kconfig"
source "net/netlabel/Kconfig"
endif # if INET endif # if INET
...@@ -249,8 +250,6 @@ source "net/ieee80211/Kconfig" ...@@ -249,8 +250,6 @@ source "net/ieee80211/Kconfig"
config WIRELESS_EXT config WIRELESS_EXT
bool bool
source "net/netlabel/Kconfig"
config FIB_RULES config FIB_RULES
bool bool
......
...@@ -2304,6 +2304,12 @@ static void mpls_push(__be32 *mpls, struct pktgen_dev *pkt_dev) ...@@ -2304,6 +2304,12 @@ static void mpls_push(__be32 *mpls, struct pktgen_dev *pkt_dev)
*mpls |= MPLS_STACK_BOTTOM; *mpls |= MPLS_STACK_BOTTOM;
} }
static inline __be16 build_tci(unsigned int id, unsigned int cfi,
unsigned int prio)
{
return htons(id | (cfi << 12) | (prio << 13));
}
static struct sk_buff *fill_packet_ipv4(struct net_device *odev, static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
struct pktgen_dev *pkt_dev) struct pktgen_dev *pkt_dev)
{ {
...@@ -2353,16 +2359,16 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, ...@@ -2353,16 +2359,16 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
if (pkt_dev->vlan_id != 0xffff) { if (pkt_dev->vlan_id != 0xffff) {
if(pkt_dev->svlan_id != 0xffff) { if(pkt_dev->svlan_id != 0xffff) {
svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
*svlan_tci = htons(pkt_dev->svlan_id); *svlan_tci = build_tci(pkt_dev->svlan_id,
*svlan_tci |= pkt_dev->svlan_p << 5; pkt_dev->svlan_cfi,
*svlan_tci |= pkt_dev->svlan_cfi << 4; pkt_dev->svlan_p);
svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
*svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q); *svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q);
} }
vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
*vlan_tci = htons(pkt_dev->vlan_id); *vlan_tci = build_tci(pkt_dev->vlan_id,
*vlan_tci |= pkt_dev->vlan_p << 5; pkt_dev->vlan_cfi,
*vlan_tci |= pkt_dev->vlan_cfi << 4; pkt_dev->vlan_p);
vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
*vlan_encapsulated_proto = __constant_htons(ETH_P_IP); *vlan_encapsulated_proto = __constant_htons(ETH_P_IP);
} }
...@@ -2689,16 +2695,16 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, ...@@ -2689,16 +2695,16 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
if (pkt_dev->vlan_id != 0xffff) { if (pkt_dev->vlan_id != 0xffff) {
if(pkt_dev->svlan_id != 0xffff) { if(pkt_dev->svlan_id != 0xffff) {
svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
*svlan_tci = htons(pkt_dev->svlan_id); *svlan_tci = build_tci(pkt_dev->svlan_id,
*svlan_tci |= pkt_dev->svlan_p << 5; pkt_dev->svlan_cfi,
*svlan_tci |= pkt_dev->svlan_cfi << 4; pkt_dev->svlan_p);
svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
*svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q); *svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q);
} }
vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
*vlan_tci = htons(pkt_dev->vlan_id); *vlan_tci = build_tci(pkt_dev->vlan_id,
*vlan_tci |= pkt_dev->vlan_p << 5; pkt_dev->vlan_cfi,
*vlan_tci |= pkt_dev->vlan_cfi << 4; pkt_dev->vlan_p);
vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
*vlan_encapsulated_proto = __constant_htons(ETH_P_IPV6); *vlan_encapsulated_proto = __constant_htons(ETH_P_IPV6);
} }
......
...@@ -1160,7 +1160,7 @@ static struct sk_buff *sock_alloc_send_pskb(struct sock *sk, ...@@ -1160,7 +1160,7 @@ static struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
goto failure; goto failure;
if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
skb = alloc_skb(header_len, sk->sk_allocation); skb = alloc_skb(header_len, gfp_mask);
if (skb) { if (skb) {
int npages; int npages;
int i; int i;
......
...@@ -1742,6 +1742,7 @@ int __init ndisc_init(struct net_proto_family *ops) ...@@ -1742,6 +1742,7 @@ int __init ndisc_init(struct net_proto_family *ops)
void ndisc_cleanup(void) void ndisc_cleanup(void)
{ {
unregister_netdevice_notifier(&ndisc_netdev_notifier);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
neigh_sysctl_unregister(&nd_tbl.parms); neigh_sysctl_unregister(&nd_tbl.parms);
#endif #endif
......
...@@ -854,3 +854,4 @@ int __init sit_init(void) ...@@ -854,3 +854,4 @@ int __init sit_init(void)
module_init(sit_init); module_init(sit_init);
module_exit(sit_cleanup); module_exit(sit_cleanup);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("sit0");
...@@ -83,13 +83,13 @@ DEFINE_SPINLOCK(ipx_interfaces_lock); ...@@ -83,13 +83,13 @@ DEFINE_SPINLOCK(ipx_interfaces_lock);
struct ipx_interface *ipx_primary_net; struct ipx_interface *ipx_primary_net;
struct ipx_interface *ipx_internal_net; struct ipx_interface *ipx_internal_net;
extern int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc, extern int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
unsigned char *node); unsigned char *node);
extern void ipxrtr_del_routes(struct ipx_interface *intrfc); extern void ipxrtr_del_routes(struct ipx_interface *intrfc);
extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, extern int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
struct iovec *iov, int len, int noblock); struct iovec *iov, int len, int noblock);
extern int ipxrtr_route_skb(struct sk_buff *skb); extern int ipxrtr_route_skb(struct sk_buff *skb);
extern struct ipx_route *ipxrtr_lookup(__u32 net); extern struct ipx_route *ipxrtr_lookup(__be32 net);
extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
#undef IPX_REFCNT_DEBUG #undef IPX_REFCNT_DEBUG
...@@ -177,7 +177,7 @@ static void ipxitf_clear_primary_net(void) ...@@ -177,7 +177,7 @@ static void ipxitf_clear_primary_net(void)
} }
static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev, static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev,
unsigned short datalink) __be16 datalink)
{ {
struct ipx_interface *i; struct ipx_interface *i;
...@@ -190,7 +190,7 @@ static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev, ...@@ -190,7 +190,7 @@ static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev,
} }
static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev, static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
unsigned short datalink) __be16 datalink)
{ {
struct ipx_interface *i; struct ipx_interface *i;
...@@ -202,7 +202,7 @@ static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev, ...@@ -202,7 +202,7 @@ static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
return i; return i;
} }
struct ipx_interface *ipxitf_find_using_net(__u32 net) struct ipx_interface *ipxitf_find_using_net(__be32 net)
{ {
struct ipx_interface *i; struct ipx_interface *i;
...@@ -237,7 +237,7 @@ static void ipxitf_insert_socket(struct ipx_interface *intrfc, struct sock *sk) ...@@ -237,7 +237,7 @@ static void ipxitf_insert_socket(struct ipx_interface *intrfc, struct sock *sk)
/* caller must hold intrfc->if_sklist_lock */ /* caller must hold intrfc->if_sklist_lock */
static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc, static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc,
unsigned short port) __be16 port)
{ {
struct sock *s; struct sock *s;
struct hlist_node *node; struct hlist_node *node;
...@@ -252,7 +252,7 @@ static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc, ...@@ -252,7 +252,7 @@ static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc,
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc, static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
unsigned short port) __be16 port)
{ {
struct sock *s; struct sock *s;
...@@ -268,7 +268,7 @@ static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc, ...@@ -268,7 +268,7 @@ static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc, static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc,
unsigned char *ipx_node, unsigned char *ipx_node,
unsigned short port) __be16 port)
{ {
struct sock *s; struct sock *s;
struct hlist_node *node; struct hlist_node *node;
...@@ -600,10 +600,10 @@ int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node) ...@@ -600,10 +600,10 @@ int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, char *node)
/* see if we need to include the netnum in the route list */ /* see if we need to include the netnum in the route list */
if (IPX_SKB_CB(skb)->last_hop.index >= 0) { if (IPX_SKB_CB(skb)->last_hop.index >= 0) {
u32 *last_hop = (u32 *)(((u8 *) skb->data) + __be32 *last_hop = (__be32 *)(((u8 *) skb->data) +
sizeof(struct ipxhdr) + sizeof(struct ipxhdr) +
IPX_SKB_CB(skb)->last_hop.index * IPX_SKB_CB(skb)->last_hop.index *
sizeof(u32)); sizeof(__be32));
*last_hop = IPX_SKB_CB(skb)->last_hop.netnum; *last_hop = IPX_SKB_CB(skb)->last_hop.netnum;
IPX_SKB_CB(skb)->last_hop.index = -1; IPX_SKB_CB(skb)->last_hop.index = -1;
} }
...@@ -772,7 +772,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc, ...@@ -772,7 +772,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
} else { } else {
printk(KERN_WARNING "IPX: Network number collision " printk(KERN_WARNING "IPX: Network number collision "
"%lx\n %s %s and %s %s\n", "%lx\n %s %s and %s %s\n",
(unsigned long) htonl(cb->ipx_source_net), (unsigned long) ntohl(cb->ipx_source_net),
ipx_device_name(i), ipx_device_name(i),
ipx_frame_name(i->if_dlink_type), ipx_frame_name(i->if_dlink_type),
ipx_device_name(intrfc), ipx_device_name(intrfc),
...@@ -812,7 +812,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb) ...@@ -812,7 +812,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
int i, rc = -EINVAL; int i, rc = -EINVAL;
struct ipx_interface *ifcs; struct ipx_interface *ifcs;
char *c; char *c;
u32 *l; __be32 *l;
/* Illegal packet - too many hops or too short */ /* Illegal packet - too many hops or too short */
/* We decide to throw it away: no broadcasting, no local processing. /* We decide to throw it away: no broadcasting, no local processing.
...@@ -833,7 +833,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb) ...@@ -833,7 +833,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
goto out; goto out;
c = ((u8 *) ipx) + sizeof(struct ipxhdr); c = ((u8 *) ipx) + sizeof(struct ipxhdr);
l = (u32 *) c; l = (__be32 *) c;
/* Don't broadcast packet if already seen this net */ /* Don't broadcast packet if already seen this net */
for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++) for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++)
...@@ -855,7 +855,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb) ...@@ -855,7 +855,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
/* That aren't in the list */ /* That aren't in the list */
if (ifcs == intrfc) if (ifcs == intrfc)
continue; continue;
l = (__u32 *) c; l = (__be32 *) c;
/* don't consider the last entry in the packet list, /* don't consider the last entry in the packet list,
* it is our netnum, and it is not there yet */ * it is our netnum, and it is not there yet */
for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++) for (i = 0; i < IPX_SKB_CB(skb)->ipx_tctrl; i++)
...@@ -885,8 +885,8 @@ static void ipxitf_insert(struct ipx_interface *intrfc) ...@@ -885,8 +885,8 @@ static void ipxitf_insert(struct ipx_interface *intrfc)
ipx_primary_net = intrfc; ipx_primary_net = intrfc;
} }
static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __be32 netnum,
unsigned short dlink_type, __be16 dlink_type,
struct datalink_proto *dlink, struct datalink_proto *dlink,
unsigned char internal, unsigned char internal,
int ipx_offset) int ipx_offset)
...@@ -960,7 +960,7 @@ static __be16 ipx_map_frame_type(unsigned char type) ...@@ -960,7 +960,7 @@ static __be16 ipx_map_frame_type(unsigned char type)
static int ipxitf_create(struct ipx_interface_definition *idef) static int ipxitf_create(struct ipx_interface_definition *idef)
{ {
struct net_device *dev; struct net_device *dev;
unsigned short dlink_type = 0; __be16 dlink_type = 0;
struct datalink_proto *datalink = NULL; struct datalink_proto *datalink = NULL;
struct ipx_interface *intrfc; struct ipx_interface *intrfc;
int rc; int rc;
...@@ -1073,7 +1073,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef) ...@@ -1073,7 +1073,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
static int ipxitf_delete(struct ipx_interface_definition *idef) static int ipxitf_delete(struct ipx_interface_definition *idef)
{ {
struct net_device *dev = NULL; struct net_device *dev = NULL;
unsigned short dlink_type = 0; __be16 dlink_type = 0;
struct ipx_interface *intrfc; struct ipx_interface *intrfc;
int rc = 0; int rc = 0;
...@@ -1110,7 +1110,7 @@ static int ipxitf_delete(struct ipx_interface_definition *idef) ...@@ -1110,7 +1110,7 @@ static int ipxitf_delete(struct ipx_interface_definition *idef)
} }
static struct ipx_interface *ipxitf_auto_create(struct net_device *dev, static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
unsigned short dlink_type) __be16 dlink_type)
{ {
struct ipx_interface *intrfc = NULL; struct ipx_interface *intrfc = NULL;
struct datalink_proto *datalink; struct datalink_proto *datalink;
...@@ -1122,7 +1122,7 @@ static struct ipx_interface *ipxitf_auto_create(struct net_device *dev, ...@@ -1122,7 +1122,7 @@ static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
if (dev->addr_len > IPX_NODE_LEN) if (dev->addr_len > IPX_NODE_LEN)
goto out; goto out;
switch (htons(dlink_type)) { switch (ntohs(dlink_type)) {
case ETH_P_IPX: datalink = pEII_datalink; break; case ETH_P_IPX: datalink = pEII_datalink; break;
case ETH_P_802_2: datalink = p8022_datalink; break; case ETH_P_802_2: datalink = p8022_datalink; break;
case ETH_P_SNAP: datalink = pSNAP_datalink; break; case ETH_P_SNAP: datalink = pSNAP_datalink; break;
...@@ -1234,27 +1234,27 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg) ...@@ -1234,27 +1234,27 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
/* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */ /* Note: We assume ipx_tctrl==0 and htons(length)==ipx_pktsize */
/* This functions should *not* mess with packet contents */ /* This functions should *not* mess with packet contents */
__u16 ipx_cksum(struct ipxhdr *packet, int length) __be16 ipx_cksum(struct ipxhdr *packet, int length)
{ {
/* /*
* NOTE: sum is a net byte order quantity, which optimizes the * NOTE: sum is a net byte order quantity, which optimizes the
* loop. This only works on big and little endian machines. (I * loop. This only works on big and little endian machines. (I
* don't know of a machine that isn't.) * don't know of a machine that isn't.)
*/ */
/* start at ipx_dest - We skip the checksum field and start with /* handle the first 3 words separately; checksum should be skipped
* ipx_type before the loop, not considering ipx_tctrl in the calc */ * and ipx_tctrl masked out */
__u16 *p = (__u16 *)&packet->ipx_dest; __u16 *p = (__u16 *)packet;
__u32 i = (length >> 1) - 1; /* Number of complete words */ __u32 sum = p[1] + (p[2] & (__force u16)htons(0x00ff));
__u32 sum = packet->ipx_type << sizeof(packet->ipx_tctrl); __u32 i = (length >> 1) - 3; /* Number of remaining complete words */
/* Loop through all complete words except the checksum field, /* Loop through them */
* ipx_type (accounted above) and ipx_tctrl (not used in the cksum) */ p += 3;
while (--i) while (i--)
sum += *p++; sum += *p++;
/* Add on the last part word if it exists */ /* Add on the last part word if it exists */
if (packet->ipx_pktsize & htons(1)) if (packet->ipx_pktsize & htons(1))
sum += ntohs(0xff00) & *p; sum += (__force u16)htons(0xff00) & *p;
/* Do final fixup */ /* Do final fixup */
sum = (sum & 0xffff) + (sum >> 16); sum = (sum & 0xffff) + (sum >> 16);
...@@ -1263,10 +1263,17 @@ __u16 ipx_cksum(struct ipxhdr *packet, int length) ...@@ -1263,10 +1263,17 @@ __u16 ipx_cksum(struct ipxhdr *packet, int length)
if (sum >= 0x10000) if (sum >= 0x10000)
sum++; sum++;
return ~sum; /*
* Leave 0 alone; we don't want 0xffff here. Note that we can't get
* here with 0x10000, so this check is the same as ((__u16)sum)
*/
if (sum)
sum = ~sum;
return (__force __be16)sum;
} }
const char *ipx_frame_name(unsigned short frame) const char *ipx_frame_name(__be16 frame)
{ {
char* rc = "None"; char* rc = "None";
...@@ -1401,7 +1408,7 @@ static int ipx_release(struct socket *sock) ...@@ -1401,7 +1408,7 @@ static int ipx_release(struct socket *sock)
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc) static __be16 ipx_first_free_socketnum(struct ipx_interface *intrfc)
{ {
unsigned short socketNum = intrfc->if_sknum; unsigned short socketNum = intrfc->if_sknum;
...@@ -1410,7 +1417,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc) ...@@ -1410,7 +1417,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
if (socketNum < IPX_MIN_EPHEMERAL_SOCKET) if (socketNum < IPX_MIN_EPHEMERAL_SOCKET)
socketNum = IPX_MIN_EPHEMERAL_SOCKET; socketNum = IPX_MIN_EPHEMERAL_SOCKET;
while (__ipxitf_find_socket(intrfc, ntohs(socketNum))) while (__ipxitf_find_socket(intrfc, htons(socketNum)))
if (socketNum > IPX_MAX_EPHEMERAL_SOCKET) if (socketNum > IPX_MAX_EPHEMERAL_SOCKET)
socketNum = IPX_MIN_EPHEMERAL_SOCKET; socketNum = IPX_MIN_EPHEMERAL_SOCKET;
else else
...@@ -1419,7 +1426,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc) ...@@ -1419,7 +1426,7 @@ static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
spin_unlock_bh(&intrfc->if_sklist_lock); spin_unlock_bh(&intrfc->if_sklist_lock);
intrfc->if_sknum = socketNum; intrfc->if_sknum = socketNum;
return ntohs(socketNum); return htons(socketNum);
} }
static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
...@@ -1473,7 +1480,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1473,7 +1480,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
ipxs->port)) { ipxs->port)) {
SOCK_DEBUG(sk, SOCK_DEBUG(sk,
"IPX: bind failed because port %X in use.\n", "IPX: bind failed because port %X in use.\n",
ntohs((int)addr->sipx_port)); ntohs(addr->sipx_port));
goto out_put; goto out_put;
} }
} else { } else {
...@@ -1488,7 +1495,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1488,7 +1495,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
if (ipxitf_find_socket(intrfc, addr->sipx_port)) { if (ipxitf_find_socket(intrfc, addr->sipx_port)) {
SOCK_DEBUG(sk, SOCK_DEBUG(sk,
"IPX: bind failed because port %X in use.\n", "IPX: bind failed because port %X in use.\n",
ntohs((int)addr->sipx_port)); ntohs(addr->sipx_port));
goto out_put; goto out_put;
} }
} }
...@@ -1665,7 +1672,7 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty ...@@ -1665,7 +1672,7 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
intrfc = ipxitf_find_using_phys(dev, pt->type); intrfc = ipxitf_find_using_phys(dev, pt->type);
if (!intrfc) { if (!intrfc) {
if (ipxcfg_auto_create_interfaces && if (ipxcfg_auto_create_interfaces &&
ntohl(IPX_SKB_CB(skb)->ipx_dest_net)) { IPX_SKB_CB(skb)->ipx_dest_net) {
intrfc = ipxitf_auto_create(dev, pt->type); intrfc = ipxitf_auto_create(dev, pt->type);
if (intrfc) if (intrfc)
ipxitf_hold(intrfc); ipxitf_hold(intrfc);
......
...@@ -260,22 +260,22 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v) ...@@ -260,22 +260,22 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v)
ipxs = ipx_sk(s); ipxs = ipx_sk(s);
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ",
(unsigned long)htonl(ipxs->intrfc->if_netnum), (unsigned long)ntohl(ipxs->intrfc->if_netnum),
ipxs->node[0], ipxs->node[1], ipxs->node[2], ipxs->node[3], ipxs->node[0], ipxs->node[1], ipxs->node[2], ipxs->node[3],
ipxs->node[4], ipxs->node[5], htons(ipxs->port)); ipxs->node[4], ipxs->node[5], ntohs(ipxs->port));
#else #else
seq_printf(seq, "%08lX:%04X ", (unsigned long) htonl(ipxs->intrfc->if_netnum), seq_printf(seq, "%08lX:%04X ", (unsigned long) ntohl(ipxs->intrfc->if_netnum),
htons(ipxs->port)); ntohs(ipxs->port));
#endif /* CONFIG_IPX_INTERN */ #endif /* CONFIG_IPX_INTERN */
if (s->sk_state != TCP_ESTABLISHED) if (s->sk_state != TCP_ESTABLISHED)
seq_printf(seq, "%-28s", "Not_Connected"); seq_printf(seq, "%-28s", "Not_Connected");
else { else {
seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", seq_printf(seq, "%08lX:%02X%02X%02X%02X%02X%02X:%04X ",
(unsigned long)htonl(ipxs->dest_addr.net), (unsigned long)ntohl(ipxs->dest_addr.net),
ipxs->dest_addr.node[0], ipxs->dest_addr.node[1], ipxs->dest_addr.node[0], ipxs->dest_addr.node[1],
ipxs->dest_addr.node[2], ipxs->dest_addr.node[3], ipxs->dest_addr.node[2], ipxs->dest_addr.node[3],
ipxs->dest_addr.node[4], ipxs->dest_addr.node[5], ipxs->dest_addr.node[4], ipxs->dest_addr.node[5],
htons(ipxs->dest_addr.sock)); ntohs(ipxs->dest_addr.sock));
} }
seq_printf(seq, "%08X %08X %02X %03d\n", seq_printf(seq, "%08X %08X %02X %03d\n",
......
...@@ -19,17 +19,17 @@ DEFINE_RWLOCK(ipx_routes_lock); ...@@ -19,17 +19,17 @@ DEFINE_RWLOCK(ipx_routes_lock);
extern struct ipx_interface *ipx_internal_net; extern struct ipx_interface *ipx_internal_net;
extern __u16 ipx_cksum(struct ipxhdr *packet, int length); extern __be16 ipx_cksum(struct ipxhdr *packet, int length);
extern struct ipx_interface *ipxitf_find_using_net(__u32 net); extern struct ipx_interface *ipxitf_find_using_net(__be32 net);
extern int ipxitf_demux_socket(struct ipx_interface *intrfc, extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
struct sk_buff *skb, int copy); struct sk_buff *skb, int copy);
extern int ipxitf_demux_socket(struct ipx_interface *intrfc, extern int ipxitf_demux_socket(struct ipx_interface *intrfc,
struct sk_buff *skb, int copy); struct sk_buff *skb, int copy);
extern int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb, extern int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb,
char *node); char *node);
extern struct ipx_interface *ipxitf_find_using_net(__u32 net); extern struct ipx_interface *ipxitf_find_using_net(__be32 net);
struct ipx_route *ipxrtr_lookup(__u32 net) struct ipx_route *ipxrtr_lookup(__be32 net)
{ {
struct ipx_route *r; struct ipx_route *r;
...@@ -48,7 +48,7 @@ struct ipx_route *ipxrtr_lookup(__u32 net) ...@@ -48,7 +48,7 @@ struct ipx_route *ipxrtr_lookup(__u32 net)
/* /*
* Caller must hold a reference to intrfc * Caller must hold a reference to intrfc
*/ */
int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc, int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
unsigned char *node) unsigned char *node)
{ {
struct ipx_route *rt; struct ipx_route *rt;
...@@ -118,7 +118,7 @@ static int ipxrtr_create(struct ipx_route_definition *rd) ...@@ -118,7 +118,7 @@ static int ipxrtr_create(struct ipx_route_definition *rd)
return rc; return rc;
} }
static int ipxrtr_delete(__u32 net) static int ipxrtr_delete(__be32 net)
{ {
struct ipx_route *r, *tmp; struct ipx_route *r, *tmp;
int rc; int rc;
...@@ -238,7 +238,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, ...@@ -238,7 +238,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
/* Apply checksum. Not allowed on 802.3 links. */ /* Apply checksum. Not allowed on 802.3 links. */
if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023)) if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023))
ipx->ipx_checksum = 0xFFFF; ipx->ipx_checksum = htons(0xFFFF);
else else
ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr)); ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr));
......
...@@ -427,7 +427,7 @@ __build_packet_message(struct nfulnl_instance *inst, ...@@ -427,7 +427,7 @@ __build_packet_message(struct nfulnl_instance *inst,
nfmsg->version = NFNETLINK_V0; nfmsg->version = NFNETLINK_V0;
nfmsg->res_id = htons(inst->group_num); nfmsg->res_id = htons(inst->group_num);
pmsg.hw_protocol = htons(skb->protocol); pmsg.hw_protocol = skb->protocol;
pmsg.hook = hooknum; pmsg.hook = hooknum;
NFA_PUT(inst->skb, NFULA_PACKET_HDR, sizeof(pmsg), &pmsg); NFA_PUT(inst->skb, NFULA_PACKET_HDR, sizeof(pmsg), &pmsg);
...@@ -878,7 +878,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -878,7 +878,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
params = NFA_DATA(nfula[NFULA_CFG_MODE-1]); params = NFA_DATA(nfula[NFULA_CFG_MODE-1]);
nfulnl_set_mode(inst, params->copy_mode, nfulnl_set_mode(inst, params->copy_mode,
ntohs(params->copy_range)); ntohl(params->copy_range));
} }
if (nfula[NFULA_CFG_TIMEOUT-1]) { if (nfula[NFULA_CFG_TIMEOUT-1]) {
...@@ -896,8 +896,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -896,8 +896,8 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
} }
if (nfula[NFULA_CFG_QTHRESH-1]) { if (nfula[NFULA_CFG_QTHRESH-1]) {
u_int32_t qthresh = __be32 qthresh =
*(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_QTHRESH-1]); *(__be32 *)NFA_DATA(nfula[NFULA_CFG_QTHRESH-1]);
nfulnl_set_qthresh(inst, ntohl(qthresh)); nfulnl_set_qthresh(inst, ntohl(qthresh));
} }
......
...@@ -414,7 +414,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, ...@@ -414,7 +414,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
nfmsg->res_id = htons(queue->queue_num); nfmsg->res_id = htons(queue->queue_num);
pmsg.packet_id = htonl(entry->id); pmsg.packet_id = htonl(entry->id);
pmsg.hw_protocol = htons(entskb->protocol); pmsg.hw_protocol = entskb->protocol;
pmsg.hook = entinf->hook; pmsg.hook = entinf->hook;
NFA_PUT(skb, NFQA_PACKET_HDR, sizeof(pmsg), &pmsg); NFA_PUT(skb, NFQA_PACKET_HDR, sizeof(pmsg), &pmsg);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
config NETLABEL config NETLABEL
bool "NetLabel subsystem support" bool "NetLabel subsystem support"
depends on NET && SECURITY depends on SECURITY
default n default n
---help--- ---help---
NetLabel provides support for explicit network packet labeling NetLabel provides support for explicit network packet labeling
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment