diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 02:03:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 02:03:42 -0400 |
commit | 3dcbbcda7c5b77c400791b26facd6593c5b176e0 (patch) | |
tree | 2e7b844c4d450cf43810a6ed0ddd5c702c245a88 | |
parent | c972398b7871d9fb58c6a317786065a7cc6ca4be (diff) | |
parent | 6fbe59b9569b2c8d5522d182263935c6c86fc40a (diff) |
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: (160 commits)
[ETHTOOL]: Remove some entries from non-root command list.
[Bluetooth]: Fix section mismatch of bt_sysfs_cleanup()
[Bluetooth]: Don't update disconnect timer for incoming connections
[ETHTOOL]: let mortals use ethtool
[NetLabel]: add audit support for configuration changes
[TCP]: Fix and simplify microsecond rtt sampling
[TCP] tcp-lp: prevent chance for oops
[SUNRPC]: Remove unnecessary check in net/sunrpc/svcsock.c
[IPVS] bug: endianness breakage in ip_vs_ftp
[IPVS]: ipvs annotations
[NETFILTER]: h323 annotations
[NETFILTER]: ipt annotations
[NETFILTER]: NAT annotations
[NETFILTER]: conntrack annotations
[NETFILTER]: netfilter misc annotations
[NET]: Annotate dst_ops protocol
[NET]: is it Andy or Andi ??
[IPVS]: Make sure ip_vs_ftp ports are valid: module_param_array approach
[IPVS]: Reverse valid ip_vs_ftp ports fix: port check approach
[IrDA] stir4200: removing undocumented bits handling
...
247 files changed, 3164 insertions, 1990 deletions
diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt index 44f2f769e865..18d385c068fc 100644 --- a/Documentation/networking/pktgen.txt +++ b/Documentation/networking/pktgen.txt | |||
@@ -100,6 +100,7 @@ Examples: | |||
100 | are: IPSRC_RND #IP Source is random (between min/max), | 100 | are: IPSRC_RND #IP Source is random (between min/max), |
101 | IPDST_RND, UDPSRC_RND, | 101 | IPDST_RND, UDPSRC_RND, |
102 | UDPDST_RND, MACSRC_RND, MACDST_RND | 102 | UDPDST_RND, MACSRC_RND, MACDST_RND |
103 | MPLS_RND, VID_RND, SVID_RND | ||
103 | 104 | ||
104 | pgset "udp_src_min 9" set UDP source port min, If < udp_src_max, then | 105 | pgset "udp_src_min 9" set UDP source port min, If < udp_src_max, then |
105 | cycle through the port range. | 106 | cycle through the port range. |
@@ -125,6 +126,21 @@ Examples: | |||
125 | 126 | ||
126 | pgset "mpls 0" turn off mpls (or any invalid argument works too!) | 127 | pgset "mpls 0" turn off mpls (or any invalid argument works too!) |
127 | 128 | ||
129 | pgset "vlan_id 77" set VLAN ID 0-4095 | ||
130 | pgset "vlan_p 3" set priority bit 0-7 (default 0) | ||
131 | pgset "vlan_cfi 0" set canonical format identifier 0-1 (default 0) | ||
132 | |||
133 | pgset "svlan_id 22" set SVLAN ID 0-4095 | ||
134 | pgset "svlan_p 3" set priority bit 0-7 (default 0) | ||
135 | pgset "svlan_cfi 0" set canonical format identifier 0-1 (default 0) | ||
136 | |||
137 | pgset "vlan_id 9999" > 4095 remove vlan and svlan tags | ||
138 | pgset "svlan 9999" > 4095 remove svlan tag | ||
139 | |||
140 | |||
141 | pgset "tos XX" set former IPv4 TOS field (e.g. "tos 28" for AF11 no ECN, default 00) | ||
142 | pgset "traffic_class XX" set former IPv6 TRAFFIC CLASS (e.g. "traffic_class B8" for EF no ECN, default 00) | ||
143 | |||
128 | pgset stop aborts injection. Also, ^C aborts generator. | 144 | pgset stop aborts injection. Also, ^C aborts generator. |
129 | 145 | ||
130 | 146 | ||
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index b5195be62818..e1a1b11473e2 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c | |||
@@ -320,7 +320,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) | |||
320 | } | 320 | } |
321 | 321 | ||
322 | printk(KERN_INFO "simeth_device_event: %s ipaddr=0x%x\n", | 322 | printk(KERN_INFO "simeth_device_event: %s ipaddr=0x%x\n", |
323 | dev->name, htonl(ifa->ifa_local)); | 323 | dev->name, ntohl(ifa->ifa_local)); |
324 | 324 | ||
325 | /* | 325 | /* |
326 | * XXX Fix me | 326 | * XXX Fix me |
@@ -331,7 +331,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) | |||
331 | local = dev->priv; | 331 | local = dev->priv; |
332 | /* now do it for real */ | 332 | /* now do it for real */ |
333 | r = event == NETDEV_UP ? | 333 | r = event == NETDEV_UP ? |
334 | netdev_attach(local->simfd, dev->irq, htonl(ifa->ifa_local)): | 334 | netdev_attach(local->simfd, dev->irq, ntohl(ifa->ifa_local)): |
335 | netdev_detach(local->simfd); | 335 | netdev_detach(local->simfd); |
336 | 336 | ||
337 | printk(KERN_INFO "simeth: netdev_attach/detach: event=%s ->%d\n", | 337 | printk(KERN_INFO "simeth: netdev_attach/detach: event=%s ->%d\n", |
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index 664c2e2fb820..bd1178fa4e9a 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -825,7 +825,7 @@ int dev_netmask(void *d, void *m) | |||
825 | struct net_device *dev = d; | 825 | struct net_device *dev = d; |
826 | struct in_device *ip = dev->ip_ptr; | 826 | struct in_device *ip = dev->ip_ptr; |
827 | struct in_ifaddr *in; | 827 | struct in_ifaddr *in; |
828 | __u32 *mask_out = m; | 828 | __be32 *mask_out = m; |
829 | 829 | ||
830 | if(ip == NULL) | 830 | if(ip == NULL) |
831 | return(1); | 831 | return(1); |
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c index d96164e602fe..15d64414bd60 100644 --- a/arch/xtensa/platform-iss/network.c +++ b/arch/xtensa/platform-iss/network.c | |||
@@ -201,7 +201,7 @@ static void dev_ip_addr(void *d, char *buf, char *bin_buf) | |||
201 | struct net_device *dev = d; | 201 | struct net_device *dev = d; |
202 | struct in_device *ip = dev->ip_ptr; | 202 | struct in_device *ip = dev->ip_ptr; |
203 | struct in_ifaddr *in; | 203 | struct in_ifaddr *in; |
204 | u32 addr; | 204 | __be32 addr; |
205 | 205 | ||
206 | if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) { | 206 | if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) { |
207 | printk(KERN_WARNING "Device not assigned an IP address!\n"); | 207 | printk(KERN_WARNING "Device not assigned an IP address!\n"); |
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 23f96213f4ac..efcc28ec9d9a 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * | 2 | * |
3 | * AVM BlueFRITZ! USB driver | 3 | * AVM BlueFRITZ! USB driver |
4 | * | 4 | * |
5 | * Copyright (C) 2003 Marcel Holtmann <marcel@holtmann.org> | 5 | * Copyright (C) 2003-2006 Marcel Holtmann <marcel@holtmann.org> |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
@@ -59,7 +59,6 @@ static struct usb_device_id bfusb_table[] = { | |||
59 | 59 | ||
60 | MODULE_DEVICE_TABLE(usb, bfusb_table); | 60 | MODULE_DEVICE_TABLE(usb, bfusb_table); |
61 | 61 | ||
62 | |||
63 | #define BFUSB_MAX_BLOCK_SIZE 256 | 62 | #define BFUSB_MAX_BLOCK_SIZE 256 |
64 | 63 | ||
65 | #define BFUSB_BLOCK_TIMEOUT 3000 | 64 | #define BFUSB_BLOCK_TIMEOUT 3000 |
@@ -70,7 +69,7 @@ MODULE_DEVICE_TABLE(usb, bfusb_table); | |||
70 | #define BFUSB_MAX_BULK_TX 2 | 69 | #define BFUSB_MAX_BULK_TX 2 |
71 | #define BFUSB_MAX_BULK_RX 2 | 70 | #define BFUSB_MAX_BULK_RX 2 |
72 | 71 | ||
73 | struct bfusb { | 72 | struct bfusb_data { |
74 | struct hci_dev *hdev; | 73 | struct hci_dev *hdev; |
75 | 74 | ||
76 | unsigned long state; | 75 | unsigned long state; |
@@ -92,137 +91,136 @@ struct bfusb { | |||
92 | struct sk_buff_head completed_q; | 91 | struct sk_buff_head completed_q; |
93 | }; | 92 | }; |
94 | 93 | ||
95 | struct bfusb_scb { | 94 | struct bfusb_data_scb { |
96 | struct urb *urb; | 95 | struct urb *urb; |
97 | }; | 96 | }; |
98 | 97 | ||
99 | static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs); | 98 | static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs); |
100 | static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs); | 99 | static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs); |
101 | 100 | ||
102 | static struct urb *bfusb_get_completed(struct bfusb *bfusb) | 101 | static struct urb *bfusb_get_completed(struct bfusb_data *data) |
103 | { | 102 | { |
104 | struct sk_buff *skb; | 103 | struct sk_buff *skb; |
105 | struct urb *urb = NULL; | 104 | struct urb *urb = NULL; |
106 | 105 | ||
107 | BT_DBG("bfusb %p", bfusb); | 106 | BT_DBG("bfusb %p", data); |
108 | 107 | ||
109 | skb = skb_dequeue(&bfusb->completed_q); | 108 | skb = skb_dequeue(&data->completed_q); |
110 | if (skb) { | 109 | if (skb) { |
111 | urb = ((struct bfusb_scb *) skb->cb)->urb; | 110 | urb = ((struct bfusb_data_scb *) skb->cb)->urb; |
112 | kfree_skb(skb); | 111 | kfree_skb(skb); |
113 | } | 112 | } |
114 | 113 | ||
115 | return urb; | 114 | return urb; |
116 | } | 115 | } |
117 | 116 | ||
118 | static void bfusb_unlink_urbs(struct bfusb *bfusb) | 117 | static void bfusb_unlink_urbs(struct bfusb_data *data) |
119 | { | 118 | { |
120 | struct sk_buff *skb; | 119 | struct sk_buff *skb; |
121 | struct urb *urb; | 120 | struct urb *urb; |
122 | 121 | ||
123 | BT_DBG("bfusb %p", bfusb); | 122 | BT_DBG("bfusb %p", data); |
124 | 123 | ||
125 | while ((skb = skb_dequeue(&bfusb->pending_q))) { | 124 | while ((skb = skb_dequeue(&data->pending_q))) { |
126 | urb = ((struct bfusb_scb *) skb->cb)->urb; | 125 | urb = ((struct bfusb_data_scb *) skb->cb)->urb; |
127 | usb_kill_urb(urb); | 126 | usb_kill_urb(urb); |
128 | skb_queue_tail(&bfusb->completed_q, skb); | 127 | skb_queue_tail(&data->completed_q, skb); |
129 | } | 128 | } |
130 | 129 | ||
131 | while ((urb = bfusb_get_completed(bfusb))) | 130 | while ((urb = bfusb_get_completed(data))) |
132 | usb_free_urb(urb); | 131 | usb_free_urb(urb); |
133 | } | 132 | } |
134 | 133 | ||
135 | 134 | static int bfusb_send_bulk(struct bfusb_data *data, struct sk_buff *skb) | |
136 | static int bfusb_send_bulk(struct bfusb *bfusb, struct sk_buff *skb) | ||
137 | { | 135 | { |
138 | struct bfusb_scb *scb = (void *) skb->cb; | 136 | struct bfusb_data_scb *scb = (void *) skb->cb; |
139 | struct urb *urb = bfusb_get_completed(bfusb); | 137 | struct urb *urb = bfusb_get_completed(data); |
140 | int err, pipe; | 138 | int err, pipe; |
141 | 139 | ||
142 | BT_DBG("bfusb %p skb %p len %d", bfusb, skb, skb->len); | 140 | BT_DBG("bfusb %p skb %p len %d", data, skb, skb->len); |
143 | 141 | ||
144 | if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) | 142 | if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) |
145 | return -ENOMEM; | 143 | return -ENOMEM; |
146 | 144 | ||
147 | pipe = usb_sndbulkpipe(bfusb->udev, bfusb->bulk_out_ep); | 145 | pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); |
148 | 146 | ||
149 | usb_fill_bulk_urb(urb, bfusb->udev, pipe, skb->data, skb->len, | 147 | usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, skb->len, |
150 | bfusb_tx_complete, skb); | 148 | bfusb_tx_complete, skb); |
151 | 149 | ||
152 | scb->urb = urb; | 150 | scb->urb = urb; |
153 | 151 | ||
154 | skb_queue_tail(&bfusb->pending_q, skb); | 152 | skb_queue_tail(&data->pending_q, skb); |
155 | 153 | ||
156 | err = usb_submit_urb(urb, GFP_ATOMIC); | 154 | err = usb_submit_urb(urb, GFP_ATOMIC); |
157 | if (err) { | 155 | if (err) { |
158 | BT_ERR("%s bulk tx submit failed urb %p err %d", | 156 | BT_ERR("%s bulk tx submit failed urb %p err %d", |
159 | bfusb->hdev->name, urb, err); | 157 | data->hdev->name, urb, err); |
160 | skb_unlink(skb, &bfusb->pending_q); | 158 | skb_unlink(skb, &data->pending_q); |
161 | usb_free_urb(urb); | 159 | usb_free_urb(urb); |
162 | } else | 160 | } else |
163 | atomic_inc(&bfusb->pending_tx); | 161 | atomic_inc(&data->pending_tx); |
164 | 162 | ||
165 | return err; | 163 | return err; |
166 | } | 164 | } |
167 | 165 | ||
168 | static void bfusb_tx_wakeup(struct bfusb *bfusb) | 166 | static void bfusb_tx_wakeup(struct bfusb_data *data) |
169 | { | 167 | { |
170 | struct sk_buff *skb; | 168 | struct sk_buff *skb; |
171 | 169 | ||
172 | BT_DBG("bfusb %p", bfusb); | 170 | BT_DBG("bfusb %p", data); |
173 | 171 | ||
174 | if (test_and_set_bit(BFUSB_TX_PROCESS, &bfusb->state)) { | 172 | if (test_and_set_bit(BFUSB_TX_PROCESS, &data->state)) { |
175 | set_bit(BFUSB_TX_WAKEUP, &bfusb->state); | 173 | set_bit(BFUSB_TX_WAKEUP, &data->state); |
176 | return; | 174 | return; |
177 | } | 175 | } |
178 | 176 | ||
179 | do { | 177 | do { |
180 | clear_bit(BFUSB_TX_WAKEUP, &bfusb->state); | 178 | clear_bit(BFUSB_TX_WAKEUP, &data->state); |
181 | 179 | ||
182 | while ((atomic_read(&bfusb->pending_tx) < BFUSB_MAX_BULK_TX) && | 180 | while ((atomic_read(&data->pending_tx) < BFUSB_MAX_BULK_TX) && |
183 | (skb = skb_dequeue(&bfusb->transmit_q))) { | 181 | (skb = skb_dequeue(&data->transmit_q))) { |
184 | if (bfusb_send_bulk(bfusb, skb) < 0) { | 182 | if (bfusb_send_bulk(data, skb) < 0) { |
185 | skb_queue_head(&bfusb->transmit_q, skb); | 183 | skb_queue_head(&data->transmit_q, skb); |
186 | break; | 184 | break; |
187 | } | 185 | } |
188 | } | 186 | } |
189 | 187 | ||
190 | } while (test_bit(BFUSB_TX_WAKEUP, &bfusb->state)); | 188 | } while (test_bit(BFUSB_TX_WAKEUP, &data->state)); |
191 | 189 | ||
192 | clear_bit(BFUSB_TX_PROCESS, &bfusb->state); | 190 | clear_bit(BFUSB_TX_PROCESS, &data->state); |
193 | } | 191 | } |
194 | 192 | ||
195 | static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs) | 193 | static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs) |
196 | { | 194 | { |
197 | struct sk_buff *skb = (struct sk_buff *) urb->context; | 195 | struct sk_buff *skb = (struct sk_buff *) urb->context; |
198 | struct bfusb *bfusb = (struct bfusb *) skb->dev; | 196 | struct bfusb_data *data = (struct bfusb_data *) skb->dev; |
199 | 197 | ||
200 | BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len); | 198 | BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len); |
201 | 199 | ||
202 | atomic_dec(&bfusb->pending_tx); | 200 | atomic_dec(&data->pending_tx); |
203 | 201 | ||
204 | if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags)) | 202 | if (!test_bit(HCI_RUNNING, &data->hdev->flags)) |
205 | return; | 203 | return; |
206 | 204 | ||
207 | if (!urb->status) | 205 | if (!urb->status) |
208 | bfusb->hdev->stat.byte_tx += skb->len; | 206 | data->hdev->stat.byte_tx += skb->len; |
209 | else | 207 | else |
210 | bfusb->hdev->stat.err_tx++; | 208 | data->hdev->stat.err_tx++; |
211 | 209 | ||
212 | read_lock(&bfusb->lock); | 210 | read_lock(&data->lock); |
213 | 211 | ||
214 | skb_unlink(skb, &bfusb->pending_q); | 212 | skb_unlink(skb, &data->pending_q); |
215 | skb_queue_tail(&bfusb->completed_q, skb); | 213 | skb_queue_tail(&data->completed_q, skb); |
216 | 214 | ||
217 | bfusb_tx_wakeup(bfusb); | 215 | bfusb_tx_wakeup(data); |
218 | 216 | ||
219 | read_unlock(&bfusb->lock); | 217 | read_unlock(&data->lock); |
220 | } | 218 | } |
221 | 219 | ||
222 | 220 | ||
223 | static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb) | 221 | static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb) |
224 | { | 222 | { |
225 | struct bfusb_scb *scb; | 223 | struct bfusb_data_scb *scb; |
226 | struct sk_buff *skb; | 224 | struct sk_buff *skb; |
227 | int err, pipe, size = HCI_MAX_FRAME_SIZE + 32; | 225 | int err, pipe, size = HCI_MAX_FRAME_SIZE + 32; |
228 | 226 | ||
@@ -231,28 +229,29 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb) | |||
231 | if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) | 229 | if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) |
232 | return -ENOMEM; | 230 | return -ENOMEM; |
233 | 231 | ||
234 | if (!(skb = bt_skb_alloc(size, GFP_ATOMIC))) { | 232 | skb = bt_skb_alloc(size, GFP_ATOMIC); |
233 | if (!skb) { | ||
235 | usb_free_urb(urb); | 234 | usb_free_urb(urb); |
236 | return -ENOMEM; | 235 | return -ENOMEM; |
237 | } | 236 | } |
238 | 237 | ||
239 | skb->dev = (void *) bfusb; | 238 | skb->dev = (void *) data; |
240 | 239 | ||
241 | scb = (struct bfusb_scb *) skb->cb; | 240 | scb = (struct bfusb_data_scb *) skb->cb; |
242 | scb->urb = urb; | 241 | scb->urb = urb; |
243 | 242 | ||
244 | pipe = usb_rcvbulkpipe(bfusb->udev, bfusb->bulk_in_ep); | 243 | pipe = usb_rcvbulkpipe(data->udev, data->bulk_in_ep); |
245 | 244 | ||
246 | usb_fill_bulk_urb(urb, bfusb->udev, pipe, skb->data, size, | 245 | usb_fill_bulk_urb(urb, data->udev, pipe, skb->data, size, |
247 | bfusb_rx_complete, skb); | 246 | bfusb_rx_complete, skb); |
248 | 247 | ||
249 | skb_queue_tail(&bfusb->pending_q, skb); | 248 | skb_queue_tail(&data->pending_q, skb); |
250 | 249 | ||
251 | err = usb_submit_urb(urb, GFP_ATOMIC); | 250 | err = usb_submit_urb(urb, GFP_ATOMIC); |
252 | if (err) { | 251 | if (err) { |
253 | BT_ERR("%s bulk rx submit failed urb %p err %d", | 252 | BT_ERR("%s bulk rx submit failed urb %p err %d", |
254 | bfusb->hdev->name, urb, err); | 253 | data->hdev->name, urb, err); |
255 | skb_unlink(skb, &bfusb->pending_q); | 254 | skb_unlink(skb, &data->pending_q); |
256 | kfree_skb(skb); | 255 | kfree_skb(skb); |
257 | usb_free_urb(urb); | 256 | usb_free_urb(urb); |
258 | } | 257 | } |
@@ -260,15 +259,15 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb) | |||
260 | return err; | 259 | return err; |
261 | } | 260 | } |
262 | 261 | ||
263 | static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *data, int len) | 262 | static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned char *buf, int len) |
264 | { | 263 | { |
265 | BT_DBG("bfusb %p hdr 0x%02x data %p len %d", bfusb, hdr, data, len); | 264 | BT_DBG("bfusb %p hdr 0x%02x data %p len %d", data, hdr, buf, len); |
266 | 265 | ||
267 | if (hdr & 0x10) { | 266 | if (hdr & 0x10) { |
268 | BT_ERR("%s error in block", bfusb->hdev->name); | 267 | BT_ERR("%s error in block", data->hdev->name); |
269 | if (bfusb->reassembly) | 268 | if (data->reassembly) |
270 | kfree_skb(bfusb->reassembly); | 269 | kfree_skb(data->reassembly); |
271 | bfusb->reassembly = NULL; | 270 | data->reassembly = NULL; |
272 | return -EIO; | 271 | return -EIO; |
273 | } | 272 | } |
274 | 273 | ||
@@ -277,46 +276,46 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * | |||
277 | unsigned char pkt_type; | 276 | unsigned char pkt_type; |
278 | int pkt_len = 0; | 277 | int pkt_len = 0; |
279 | 278 | ||
280 | if (bfusb->reassembly) { | 279 | if (data->reassembly) { |
281 | BT_ERR("%s unexpected start block", bfusb->hdev->name); | 280 | BT_ERR("%s unexpected start block", data->hdev->name); |
282 | kfree_skb(bfusb->reassembly); | 281 | kfree_skb(data->reassembly); |
283 | bfusb->reassembly = NULL; | 282 | data->reassembly = NULL; |
284 | } | 283 | } |
285 | 284 | ||
286 | if (len < 1) { | 285 | if (len < 1) { |
287 | BT_ERR("%s no packet type found", bfusb->hdev->name); | 286 | BT_ERR("%s no packet type found", data->hdev->name); |
288 | return -EPROTO; | 287 | return -EPROTO; |
289 | } | 288 | } |
290 | 289 | ||
291 | pkt_type = *data++; len--; | 290 | pkt_type = *buf++; len--; |
292 | 291 | ||
293 | switch (pkt_type) { | 292 | switch (pkt_type) { |
294 | case HCI_EVENT_PKT: | 293 | case HCI_EVENT_PKT: |
295 | if (len >= HCI_EVENT_HDR_SIZE) { | 294 | if (len >= HCI_EVENT_HDR_SIZE) { |
296 | struct hci_event_hdr *hdr = (struct hci_event_hdr *) data; | 295 | struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf; |
297 | pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen; | 296 | pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen; |
298 | } else { | 297 | } else { |
299 | BT_ERR("%s event block is too short", bfusb->hdev->name); | 298 | BT_ERR("%s event block is too short", data->hdev->name); |
300 | return -EILSEQ; | 299 | return -EILSEQ; |
301 | } | 300 | } |
302 | break; | 301 | break; |
303 | 302 | ||
304 | case HCI_ACLDATA_PKT: | 303 | case HCI_ACLDATA_PKT: |
305 | if (len >= HCI_ACL_HDR_SIZE) { | 304 | if (len >= HCI_ACL_HDR_SIZE) { |
306 | struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) data; | 305 | struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf; |
307 | pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen); | 306 | pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen); |
308 | } else { | 307 | } else { |
309 | BT_ERR("%s data block is too short", bfusb->hdev->name); | 308 | BT_ERR("%s data block is too short", data->hdev->name); |
310 | return -EILSEQ; | 309 | return -EILSEQ; |
311 | } | 310 | } |
312 | break; | 311 | break; |
313 | 312 | ||
314 | case HCI_SCODATA_PKT: | 313 | case HCI_SCODATA_PKT: |
315 | if (len >= HCI_SCO_HDR_SIZE) { | 314 | if (len >= HCI_SCO_HDR_SIZE) { |
316 | struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) data; | 315 | struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf; |
317 | pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen; | 316 | pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen; |
318 | } else { | 317 | } else { |
319 | BT_ERR("%s audio block is too short", bfusb->hdev->name); | 318 | BT_ERR("%s audio block is too short", data->hdev->name); |
320 | return -EILSEQ; | 319 | return -EILSEQ; |
321 | } | 320 | } |
322 | break; | 321 | break; |
@@ -324,27 +323,27 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * | |||
324 | 323 | ||
325 | skb = bt_skb_alloc(pkt_len, GFP_ATOMIC); | 324 | skb = bt_skb_alloc(pkt_len, GFP_ATOMIC); |
326 | if (!skb) { | 325 | if (!skb) { |
327 | BT_ERR("%s no memory for the packet", bfusb->hdev->name); | 326 | BT_ERR("%s no memory for the packet", data->hdev->name); |
328 | return -ENOMEM; | 327 | return -ENOMEM; |
329 | } | 328 | } |
330 | 329 | ||
331 | skb->dev = (void *) bfusb->hdev; | 330 | skb->dev = (void *) data->hdev; |
332 | bt_cb(skb)->pkt_type = pkt_type; | 331 | bt_cb(skb)->pkt_type = pkt_type; |
333 | 332 | ||
334 | bfusb->reassembly = skb; | 333 | data->reassembly = skb; |
335 | } else { | 334 | } else { |
336 | if (!bfusb->reassembly) { | 335 | if (!data->reassembly) { |
337 | BT_ERR("%s unexpected continuation block", bfusb->hdev->name); | 336 | BT_ERR("%s unexpected continuation block", data->hdev->name); |
338 | return -EIO; | 337 | return -EIO; |
339 | } | 338 | } |
340 | } | 339 | } |
341 | 340 | ||
342 | if (len > 0) | 341 | if (len > 0) |
343 | memcpy(skb_put(bfusb->reassembly, len), data, len); | 342 | memcpy(skb_put(data->reassembly, len), buf, len); |
344 | 343 | ||
345 | if (hdr & 0x08) { | 344 | if (hdr & 0x08) { |
346 | hci_recv_frame(bfusb->reassembly); | 345 | hci_recv_frame(data->reassembly); |
347 | bfusb->reassembly = NULL; | 346 | data->reassembly = NULL; |
348 | } | 347 | } |
349 | 348 | ||
350 | return 0; | 349 | return 0; |
@@ -353,22 +352,22 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * | |||
353 | static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) | 352 | static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) |
354 | { | 353 | { |
355 | struct sk_buff *skb = (struct sk_buff *) urb->context; | 354 | struct sk_buff *skb = (struct sk_buff *) urb->context; |
356 | struct bfusb *bfusb = (struct bfusb *) skb->dev; | 355 | struct bfusb_data *data = (struct bfusb_data *) skb->dev; |
357 | unsigned char *buf = urb->transfer_buffer; | 356 | unsigned char *buf = urb->transfer_buffer; |
358 | int count = urb->actual_length; | 357 | int count = urb->actual_length; |
359 | int err, hdr, len; | 358 | int err, hdr, len; |
360 | 359 | ||
361 | BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len); | 360 | BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len); |
362 | 361 | ||
363 | read_lock(&bfusb->lock); | 362 | read_lock(&data->lock); |
364 | 363 | ||
365 | if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags)) | 364 | if (!test_bit(HCI_RUNNING, &data->hdev->flags)) |
366 | goto unlock; | 365 | goto unlock; |
367 | 366 | ||
368 | if (urb->status || !count) | 367 | if (urb->status || !count) |
369 | goto resubmit; | 368 | goto resubmit; |
370 | 369 | ||
371 | bfusb->hdev->stat.byte_rx += count; | 370 | data->hdev->stat.byte_rx += count; |
372 | 371 | ||
373 | skb_put(skb, count); | 372 | skb_put(skb, count); |
374 | 373 | ||
@@ -387,90 +386,89 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) | |||
387 | 386 | ||
388 | if (count < len) { | 387 | if (count < len) { |
389 | BT_ERR("%s block extends over URB buffer ranges", | 388 | BT_ERR("%s block extends over URB buffer ranges", |
390 | bfusb->hdev->name); | 389 | data->hdev->name); |
391 | } | 390 | } |
392 | 391 | ||
393 | if ((hdr & 0xe1) == 0xc1) | 392 | if ((hdr & 0xe1) == 0xc1) |
394 | bfusb_recv_block(bfusb, hdr, buf, len); | 393 | bfusb_recv_block(data, hdr, buf, len); |
395 | 394 | ||
396 | count -= len; | 395 | count -= len; |
397 | buf += len; | 396 | buf += len; |
398 | } | 397 | } |
399 | 398 | ||
400 | skb_unlink(skb, &bfusb->pending_q); | 399 | skb_unlink(skb, &data->pending_q); |
401 | kfree_skb(skb); | 400 | kfree_skb(skb); |
402 | 401 | ||
403 | bfusb_rx_submit(bfusb, urb); | 402 | bfusb_rx_submit(data, urb); |
404 | 403 | ||
405 | read_unlock(&bfusb->lock); | 404 | read_unlock(&data->lock); |
406 | 405 | ||
407 | return; | 406 | return; |
408 | 407 | ||
409 | resubmit: | 408 | resubmit: |
410 | urb->dev = bfusb->udev; | 409 | urb->dev = data->udev; |
411 | 410 | ||
412 | err = usb_submit_urb(urb, GFP_ATOMIC); | 411 | err = usb_submit_urb(urb, GFP_ATOMIC); |
413 | if (err) { | 412 | if (err) { |
414 | BT_ERR("%s bulk resubmit failed urb %p err %d", | 413 | BT_ERR("%s bulk resubmit failed urb %p err %d", |
415 | bfusb->hdev->name, urb, err); | 414 | data->hdev->name, urb, err); |
416 | } | 415 | } |
417 | 416 | ||
418 | unlock: | 417 | unlock: |
419 | read_unlock(&bfusb->lock); | 418 | read_unlock(&data->lock); |
420 | } | 419 | } |
421 | 420 | ||
422 | |||
423 | static int bfusb_open(struct hci_dev *hdev) | 421 | static int bfusb_open(struct hci_dev *hdev) |
424 | { | 422 | { |
425 | struct bfusb *bfusb = (struct bfusb *) hdev->driver_data; | 423 | struct bfusb_data *data = hdev->driver_data; |
426 | unsigned long flags; | 424 | unsigned long flags; |
427 | int i, err; | 425 | int i, err; |
428 | 426 | ||
429 | BT_DBG("hdev %p bfusb %p", hdev, bfusb); | 427 | BT_DBG("hdev %p bfusb %p", hdev, data); |
430 | 428 | ||
431 | if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) | 429 | if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) |
432 | return 0; | 430 | return 0; |
433 | 431 | ||
434 | write_lock_irqsave(&bfusb->lock, flags); | 432 | write_lock_irqsave(&data->lock, flags); |
435 | 433 | ||
436 | err = bfusb_rx_submit(bfusb, NULL); | 434 | err = bfusb_rx_submit(data, NULL); |
437 | if (!err) { | 435 | if (!err) { |
438 | for (i = 1; i < BFUSB_MAX_BULK_RX; i++) | 436 | for (i = 1; i < BFUSB_MAX_BULK_RX; i++) |
439 | bfusb_rx_submit(bfusb, NULL); | 437 | bfusb_rx_submit(data, NULL); |
440 | } else { | 438 | } else { |
441 | clear_bit(HCI_RUNNING, &hdev->flags); | 439 | clear_bit(HCI_RUNNING, &hdev->flags); |
442 | } | 440 | } |
443 | 441 | ||
444 | write_unlock_irqrestore(&bfusb->lock, flags); | 442 | write_unlock_irqrestore(&data->lock, flags); |
445 | 443 | ||
446 | return err; | 444 | return err; |
447 | } | 445 | } |
448 | 446 | ||
449 | static int bfusb_flush(struct hci_dev *hdev) | 447 | static int bfusb_flush(struct hci_dev *hdev) |
450 | { | 448 | { |
451 | struct bfusb *bfusb = (struct bfusb *) hdev->driver_data; | 449 | struct bfusb_data *data = hdev->driver_data; |
452 | 450 | ||
453 | BT_DBG("hdev %p bfusb %p", hdev, bfusb); | 451 | BT_DBG("hdev %p bfusb %p", hdev, data); |
454 | 452 | ||
455 | skb_queue_purge(&bfusb->transmit_q); | 453 | skb_queue_purge(&data->transmit_q); |
456 | 454 | ||
457 | return 0; | 455 | return 0; |
458 | } | 456 | } |
459 | 457 | ||
460 | static int bfusb_close(struct hci_dev *hdev) | 458 | static int bfusb_close(struct hci_dev *hdev) |
461 | { | 459 | { |
462 | struct bfusb *bfusb = (struct bfusb *) hdev->driver_data; | 460 | struct bfusb_data *data = hdev->driver_data; |
463 | unsigned long flags; | 461 | unsigned long flags; |
464 | 462 | ||
465 | BT_DBG("hdev %p bfusb %p", hdev, bfusb); | 463 | BT_DBG("hdev %p bfusb %p", hdev, data); |
466 | 464 | ||
467 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | 465 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
468 | return 0; | 466 | return 0; |
469 | 467 | ||
470 | write_lock_irqsave(&bfusb->lock, flags); | 468 | write_lock_irqsave(&data->lock, flags); |
471 | write_unlock_irqrestore(&bfusb->lock, flags); | 469 | write_unlock_irqrestore(&data->lock, flags); |
472 | 470 | ||
473 | bfusb_unlink_urbs(bfusb); | 471 | bfusb_unlink_urbs(data); |
474 | bfusb_flush(hdev); | 472 | bfusb_flush(hdev); |
475 | 473 | ||
476 | return 0; | 474 | return 0; |
@@ -479,7 +477,7 @@ static int bfusb_close(struct hci_dev *hdev) | |||
479 | static int bfusb_send_frame(struct sk_buff *skb) | 477 | static int bfusb_send_frame(struct sk_buff *skb) |
480 | { | 478 | { |
481 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | 479 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; |
482 | struct bfusb *bfusb; | 480 | struct bfusb_data *data; |
483 | struct sk_buff *nskb; | 481 | struct sk_buff *nskb; |
484 | unsigned char buf[3]; | 482 | unsigned char buf[3]; |
485 | int sent = 0, size, count; | 483 | int sent = 0, size, count; |
@@ -494,7 +492,7 @@ static int bfusb_send_frame(struct sk_buff *skb) | |||
494 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 492 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
495 | return -EBUSY; | 493 | return -EBUSY; |
496 | 494 | ||
497 | bfusb = (struct bfusb *) hdev->driver_data; | 495 | data = hdev->driver_data; |
498 | 496 | ||
499 | switch (bt_cb(skb)->pkt_type) { | 497 | switch (bt_cb(skb)->pkt_type) { |
500 | case HCI_COMMAND_PKT: | 498 | case HCI_COMMAND_PKT: |
@@ -514,12 +512,13 @@ static int bfusb_send_frame(struct sk_buff *skb) | |||
514 | count = skb->len; | 512 | count = skb->len; |
515 | 513 | ||
516 | /* Max HCI frame size seems to be 1511 + 1 */ | 514 | /* Max HCI frame size seems to be 1511 + 1 */ |
517 | if (!(nskb = bt_skb_alloc(count + 32, GFP_ATOMIC))) { | 515 | nskb = bt_skb_alloc(count + 32, GFP_ATOMIC); |
516 | if (!nskb) { | ||
518 | BT_ERR("Can't allocate memory for new packet"); | 517 | BT_ERR("Can't allocate memory for new packet"); |
519 | return -ENOMEM; | 518 | return -ENOMEM; |
520 | } | 519 | } |
521 | 520 | ||
522 | nskb->dev = (void *) bfusb; | 521 | nskb->dev = (void *) data; |
523 | 522 | ||
524 | while (count) { | 523 | while (count) { |
525 | size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE); | 524 | size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE); |
@@ -536,18 +535,18 @@ static int bfusb_send_frame(struct sk_buff *skb) | |||
536 | } | 535 | } |
537 | 536 | ||
538 | /* Don't send frame with multiple size of bulk max packet */ | 537 | /* Don't send frame with multiple size of bulk max packet */ |
539 | if ((nskb->len % bfusb->bulk_pkt_size) == 0) { | 538 | if ((nskb->len % data->bulk_pkt_size) == 0) { |
540 | buf[0] = 0xdd; | 539 | buf[0] = 0xdd; |
541 | buf[1] = 0x00; | 540 | buf[1] = 0x00; |
542 | memcpy(skb_put(nskb, 2), buf, 2); | 541 | memcpy(skb_put(nskb, 2), buf, 2); |
543 | } | 542 | } |
544 | 543 | ||
545 | read_lock(&bfusb->lock); | 544 | read_lock(&data->lock); |
546 | 545 | ||
547 | skb_queue_tail(&bfusb->transmit_q, nskb); | 546 | skb_queue_tail(&data->transmit_q, nskb); |
548 | bfusb_tx_wakeup(bfusb); | 547 | bfusb_tx_wakeup(data); |
549 | 548 | ||
550 | read_unlock(&bfusb->lock); | 549 | read_unlock(&data->lock); |
551 | 550 | ||
552 | kfree_skb(skb); | 551 | kfree_skb(skb); |
553 | 552 | ||
@@ -556,11 +555,11 @@ static int bfusb_send_frame(struct sk_buff *skb) | |||
556 | 555 | ||
557 | static void bfusb_destruct(struct hci_dev *hdev) | 556 | static void bfusb_destruct(struct hci_dev *hdev) |
558 | { | 557 | { |
559 | struct bfusb *bfusb = (struct bfusb *) hdev->driver_data; | 558 | struct bfusb_data *data = hdev->driver_data; |
560 | 559 | ||
561 | BT_DBG("hdev %p bfusb %p", hdev, bfusb); | 560 | BT_DBG("hdev %p bfusb %p", hdev, data); |
562 | 561 | ||
563 | kfree(bfusb); | 562 | kfree(data); |
564 | } | 563 | } |
565 | 564 | ||
566 | static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) | 565 | static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) |
@@ -568,25 +567,24 @@ static int bfusb_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg | |||
568 | return -ENOIOCTLCMD; | 567 | return -ENOIOCTLCMD; |
569 | } | 568 | } |
570 | 569 | ||
571 | 570 | static int bfusb_load_firmware(struct bfusb_data *data, unsigned char *firmware, int count) | |
572 | static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int count) | ||
573 | { | 571 | { |
574 | unsigned char *buf; | 572 | unsigned char *buf; |
575 | int err, pipe, len, size, sent = 0; | 573 | int err, pipe, len, size, sent = 0; |
576 | 574 | ||
577 | BT_DBG("bfusb %p udev %p", bfusb, bfusb->udev); | 575 | BT_DBG("bfusb %p udev %p", data, data->udev); |
578 | 576 | ||
579 | BT_INFO("BlueFRITZ! USB loading firmware"); | 577 | BT_INFO("BlueFRITZ! USB loading firmware"); |
580 | 578 | ||
581 | pipe = usb_sndctrlpipe(bfusb->udev, 0); | 579 | pipe = usb_sndctrlpipe(data->udev, 0); |
582 | 580 | ||
583 | if (usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION, | 581 | if (usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, |
584 | 0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) { | 582 | 0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) { |
585 | BT_ERR("Can't change to loading configuration"); | 583 | BT_ERR("Can't change to loading configuration"); |
586 | return -EBUSY; | 584 | return -EBUSY; |
587 | } | 585 | } |
588 | 586 | ||
589 | bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0; | 587 | data->udev->toggle[0] = data->udev->toggle[1] = 0; |
590 | 588 | ||
591 | buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC); | 589 | buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC); |
592 | if (!buf) { | 590 | if (!buf) { |
@@ -594,14 +592,14 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int | |||
594 | return -ENOMEM; | 592 | return -ENOMEM; |
595 | } | 593 | } |
596 | 594 | ||
597 | pipe = usb_sndbulkpipe(bfusb->udev, bfusb->bulk_out_ep); | 595 | pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); |
598 | 596 | ||
599 | while (count) { | 597 | while (count) { |
600 | size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE + 3); | 598 | size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE + 3); |
601 | 599 | ||
602 | memcpy(buf, firmware + sent, size); | 600 | memcpy(buf, firmware + sent, size); |
603 | 601 | ||
604 | err = usb_bulk_msg(bfusb->udev, pipe, buf, size, | 602 | err = usb_bulk_msg(data->udev, pipe, buf, size, |
605 | &len, BFUSB_BLOCK_TIMEOUT); | 603 | &len, BFUSB_BLOCK_TIMEOUT); |
606 | 604 | ||
607 | if (err || (len != size)) { | 605 | if (err || (len != size)) { |
@@ -613,21 +611,23 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int | |||
613 | count -= size; | 611 | count -= size; |
614 | } | 612 | } |
615 | 613 | ||
616 | if ((err = usb_bulk_msg(bfusb->udev, pipe, NULL, 0, | 614 | err = usb_bulk_msg(data->udev, pipe, NULL, 0, |
617 | &len, BFUSB_BLOCK_TIMEOUT)) < 0) { | 615 | &len, BFUSB_BLOCK_TIMEOUT); |
616 | if (err < 0) { | ||
618 | BT_ERR("Error in null packet request"); | 617 | BT_ERR("Error in null packet request"); |
619 | goto error; | 618 | goto error; |
620 | } | 619 | } |
621 | 620 | ||
622 | pipe = usb_sndctrlpipe(bfusb->udev, 0); | 621 | pipe = usb_sndctrlpipe(data->udev, 0); |
623 | 622 | ||
624 | if ((err = usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION, | 623 | err = usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, |
625 | 0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0) { | 624 | 0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
625 | if (err < 0) { | ||
626 | BT_ERR("Can't change to running configuration"); | 626 | BT_ERR("Can't change to running configuration"); |
627 | goto error; | 627 | goto error; |
628 | } | 628 | } |
629 | 629 | ||
630 | bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0; | 630 | data->udev->toggle[0] = data->udev->toggle[1] = 0; |
631 | 631 | ||
632 | BT_INFO("BlueFRITZ! USB device ready"); | 632 | BT_INFO("BlueFRITZ! USB device ready"); |
633 | 633 | ||
@@ -637,9 +637,9 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int | |||
637 | error: | 637 | error: |
638 | kfree(buf); | 638 | kfree(buf); |
639 | 639 | ||
640 | pipe = usb_sndctrlpipe(bfusb->udev, 0); | 640 | pipe = usb_sndctrlpipe(data->udev, 0); |
641 | 641 | ||
642 | usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION, | 642 | usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, |
643 | 0, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | 643 | 0, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
644 | 644 | ||
645 | return err; | 645 | return err; |
@@ -652,7 +652,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
652 | struct usb_host_endpoint *bulk_out_ep; | 652 | struct usb_host_endpoint *bulk_out_ep; |
653 | struct usb_host_endpoint *bulk_in_ep; | 653 | struct usb_host_endpoint *bulk_in_ep; |
654 | struct hci_dev *hdev; | 654 | struct hci_dev *hdev; |
655 | struct bfusb *bfusb; | 655 | struct bfusb_data *data; |
656 | 656 | ||
657 | BT_DBG("intf %p id %p", intf, id); | 657 | BT_DBG("intf %p id %p", intf, id); |
658 | 658 | ||
@@ -672,23 +672,24 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
672 | } | 672 | } |
673 | 673 | ||
674 | /* Initialize control structure and load firmware */ | 674 | /* Initialize control structure and load firmware */ |
675 | if (!(bfusb = kzalloc(sizeof(struct bfusb), GFP_KERNEL))) { | 675 | data = kzalloc(sizeof(struct bfusb_data), GFP_KERNEL); |
676 | if (!data) { | ||
676 | BT_ERR("Can't allocate memory for control structure"); | 677 | BT_ERR("Can't allocate memory for control structure"); |
677 | goto done; | 678 | goto done; |
678 | } | 679 | } |
679 | 680 | ||
680 | bfusb->udev = udev; | 681 | data->udev = udev; |
681 | bfusb->bulk_in_ep = bulk_in_ep->desc.bEndpointAddress; | 682 | data->bulk_in_ep = bulk_in_ep->desc.bEndpointAddress; |
682 | bfusb->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; | 683 | data->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; |
683 | bfusb->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize); | 684 | data->bulk_pkt_size = le16_to_cpu(bulk_out_ep->desc.wMaxPacketSize); |
684 | 685 | ||
685 | rwlock_init(&bfusb->lock); | 686 | rwlock_init(&data->lock); |
686 | 687 | ||
687 | bfusb->reassembly = NULL; | 688 | data->reassembly = NULL; |
688 | 689 | ||
689 | skb_queue_head_init(&bfusb->transmit_q); | 690 | skb_queue_head_init(&data->transmit_q); |
690 | skb_queue_head_init(&bfusb->pending_q); | 691 | skb_queue_head_init(&data->pending_q); |
691 | skb_queue_head_init(&bfusb->completed_q); | 692 | skb_queue_head_init(&data->completed_q); |
692 | 693 | ||
693 | if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) { | 694 | if (request_firmware(&firmware, "bfubase.frm", &udev->dev) < 0) { |
694 | BT_ERR("Firmware request failed"); | 695 | BT_ERR("Firmware request failed"); |
@@ -697,7 +698,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
697 | 698 | ||
698 | BT_DBG("firmware data %p size %d", firmware->data, firmware->size); | 699 | BT_DBG("firmware data %p size %d", firmware->data, firmware->size); |
699 | 700 | ||
700 | if (bfusb_load_firmware(bfusb, firmware->data, firmware->size) < 0) { | 701 | if (bfusb_load_firmware(data, firmware->data, firmware->size) < 0) { |
701 | BT_ERR("Firmware loading failed"); | 702 | BT_ERR("Firmware loading failed"); |
702 | goto release; | 703 | goto release; |
703 | } | 704 | } |
@@ -711,10 +712,10 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
711 | goto error; | 712 | goto error; |
712 | } | 713 | } |
713 | 714 | ||
714 | bfusb->hdev = hdev; | 715 | data->hdev = hdev; |
715 | 716 | ||
716 | hdev->type = HCI_USB; | 717 | hdev->type = HCI_USB; |
717 | hdev->driver_data = bfusb; | 718 | hdev->driver_data = data; |
718 | SET_HCIDEV_DEV(hdev, &intf->dev); | 719 | SET_HCIDEV_DEV(hdev, &intf->dev); |
719 | 720 | ||
720 | hdev->open = bfusb_open; | 721 | hdev->open = bfusb_open; |
@@ -732,7 +733,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
732 | goto error; | 733 | goto error; |
733 | } | 734 | } |
734 | 735 | ||
735 | usb_set_intfdata(intf, bfusb); | 736 | usb_set_intfdata(intf, data); |
736 | 737 | ||
737 | return 0; | 738 | return 0; |
738 | 739 | ||
@@ -740,7 +741,7 @@ release: | |||
740 | release_firmware(firmware); | 741 | release_firmware(firmware); |
741 | 742 | ||
742 | error: | 743 | error: |
743 | kfree(bfusb); | 744 | kfree(data); |
744 | 745 | ||
745 | done: | 746 | done: |
746 | return -EIO; | 747 | return -EIO; |
@@ -748,8 +749,8 @@ done: | |||
748 | 749 | ||
749 | static void bfusb_disconnect(struct usb_interface *intf) | 750 | static void bfusb_disconnect(struct usb_interface *intf) |
750 | { | 751 | { |
751 | struct bfusb *bfusb = usb_get_intfdata(intf); | 752 | struct bfusb_data *data = usb_get_intfdata(intf); |
752 | struct hci_dev *hdev = bfusb->hdev; | 753 | struct hci_dev *hdev = data->hdev; |
753 | 754 | ||
754 | BT_DBG("intf %p", intf); | 755 | BT_DBG("intf %p", intf); |
755 | 756 | ||
@@ -779,7 +780,8 @@ static int __init bfusb_init(void) | |||
779 | 780 | ||
780 | BT_INFO("BlueFRITZ! USB driver ver %s", VERSION); | 781 | BT_INFO("BlueFRITZ! USB driver ver %s", VERSION); |
781 | 782 | ||
782 | if ((err = usb_register(&bfusb_driver)) < 0) | 783 | err = usb_register(&bfusb_driver); |
784 | if (err < 0) | ||
783 | BT_ERR("Failed to register BlueFRITZ! USB driver"); | 785 | BT_ERR("Failed to register BlueFRITZ! USB driver"); |
784 | 786 | ||
785 | return err; | 787 | return err; |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 93ba25b7ea32..420b645c4c9f 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -241,15 +241,11 @@ static int hci_uart_send_frame(struct sk_buff *skb) | |||
241 | 241 | ||
242 | static void hci_uart_destruct(struct hci_dev *hdev) | 242 | static void hci_uart_destruct(struct hci_dev *hdev) |
243 | { | 243 | { |
244 | struct hci_uart *hu; | ||
245 | |||
246 | if (!hdev) | 244 | if (!hdev) |
247 | return; | 245 | return; |
248 | 246 | ||
249 | BT_DBG("%s", hdev->name); | 247 | BT_DBG("%s", hdev->name); |
250 | 248 | kfree(hdev->driver_data); | |
251 | hu = (struct hci_uart *) hdev->driver_data; | ||
252 | kfree(hu); | ||
253 | } | 249 | } |
254 | 250 | ||
255 | /* ------ LDISC part ------ */ | 251 | /* ------ LDISC part ------ */ |
@@ -272,7 +268,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
272 | return -EEXIST; | 268 | return -EEXIST; |
273 | 269 | ||
274 | if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { | 270 | if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { |
275 | BT_ERR("Can't allocate controll structure"); | 271 | BT_ERR("Can't allocate control structure"); |
276 | return -ENFILE; | 272 | return -ENFILE; |
277 | } | 273 | } |
278 | 274 | ||
@@ -360,7 +356,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) | |||
360 | * | 356 | * |
361 | * Return Value: None | 357 | * Return Value: None |
362 | */ | 358 | */ |
363 | static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char *flags, int count) | 359 | static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count) |
364 | { | 360 | { |
365 | struct hci_uart *hu = (void *)tty->disc_data; | 361 | struct hci_uart *hu = (void *)tty->disc_data; |
366 | 362 | ||
@@ -375,7 +371,8 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char | |||
375 | hu->hdev->stat.byte_rx += count; | 371 | hu->hdev->stat.byte_rx += count; |
376 | spin_unlock(&hu->rx_lock); | 372 | spin_unlock(&hu->rx_lock); |
377 | 373 | ||
378 | if (test_and_clear_bit(TTY_THROTTLED,&tty->flags) && tty->driver->unthrottle) | 374 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) && |
375 | tty->driver->unthrottle) | ||
379 | tty->driver->unthrottle(tty); | 376 | tty->driver->unthrottle(tty); |
380 | } | 377 | } |
381 | 378 | ||
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index e2d4beac7420..0801af4ad2b9 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -96,6 +96,9 @@ static struct usb_device_id bluetooth_ids[] = { | |||
96 | /* Ericsson with non-standard id */ | 96 | /* Ericsson with non-standard id */ |
97 | { USB_DEVICE(0x0bdb, 0x1002) }, | 97 | { USB_DEVICE(0x0bdb, 0x1002) }, |
98 | 98 | ||
99 | /* Canyon CN-BTU1 with HID interfaces */ | ||
100 | { USB_DEVICE(0x0c10, 0x0000), .driver_info = HCI_RESET }, | ||
101 | |||
99 | { } /* Terminating entry */ | 102 | { } /* Terminating entry */ |
100 | }; | 103 | }; |
101 | 104 | ||
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index aac67a3a6019..a278d98a9151 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -2,9 +2,9 @@ | |||
2 | * | 2 | * |
3 | * Bluetooth virtual HCI driver | 3 | * Bluetooth virtual HCI driver |
4 | * | 4 | * |
5 | * Copyright (C) 2000-2001 Qualcomm Incorporated | 5 | * Copyright (C) 2000-2001 Qualcomm Incorporated |
6 | * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> | 6 | * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> |
7 | * Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org> | 7 | * Copyright (C) 2004-2006 Marcel Holtmann <marcel@holtmann.org> |
8 | * | 8 | * |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
@@ -72,21 +72,21 @@ static int vhci_open_dev(struct hci_dev *hdev) | |||
72 | 72 | ||
73 | static int vhci_close_dev(struct hci_dev *hdev) | 73 | static int vhci_close_dev(struct hci_dev *hdev) |
74 | { | 74 | { |
75 | struct vhci_data *vhci = hdev->driver_data; | 75 | struct vhci_data *data = hdev->driver_data; |
76 | 76 | ||
77 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | 77 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
78 | return 0; | 78 | return 0; |
79 | 79 | ||
80 | skb_queue_purge(&vhci->readq); | 80 | skb_queue_purge(&data->readq); |
81 | 81 | ||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | static int vhci_flush(struct hci_dev *hdev) | 85 | static int vhci_flush(struct hci_dev *hdev) |
86 | { | 86 | { |
87 | struct vhci_data *vhci = hdev->driver_data; | 87 | struct vhci_data *data = hdev->driver_data; |
88 | 88 | ||
89 | skb_queue_purge(&vhci->readq); | 89 | skb_queue_purge(&data->readq); |
90 | 90 | ||
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
@@ -94,7 +94,7 @@ static int vhci_flush(struct hci_dev *hdev) | |||
94 | static int vhci_send_frame(struct sk_buff *skb) | 94 | static int vhci_send_frame(struct sk_buff *skb) |
95 | { | 95 | { |
96 | struct hci_dev* hdev = (struct hci_dev *) skb->dev; | 96 | struct hci_dev* hdev = (struct hci_dev *) skb->dev; |
97 | struct vhci_data *vhci; | 97 | struct vhci_data *data; |
98 | 98 | ||
99 | if (!hdev) { | 99 | if (!hdev) { |
100 | BT_ERR("Frame for unknown HCI device (hdev=NULL)"); | 100 | BT_ERR("Frame for unknown HCI device (hdev=NULL)"); |
@@ -104,15 +104,15 @@ static int vhci_send_frame(struct sk_buff *skb) | |||
104 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 104 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
105 | return -EBUSY; | 105 | return -EBUSY; |
106 | 106 | ||
107 | vhci = hdev->driver_data; | 107 | data = hdev->driver_data; |
108 | 108 | ||
109 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); | 109 | memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); |
110 | skb_queue_tail(&vhci->readq, skb); | 110 | skb_queue_tail(&data->readq, skb); |
111 | 111 | ||
112 | if (vhci->flags & VHCI_FASYNC) | 112 | if (data->flags & VHCI_FASYNC) |
113 | kill_fasync(&vhci->fasync, SIGIO, POLL_IN); | 113 | kill_fasync(&data->fasync, SIGIO, POLL_IN); |
114 | 114 | ||
115 | wake_up_interruptible(&vhci->read_wait); | 115 | wake_up_interruptible(&data->read_wait); |
116 | 116 | ||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
@@ -122,7 +122,7 @@ static void vhci_destruct(struct hci_dev *hdev) | |||
122 | kfree(hdev->driver_data); | 122 | kfree(hdev->driver_data); |
123 | } | 123 | } |
124 | 124 | ||
125 | static inline ssize_t vhci_get_user(struct vhci_data *vhci, | 125 | static inline ssize_t vhci_get_user(struct vhci_data *data, |
126 | const char __user *buf, size_t count) | 126 | const char __user *buf, size_t count) |
127 | { | 127 | { |
128 | struct sk_buff *skb; | 128 | struct sk_buff *skb; |
@@ -139,7 +139,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *vhci, | |||
139 | return -EFAULT; | 139 | return -EFAULT; |
140 | } | 140 | } |
141 | 141 | ||
142 | skb->dev = (void *) vhci->hdev; | 142 | skb->dev = (void *) data->hdev; |
143 | bt_cb(skb)->pkt_type = *((__u8 *) skb->data); | 143 | bt_cb(skb)->pkt_type = *((__u8 *) skb->data); |
144 | skb_pull(skb, 1); | 144 | skb_pull(skb, 1); |
145 | 145 | ||
@@ -148,7 +148,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *vhci, | |||
148 | return count; | 148 | return count; |
149 | } | 149 | } |
150 | 150 | ||
151 | static inline ssize_t vhci_put_user(struct vhci_data *vhci, | 151 | static inline ssize_t vhci_put_user(struct vhci_data *data, |
152 | struct sk_buff *skb, char __user *buf, int count) | 152 | struct sk_buff *skb, char __user *buf, int count) |
153 | { | 153 | { |
154 | char __user *ptr = buf; | 154 | char __user *ptr = buf; |
@@ -161,42 +161,43 @@ static inline ssize_t vhci_put_user(struct vhci_data *vhci, | |||
161 | 161 | ||
162 | total += len; | 162 | total += len; |
163 | 163 | ||
164 | vhci->hdev->stat.byte_tx += len; | 164 | data->hdev->stat.byte_tx += len; |
165 | 165 | ||
166 | switch (bt_cb(skb)->pkt_type) { | 166 | switch (bt_cb(skb)->pkt_type) { |
167 | case HCI_COMMAND_PKT: | 167 | case HCI_COMMAND_PKT: |
168 | vhci->hdev->stat.cmd_tx++; | 168 | data->hdev->stat.cmd_tx++; |
169 | break; | 169 | break; |
170 | 170 | ||
171 | case HCI_ACLDATA_PKT: | 171 | case HCI_ACLDATA_PKT: |
172 | vhci->hdev->stat.acl_tx++; | 172 | data->hdev->stat.acl_tx++; |
173 | break; | 173 | break; |
174 | 174 | ||
175 | case HCI_SCODATA_PKT: | 175 | case HCI_SCODATA_PKT: |
176 | vhci->hdev->stat.cmd_tx++; | 176 | data->hdev->stat.cmd_tx++; |
177 | break; | 177 | break; |
178 | }; | 178 | }; |
179 | 179 | ||
180 | return total; | 180 | return total; |
181 | } | 181 | } |
182 | 182 | ||
183 | static loff_t vhci_llseek(struct file * file, loff_t offset, int origin) | 183 | static loff_t vhci_llseek(struct file *file, loff_t offset, int origin) |
184 | { | 184 | { |
185 | return -ESPIPE; | 185 | return -ESPIPE; |
186 | } | 186 | } |
187 | 187 | ||
188 | static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, loff_t *pos) | 188 | static ssize_t vhci_read(struct file *file, |
189 | char __user *buf, size_t count, loff_t *pos) | ||
189 | { | 190 | { |
190 | DECLARE_WAITQUEUE(wait, current); | 191 | DECLARE_WAITQUEUE(wait, current); |
191 | struct vhci_data *vhci = file->private_data; | 192 | struct vhci_data *data = file->private_data; |
192 | struct sk_buff *skb; | 193 | struct sk_buff *skb; |
193 | ssize_t ret = 0; | 194 | ssize_t ret = 0; |
194 | 195 | ||
195 | add_wait_queue(&vhci->read_wait, &wait); | 196 | add_wait_queue(&data->read_wait, &wait); |
196 | while (count) { | 197 | while (count) { |
197 | set_current_state(TASK_INTERRUPTIBLE); | 198 | set_current_state(TASK_INTERRUPTIBLE); |
198 | 199 | ||
199 | skb = skb_dequeue(&vhci->readq); | 200 | skb = skb_dequeue(&data->readq); |
200 | if (!skb) { | 201 | if (!skb) { |
201 | if (file->f_flags & O_NONBLOCK) { | 202 | if (file->f_flags & O_NONBLOCK) { |
202 | ret = -EAGAIN; | 203 | ret = -EAGAIN; |
@@ -213,7 +214,7 @@ static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, lo | |||
213 | } | 214 | } |
214 | 215 | ||
215 | if (access_ok(VERIFY_WRITE, buf, count)) | 216 | if (access_ok(VERIFY_WRITE, buf, count)) |
216 | ret = vhci_put_user(vhci, skb, buf, count); | 217 | ret = vhci_put_user(data, skb, buf, count); |
217 | else | 218 | else |
218 | ret = -EFAULT; | 219 | ret = -EFAULT; |
219 | 220 | ||
@@ -221,7 +222,7 @@ static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, lo | |||
221 | break; | 222 | break; |
222 | } | 223 | } |
223 | set_current_state(TASK_RUNNING); | 224 | set_current_state(TASK_RUNNING); |
224 | remove_wait_queue(&vhci->read_wait, &wait); | 225 | remove_wait_queue(&data->read_wait, &wait); |
225 | 226 | ||
226 | return ret; | 227 | return ret; |
227 | } | 228 | } |
@@ -229,21 +230,21 @@ static ssize_t vhci_read(struct file * file, char __user * buf, size_t count, lo | |||
229 | static ssize_t vhci_write(struct file *file, | 230 | static ssize_t vhci_write(struct file *file, |
230 | const char __user *buf, size_t count, loff_t *pos) | 231 | const char __user *buf, size_t count, loff_t *pos) |
231 | { | 232 | { |
232 | struct vhci_data *vhci = file->private_data; | 233 | struct vhci_data *data = file->private_data; |
233 | 234 | ||
234 | if (!access_ok(VERIFY_READ, buf, count)) | 235 | if (!access_ok(VERIFY_READ, buf, count)) |
235 | return -EFAULT; | 236 | return -EFAULT; |
236 | 237 | ||
237 | return vhci_get_user(vhci, buf, count); | 238 | return vhci_get_user(data, buf, count); |
238 | } | 239 | } |
239 | 240 | ||
240 | static unsigned int vhci_poll(struct file *file, poll_table *wait) | 241 | static unsigned int vhci_poll(struct file *file, poll_table *wait) |
241 | { | 242 | { |
242 | struct vhci_data *vhci = file->private_data; | 243 | struct vhci_data *data = file->private_data; |
243 | 244 | ||
244 | poll_wait(file, &vhci->read_wait, wait); | 245 | poll_wait(file, &data->read_wait, wait); |
245 | 246 | ||
246 | if (!skb_queue_empty(&vhci->readq)) | 247 | if (!skb_queue_empty(&data->readq)) |
247 | return POLLIN | POLLRDNORM; | 248 | return POLLIN | POLLRDNORM; |
248 | 249 | ||
249 | return POLLOUT | POLLWRNORM; | 250 | return POLLOUT | POLLWRNORM; |
@@ -257,26 +258,26 @@ static int vhci_ioctl(struct inode *inode, struct file *file, | |||
257 | 258 | ||
258 | static int vhci_open(struct inode *inode, struct file *file) | 259 | static int vhci_open(struct inode *inode, struct file *file) |
259 | { | 260 | { |
260 | struct vhci_data *vhci; | 261 | struct vhci_data *data; |
261 | struct hci_dev *hdev; | 262 | struct hci_dev *hdev; |
262 | 263 | ||
263 | vhci = kzalloc(sizeof(struct vhci_data), GFP_KERNEL); | 264 | data = kzalloc(sizeof(struct vhci_data), GFP_KERNEL); |
264 | if (!vhci) | 265 | if (!data) |
265 | return -ENOMEM; | 266 | return -ENOMEM; |
266 | 267 | ||
267 | skb_queue_head_init(&vhci->readq); | 268 | skb_queue_head_init(&data->readq); |
268 | init_waitqueue_head(&vhci->read_wait); | 269 | init_waitqueue_head(&data->read_wait); |
269 | 270 | ||
270 | hdev = hci_alloc_dev(); | 271 | hdev = hci_alloc_dev(); |
271 | if (!hdev) { | 272 | if (!hdev) { |
272 | kfree(vhci); | 273 | kfree(data); |
273 | return -ENOMEM; | 274 | return -ENOMEM; |
274 | } | 275 | } |
275 | 276 | ||
276 | vhci->hdev = hdev; | 277 | data->hdev = hdev; |
277 | 278 | ||
278 | hdev->type = HCI_VHCI; | 279 | hdev->type = HCI_VIRTUAL; |
279 | hdev->driver_data = vhci; | 280 | hdev->driver_data = data; |
280 | 281 | ||
281 | hdev->open = vhci_open_dev; | 282 | hdev->open = vhci_open_dev; |
282 | hdev->close = vhci_close_dev; | 283 | hdev->close = vhci_close_dev; |
@@ -288,20 +289,20 @@ static int vhci_open(struct inode *inode, struct file *file) | |||
288 | 289 | ||
289 | if (hci_register_dev(hdev) < 0) { | 290 | if (hci_register_dev(hdev) < 0) { |
290 | BT_ERR("Can't register HCI device"); | 291 | BT_ERR("Can't register HCI device"); |
291 | kfree(vhci); | 292 | kfree(data); |
292 | hci_free_dev(hdev); | 293 | hci_free_dev(hdev); |
293 | return -EBUSY; | 294 | return -EBUSY; |
294 | } | 295 | } |
295 | 296 | ||
296 | file->private_data = vhci; | 297 | file->private_data = data; |
297 | 298 | ||
298 | return nonseekable_open(inode, file); | 299 | return nonseekable_open(inode, file); |
299 | } | 300 | } |
300 | 301 | ||
301 | static int vhci_release(struct inode *inode, struct file *file) | 302 | static int vhci_release(struct inode *inode, struct file *file) |
302 | { | 303 | { |
303 | struct vhci_data *vhci = file->private_data; | 304 | struct vhci_data *data = file->private_data; |
304 | struct hci_dev *hdev = vhci->hdev; | 305 | struct hci_dev *hdev = data->hdev; |
305 | 306 | ||
306 | if (hci_unregister_dev(hdev) < 0) { | 307 | if (hci_unregister_dev(hdev) < 0) { |
307 | BT_ERR("Can't unregister HCI device %s", hdev->name); | 308 | BT_ERR("Can't unregister HCI device %s", hdev->name); |
@@ -316,17 +317,17 @@ static int vhci_release(struct inode *inode, struct file *file) | |||
316 | 317 | ||
317 | static int vhci_fasync(int fd, struct file *file, int on) | 318 | static int vhci_fasync(int fd, struct file *file, int on) |
318 | { | 319 | { |
319 | struct vhci_data *vhci = file->private_data; | 320 | struct vhci_data *data = file->private_data; |
320 | int err; | 321 | int err; |
321 | 322 | ||
322 | err = fasync_helper(fd, file, on, &vhci->fasync); | 323 | err = fasync_helper(fd, file, on, &data->fasync); |
323 | if (err < 0) | 324 | if (err < 0) |
324 | return err; | 325 | return err; |
325 | 326 | ||
326 | if (on) | 327 | if (on) |
327 | vhci->flags |= VHCI_FASYNC; | 328 | data->flags |= VHCI_FASYNC; |
328 | else | 329 | else |
329 | vhci->flags &= ~VHCI_FASYNC; | 330 | data->flags &= ~VHCI_FASYNC; |
330 | 331 | ||
331 | return 0; | 332 | return 0; |
332 | } | 333 | } |
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 9cbf09e2052f..60d3fbdd216c 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(rdma_copy_addr); | |||
86 | int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) | 86 | int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) |
87 | { | 87 | { |
88 | struct net_device *dev; | 88 | struct net_device *dev; |
89 | u32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr; | 89 | __be32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr; |
90 | int ret; | 90 | int ret; |
91 | 91 | ||
92 | dev = ip_dev_find(ip); | 92 | dev = ip_dev_find(ip); |
@@ -239,7 +239,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in, | |||
239 | { | 239 | { |
240 | struct net_device *dev; | 240 | struct net_device *dev; |
241 | u32 src_ip = src_in->sin_addr.s_addr; | 241 | u32 src_ip = src_in->sin_addr.s_addr; |
242 | u32 dst_ip = dst_in->sin_addr.s_addr; | 242 | __be32 dst_ip = dst_in->sin_addr.s_addr; |
243 | int ret; | 243 | int ret; |
244 | 244 | ||
245 | dev = ip_dev_find(dst_ip); | 245 | dev = ip_dev_find(dst_ip); |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 43da8ae1b2ad..1f8d6ae66b41 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -1614,8 +1614,8 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) | |||
1614 | struct sk_buff *skb; | 1614 | struct sk_buff *skb; |
1615 | unsigned char *p; | 1615 | unsigned char *p; |
1616 | struct in_device *in_dev = NULL; | 1616 | struct in_device *in_dev = NULL; |
1617 | u32 addr = 0; /* local ipv4 address */ | 1617 | __be32 addr = 0; /* local ipv4 address */ |
1618 | u32 mask = 0; /* local netmask */ | 1618 | __be32 mask = 0; /* local netmask */ |
1619 | 1619 | ||
1620 | if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) { | 1620 | if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) { |
1621 | /* take primary(first) address of interface */ | 1621 | /* take primary(first) address of interface */ |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 63154774c257..ff8a8c0a26d5 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -24,6 +24,9 @@ config NETDEVICES | |||
24 | 24 | ||
25 | If unsure, say Y. | 25 | If unsure, say Y. |
26 | 26 | ||
27 | # All the following symbols are dependent on NETDEVICES - do not repeat | ||
28 | # that for each of the symbols. | ||
29 | if NETDEVICES | ||
27 | 30 | ||
28 | config IFB | 31 | config IFB |
29 | tristate "Intermediate Functional Block support" | 32 | tristate "Intermediate Functional Block support" |
@@ -2852,6 +2855,8 @@ config NETCONSOLE | |||
2852 | If you want to log kernel messages over the network, enable this. | 2855 | If you want to log kernel messages over the network, enable this. |
2853 | See <file:Documentation/networking/netconsole.txt> for details. | 2856 | See <file:Documentation/networking/netconsole.txt> for details. |
2854 | 2857 | ||
2858 | endif #NETDEVICES | ||
2859 | |||
2855 | config NETPOLL | 2860 | config NETPOLL |
2856 | def_bool NETCONSOLE | 2861 | def_bool NETCONSOLE |
2857 | 2862 | ||
diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index 7f7dd450226a..b98592a8bac8 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c | |||
@@ -145,9 +145,7 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev) | |||
145 | 145 | ||
146 | /* Create the Extended DDP header */ | 146 | /* Create the Extended DDP header */ |
147 | ddp = (struct ddpehdr *)skb->data; | 147 | ddp = (struct ddpehdr *)skb->data; |
148 | ddp->deh_len = skb->len; | 148 | ddp->deh_len_hops = htons(skb->len + (1<<10)); |
149 | ddp->deh_hops = 1; | ||
150 | ddp->deh_pad = 0; | ||
151 | ddp->deh_sum = 0; | 149 | ddp->deh_sum = 0; |
152 | 150 | ||
153 | /* | 151 | /* |
@@ -170,7 +168,6 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev) | |||
170 | ddp->deh_sport = 72; | 168 | ddp->deh_sport = 72; |
171 | 169 | ||
172 | *((__u8 *)(ddp+1)) = 22; /* ddp type = IP */ | 170 | *((__u8 *)(ddp+1)) = 22; /* ddp type = IP */ |
173 | *((__u16 *)ddp)=ntohs(*((__u16 *)ddp)); /* fix up length field */ | ||
174 | 171 | ||
175 | skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */ | 172 | skb->protocol = htons(ETH_P_ATALK); /* Protocol has changed */ |
176 | 173 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 0fb5f653d3ce..c0bbddae4ec4 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2252,7 +2252,7 @@ static u32 bond_glean_dev_ip(struct net_device *dev) | |||
2252 | { | 2252 | { |
2253 | struct in_device *idev; | 2253 | struct in_device *idev; |
2254 | struct in_ifaddr *ifa; | 2254 | struct in_ifaddr *ifa; |
2255 | u32 addr = 0; | 2255 | __be32 addr = 0; |
2256 | 2256 | ||
2257 | if (!dev) | 2257 | if (!dev) |
2258 | return 0; | 2258 | return 0; |
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index e9e6d99a9add..7c8ccc09b601 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig | |||
@@ -287,6 +287,7 @@ comment "FIR device drivers" | |||
287 | config USB_IRDA | 287 | config USB_IRDA |
288 | tristate "IrDA USB dongles" | 288 | tristate "IrDA USB dongles" |
289 | depends on IRDA && USB | 289 | depends on IRDA && USB |
290 | select FW_LOADER | ||
290 | ---help--- | 291 | ---help--- |
291 | Say Y here if you want to build support for the USB IrDA FIR Dongle | 292 | Say Y here if you want to build support for the USB IrDA FIR Dongle |
292 | device driver. To compile it as a module, choose M here: the module | 293 | device driver. To compile it as a module, choose M here: the module |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index cb62f2a9676a..7185a4ee3c1e 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -110,7 +110,7 @@ static nsc_chip_t chips[] = { | |||
110 | { "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf8, | 110 | { "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf8, |
111 | nsc_ircc_probe_338, nsc_ircc_init_338 }, | 111 | nsc_ircc_probe_338, nsc_ircc_init_338 }, |
112 | /* Contributed by Steffen Pingel - IBM X40 */ | 112 | /* Contributed by Steffen Pingel - IBM X40 */ |
113 | { "PC8738x", { 0x164e, 0x4e, 0x0 }, 0x20, 0xf4, 0xff, | 113 | { "PC8738x", { 0x164e, 0x4e, 0x2e }, 0x20, 0xf4, 0xff, |
114 | nsc_ircc_probe_39x, nsc_ircc_init_39x }, | 114 | nsc_ircc_probe_39x, nsc_ircc_init_39x }, |
115 | /* Contributed by Jan Frey - IBM A30/A31 */ | 115 | /* Contributed by Jan Frey - IBM A30/A31 */ |
116 | { "PC8739x", { 0x2e, 0x4e, 0x0 }, 0x20, 0xea, 0xff, | 116 | { "PC8739x", { 0x2e, 0x4e, 0x0 }, 0x20, 0xea, 0xff, |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 2eff45bedc7c..22358ff68c4c 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -2354,6 +2354,26 @@ static int __init smsc_superio_lpc(unsigned short cfg_base) | |||
2354 | #define PCIID_VENDOR_INTEL 0x8086 | 2354 | #define PCIID_VENDOR_INTEL 0x8086 |
2355 | #define PCIID_VENDOR_ALI 0x10b9 | 2355 | #define PCIID_VENDOR_ALI 0x10b9 |
2356 | static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = { | 2356 | static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = { |
2357 | /* | ||
2358 | * Subsystems needing entries: | ||
2359 | * 0x10b9:0x1533 0x103c:0x0850 HP nx9010 family | ||
2360 | * 0x10b9:0x1533 0x0e11:0x005a Compaq nc4000 family | ||
2361 | * 0x8086:0x24cc 0x0e11:0x002a HP nx9000 family | ||
2362 | */ | ||
2363 | { | ||
2364 | /* Guessed entry */ | ||
2365 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ | ||
2366 | .device = 0x24cc, | ||
2367 | .subvendor = 0x103c, | ||
2368 | .subdevice = 0x08bc, | ||
2369 | .sir_io = 0x02f8, | ||
2370 | .fir_io = 0x0130, | ||
2371 | .fir_irq = 0x05, | ||
2372 | .fir_dma = 0x03, | ||
2373 | .cfg_base = 0x004e, | ||
2374 | .preconfigure = preconfigure_through_82801, | ||
2375 | .name = "HP nx5000 family", | ||
2376 | }, | ||
2357 | { | 2377 | { |
2358 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ | 2378 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ |
2359 | .device = 0x24cc, | 2379 | .device = 0x24cc, |
@@ -2366,7 +2386,7 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini | |||
2366 | .fir_dma = 0x03, | 2386 | .fir_dma = 0x03, |
2367 | .cfg_base = 0x004e, | 2387 | .cfg_base = 0x004e, |
2368 | .preconfigure = preconfigure_through_82801, | 2388 | .preconfigure = preconfigure_through_82801, |
2369 | .name = "HP nc8000", | 2389 | .name = "HP nc8000 family", |
2370 | }, | 2390 | }, |
2371 | { | 2391 | { |
2372 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ | 2392 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ |
@@ -2379,7 +2399,21 @@ static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __ini | |||
2379 | .fir_dma = 0x03, | 2399 | .fir_dma = 0x03, |
2380 | .cfg_base = 0x004e, | 2400 | .cfg_base = 0x004e, |
2381 | .preconfigure = preconfigure_through_82801, | 2401 | .preconfigure = preconfigure_through_82801, |
2382 | .name = "HP nc6000", | 2402 | .name = "HP nc6000 family", |
2403 | }, | ||
2404 | { | ||
2405 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ | ||
2406 | .device = 0x24cc, | ||
2407 | .subvendor = 0x0e11, | ||
2408 | .subdevice = 0x0860, | ||
2409 | /* I assume these are the same for x1000 as for the others */ | ||
2410 | .sir_io = 0x02e8, | ||
2411 | .fir_io = 0x02f8, | ||
2412 | .fir_irq = 0x07, | ||
2413 | .fir_dma = 0x03, | ||
2414 | .cfg_base = 0x002e, | ||
2415 | .preconfigure = preconfigure_through_82801, | ||
2416 | .name = "Compaq x1000 family", | ||
2383 | }, | 2417 | }, |
2384 | { | 2418 | { |
2385 | /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ | 2419 | /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ |
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index d61b208b52a2..12103c93f7ef 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -149,8 +149,6 @@ enum StirFifoCtlMask { | |||
149 | FIFOCTL_DIR = 0x10, | 149 | FIFOCTL_DIR = 0x10, |
150 | FIFOCTL_CLR = 0x08, | 150 | FIFOCTL_CLR = 0x08, |
151 | FIFOCTL_EMPTY = 0x04, | 151 | FIFOCTL_EMPTY = 0x04, |
152 | FIFOCTL_RXERR = 0x02, | ||
153 | FIFOCTL_TXERR = 0x01, | ||
154 | }; | 152 | }; |
155 | 153 | ||
156 | enum StirDiagMask { | 154 | enum StirDiagMask { |
@@ -615,19 +613,6 @@ static int fifo_txwait(struct stir_cb *stir, int space) | |||
615 | 613 | ||
616 | pr_debug("fifo status 0x%lx count %lu\n", status, count); | 614 | pr_debug("fifo status 0x%lx count %lu\n", status, count); |
617 | 615 | ||
618 | /* error when receive/transmit fifo gets confused */ | ||
619 | if (status & FIFOCTL_RXERR) { | ||
620 | stir->stats.rx_fifo_errors++; | ||
621 | stir->stats.rx_errors++; | ||
622 | break; | ||
623 | } | ||
624 | |||
625 | if (status & FIFOCTL_TXERR) { | ||
626 | stir->stats.tx_fifo_errors++; | ||
627 | stir->stats.tx_errors++; | ||
628 | break; | ||
629 | } | ||
630 | |||
631 | /* is fifo receiving already, or empty */ | 616 | /* is fifo receiving already, or empty */ |
632 | if (!(status & FIFOCTL_DIR) | 617 | if (!(status & FIFOCTL_DIR) |
633 | || (status & FIFOCTL_EMPTY)) | 618 | || (status & FIFOCTL_EMPTY)) |
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 79b85f327500..d916e1257c47 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c | |||
@@ -1223,8 +1223,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) | |||
1223 | 1223 | ||
1224 | IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len); | 1224 | IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len); |
1225 | 1225 | ||
1226 | if ((len - 4) < 2) { | ||
1227 | self->stats.rx_dropped++; | ||
1228 | return FALSE; | ||
1229 | } | ||
1230 | |||
1226 | skb = dev_alloc_skb(len + 1); | 1231 | skb = dev_alloc_skb(len + 1); |
1227 | if ((skb == NULL) || ((len - 4) < 2)) { | 1232 | if (skb == NULL) { |
1228 | self->stats.rx_dropped++; | 1233 | self->stats.rx_dropped++; |
1229 | return FALSE; | 1234 | return FALSE; |
1230 | } | 1235 | } |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index f429b19bf620..4178b4b1d2df 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -161,15 +161,13 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
161 | return(0); | 161 | return(0); |
162 | } | 162 | } |
163 | 163 | ||
164 | static struct net_device_stats loopback_stats; | ||
165 | |||
164 | static struct net_device_stats *get_stats(struct net_device *dev) | 166 | static struct net_device_stats *get_stats(struct net_device *dev) |
165 | { | 167 | { |
166 | struct net_device_stats *stats = dev->priv; | 168 | struct net_device_stats *stats = &loopback_stats; |
167 | int i; | 169 | int i; |
168 | 170 | ||
169 | if (!stats) { | ||
170 | return NULL; | ||
171 | } | ||
172 | |||
173 | memset(stats, 0, sizeof(struct net_device_stats)); | 171 | memset(stats, 0, sizeof(struct net_device_stats)); |
174 | 172 | ||
175 | for_each_possible_cpu(i) { | 173 | for_each_possible_cpu(i) { |
@@ -185,19 +183,28 @@ static struct net_device_stats *get_stats(struct net_device *dev) | |||
185 | return stats; | 183 | return stats; |
186 | } | 184 | } |
187 | 185 | ||
188 | static u32 loopback_get_link(struct net_device *dev) | 186 | static u32 always_on(struct net_device *dev) |
189 | { | 187 | { |
190 | return 1; | 188 | return 1; |
191 | } | 189 | } |
192 | 190 | ||
193 | static const struct ethtool_ops loopback_ethtool_ops = { | 191 | static const struct ethtool_ops loopback_ethtool_ops = { |
194 | .get_link = loopback_get_link, | 192 | .get_link = always_on, |
195 | .get_tso = ethtool_op_get_tso, | 193 | .get_tso = ethtool_op_get_tso, |
196 | .set_tso = ethtool_op_set_tso, | 194 | .set_tso = ethtool_op_set_tso, |
195 | .get_tx_csum = always_on, | ||
196 | .get_sg = always_on, | ||
197 | .get_rx_csum = always_on, | ||
197 | }; | 198 | }; |
198 | 199 | ||
200 | /* | ||
201 | * The loopback device is special. There is only one instance and | ||
202 | * it is statically allocated. Don't do this for other devices. | ||
203 | */ | ||
199 | struct net_device loopback_dev = { | 204 | struct net_device loopback_dev = { |
200 | .name = "lo", | 205 | .name = "lo", |
206 | .get_stats = &get_stats, | ||
207 | .priv = &loopback_stats, | ||
201 | .mtu = (16 * 1024) + 20 + 20 + 12, | 208 | .mtu = (16 * 1024) + 20 + 20 + 12, |
202 | .hard_start_xmit = loopback_xmit, | 209 | .hard_start_xmit = loopback_xmit, |
203 | .hard_header = eth_header, | 210 | .hard_header = eth_header, |
@@ -221,16 +228,6 @@ struct net_device loopback_dev = { | |||
221 | /* Setup and register the loopback device. */ | 228 | /* Setup and register the loopback device. */ |
222 | int __init loopback_init(void) | 229 | int __init loopback_init(void) |
223 | { | 230 | { |
224 | struct net_device_stats *stats; | ||
225 | |||
226 | /* Can survive without statistics */ | ||
227 | stats = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL); | ||
228 | if (stats) { | ||
229 | memset(stats, 0, sizeof(struct net_device_stats)); | ||
230 | loopback_dev.priv = stats; | ||
231 | loopback_dev.get_stats = &get_stats; | ||
232 | } | ||
233 | |||
234 | return register_netdev(&loopback_dev); | 231 | return register_netdev(&loopback_dev); |
235 | }; | 232 | }; |
236 | 233 | ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 5666ed998142..0adee733b761 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -600,6 +600,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
600 | po->chan.hdrlen = (sizeof(struct pppoe_hdr) + | 600 | po->chan.hdrlen = (sizeof(struct pppoe_hdr) + |
601 | dev->hard_header_len); | 601 | dev->hard_header_len); |
602 | 602 | ||
603 | po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr); | ||
603 | po->chan.private = sk; | 604 | po->chan.private = sk; |
604 | po->chan.ops = &pppoe_chan_ops; | 605 | po->chan.ops = &pppoe_chan_ops; |
605 | 606 | ||
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index aaf45b907a78..c25ba273b745 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -68,8 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_MODULE_NAME "tg3" | 69 | #define DRV_MODULE_NAME "tg3" |
70 | #define PFX DRV_MODULE_NAME ": " | 70 | #define PFX DRV_MODULE_NAME ": " |
71 | #define DRV_MODULE_VERSION "3.65" | 71 | #define DRV_MODULE_VERSION "3.66" |
72 | #define DRV_MODULE_RELDATE "August 07, 2006" | 72 | #define DRV_MODULE_RELDATE "September 23, 2006" |
73 | 73 | ||
74 | #define TG3_DEF_MAC_MODE 0 | 74 | #define TG3_DEF_MAC_MODE 0 |
75 | #define TG3_DEF_RX_MODE 0 | 75 | #define TG3_DEF_RX_MODE 0 |
@@ -173,6 +173,7 @@ static struct pci_device_id tg3_pci_tbl[] = { | |||
173 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705F)}, | 173 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705F)}, |
174 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5720)}, | 174 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5720)}, |
175 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5721)}, | 175 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5721)}, |
176 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5722)}, | ||
176 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750)}, | 177 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750)}, |
177 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751)}, | 178 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751)}, |
178 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750M)}, | 179 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750M)}, |
@@ -187,6 +188,7 @@ static struct pci_device_id tg3_pci_tbl[] = { | |||
187 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5754M)}, | 188 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5754M)}, |
188 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755)}, | 189 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755)}, |
189 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M)}, | 190 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5755M)}, |
191 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5756)}, | ||
190 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)}, | 192 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5786)}, |
191 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)}, | 193 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787)}, |
192 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)}, | 194 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5787M)}, |
@@ -197,6 +199,8 @@ static struct pci_device_id tg3_pci_tbl[] = { | |||
197 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780)}, | 199 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780)}, |
198 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780S)}, | 200 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780S)}, |
199 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781)}, | 201 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781)}, |
202 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906)}, | ||
203 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5906M)}, | ||
200 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, | 204 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, |
201 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, | 205 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, |
202 | {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, | 206 | {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, |
@@ -424,6 +428,16 @@ static void tg3_write32_tx_mbox(struct tg3 *tp, u32 off, u32 val) | |||
424 | readl(mbox); | 428 | readl(mbox); |
425 | } | 429 | } |
426 | 430 | ||
431 | static u32 tg3_read32_mbox_5906(struct tg3 *tp, u32 off) | ||
432 | { | ||
433 | return (readl(tp->regs + off + GRCMBOX_BASE)); | ||
434 | } | ||
435 | |||
436 | static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val) | ||
437 | { | ||
438 | writel(val, tp->regs + off + GRCMBOX_BASE); | ||
439 | } | ||
440 | |||
427 | #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) | 441 | #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) |
428 | #define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) | 442 | #define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) |
429 | #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) | 443 | #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) |
@@ -439,6 +453,10 @@ static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) | |||
439 | { | 453 | { |
440 | unsigned long flags; | 454 | unsigned long flags; |
441 | 455 | ||
456 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) && | ||
457 | (off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC)) | ||
458 | return; | ||
459 | |||
442 | spin_lock_irqsave(&tp->indirect_lock, flags); | 460 | spin_lock_irqsave(&tp->indirect_lock, flags); |
443 | if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) { | 461 | if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) { |
444 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | 462 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
@@ -460,6 +478,12 @@ static void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val) | |||
460 | { | 478 | { |
461 | unsigned long flags; | 479 | unsigned long flags; |
462 | 480 | ||
481 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) && | ||
482 | (off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC)) { | ||
483 | *val = 0; | ||
484 | return; | ||
485 | } | ||
486 | |||
463 | spin_lock_irqsave(&tp->indirect_lock, flags); | 487 | spin_lock_irqsave(&tp->indirect_lock, flags); |
464 | if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) { | 488 | if (tp->tg3_flags & TG3_FLAG_SRAM_USE_CONFIG) { |
465 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); | 489 | pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, off); |
@@ -489,6 +513,9 @@ static inline void tg3_cond_int(struct tg3 *tp) | |||
489 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) && | 513 | if (!(tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) && |
490 | (tp->hw_status->status & SD_STATUS_UPDATED)) | 514 | (tp->hw_status->status & SD_STATUS_UPDATED)) |
491 | tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); | 515 | tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT); |
516 | else | ||
517 | tw32(HOSTCC_MODE, tp->coalesce_mode | | ||
518 | (HOSTCC_MODE_ENABLE | HOSTCC_MODE_NOW)); | ||
492 | } | 519 | } |
493 | 520 | ||
494 | static void tg3_enable_ints(struct tg3 *tp) | 521 | static void tg3_enable_ints(struct tg3 *tp) |
@@ -654,6 +681,10 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val) | |||
654 | unsigned int loops; | 681 | unsigned int loops; |
655 | int ret; | 682 | int ret; |
656 | 683 | ||
684 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 && | ||
685 | (reg == MII_TG3_CTRL || reg == MII_TG3_AUX_CTRL)) | ||
686 | return 0; | ||
687 | |||
657 | if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) { | 688 | if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) { |
658 | tw32_f(MAC_MI_MODE, | 689 | tw32_f(MAC_MI_MODE, |
659 | (tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL)); | 690 | (tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL)); |
@@ -1004,6 +1035,24 @@ out: | |||
1004 | phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC); | 1035 | phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC); |
1005 | } | 1036 | } |
1006 | 1037 | ||
1038 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
1039 | u32 phy_reg; | ||
1040 | |||
1041 | /* adjust output voltage */ | ||
1042 | tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x12); | ||
1043 | |||
1044 | if (!tg3_readphy(tp, MII_TG3_EPHY_TEST, &phy_reg)) { | ||
1045 | u32 phy_reg2; | ||
1046 | |||
1047 | tg3_writephy(tp, MII_TG3_EPHY_TEST, | ||
1048 | phy_reg | MII_TG3_EPHY_SHADOW_EN); | ||
1049 | /* Enable auto-MDIX */ | ||
1050 | if (!tg3_readphy(tp, 0x10, &phy_reg2)) | ||
1051 | tg3_writephy(tp, 0x10, phy_reg2 | 0x4000); | ||
1052 | tg3_writephy(tp, MII_TG3_EPHY_TEST, phy_reg); | ||
1053 | } | ||
1054 | } | ||
1055 | |||
1007 | tg3_phy_set_wirespeed(tp); | 1056 | tg3_phy_set_wirespeed(tp); |
1008 | return 0; | 1057 | return 0; |
1009 | } | 1058 | } |
@@ -1117,6 +1166,15 @@ static void tg3_nvram_unlock(struct tg3 *); | |||
1117 | 1166 | ||
1118 | static void tg3_power_down_phy(struct tg3 *tp) | 1167 | static void tg3_power_down_phy(struct tg3 *tp) |
1119 | { | 1168 | { |
1169 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) | ||
1170 | return; | ||
1171 | |||
1172 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) { | ||
1173 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | ||
1174 | MII_TG3_EXT_CTRL_FORCE_LED_OFF); | ||
1175 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2); | ||
1176 | } | ||
1177 | |||
1120 | /* The PHY should not be powered down on some chips because | 1178 | /* The PHY should not be powered down on some chips because |
1121 | * of bugs. | 1179 | * of bugs. |
1122 | */ | 1180 | */ |
@@ -1199,7 +1257,12 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1199 | tg3_setup_phy(tp, 0); | 1257 | tg3_setup_phy(tp, 0); |
1200 | } | 1258 | } |
1201 | 1259 | ||
1202 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | 1260 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
1261 | u32 val; | ||
1262 | |||
1263 | val = tr32(GRC_VCPU_EXT_CTRL); | ||
1264 | tw32(GRC_VCPU_EXT_CTRL, val | GRC_VCPU_EXT_CTRL_DISABLE_WOL); | ||
1265 | } else if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | ||
1203 | int i; | 1266 | int i; |
1204 | u32 val; | 1267 | u32 val; |
1205 | 1268 | ||
@@ -1223,7 +1286,10 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1223 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a); | 1286 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x5a); |
1224 | udelay(40); | 1287 | udelay(40); |
1225 | 1288 | ||
1226 | mac_mode = MAC_MODE_PORT_MODE_MII; | 1289 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) |
1290 | mac_mode = MAC_MODE_PORT_MODE_GMII; | ||
1291 | else | ||
1292 | mac_mode = MAC_MODE_PORT_MODE_MII; | ||
1227 | 1293 | ||
1228 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 || | 1294 | if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 || |
1229 | !(tp->tg3_flags & TG3_FLAG_WOL_SPEED_100MB)) | 1295 | !(tp->tg3_flags & TG3_FLAG_WOL_SPEED_100MB)) |
@@ -1301,15 +1367,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1301 | } | 1367 | } |
1302 | 1368 | ||
1303 | if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) && | 1369 | if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) && |
1304 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { | 1370 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) |
1305 | /* Turn off the PHY */ | 1371 | tg3_power_down_phy(tp); |
1306 | if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { | ||
1307 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | ||
1308 | MII_TG3_EXT_CTRL_FORCE_LED_OFF); | ||
1309 | tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2); | ||
1310 | tg3_power_down_phy(tp); | ||
1311 | } | ||
1312 | } | ||
1313 | 1372 | ||
1314 | tg3_frob_aux_power(tp); | 1373 | tg3_frob_aux_power(tp); |
1315 | 1374 | ||
@@ -1467,6 +1526,13 @@ static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 | |||
1467 | break; | 1526 | break; |
1468 | 1527 | ||
1469 | default: | 1528 | default: |
1529 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
1530 | *speed = (val & MII_TG3_AUX_STAT_100) ? SPEED_100 : | ||
1531 | SPEED_10; | ||
1532 | *duplex = (val & MII_TG3_AUX_STAT_FULL) ? DUPLEX_FULL : | ||
1533 | DUPLEX_HALF; | ||
1534 | break; | ||
1535 | } | ||
1470 | *speed = SPEED_INVALID; | 1536 | *speed = SPEED_INVALID; |
1471 | *duplex = DUPLEX_INVALID; | 1537 | *duplex = DUPLEX_INVALID; |
1472 | break; | 1538 | break; |
@@ -1749,7 +1815,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) | |||
1749 | 1815 | ||
1750 | if (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) | 1816 | if (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) |
1751 | tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG); | 1817 | tg3_writephy(tp, MII_TG3_IMASK, ~MII_TG3_INT_LINKCHG); |
1752 | else | 1818 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) |
1753 | tg3_writephy(tp, MII_TG3_IMASK, ~0); | 1819 | tg3_writephy(tp, MII_TG3_IMASK, ~0); |
1754 | 1820 | ||
1755 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || | 1821 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || |
@@ -2406,24 +2472,27 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2406 | expected_sg_dig_ctrl |= (1 << 12); | 2472 | expected_sg_dig_ctrl |= (1 << 12); |
2407 | 2473 | ||
2408 | if (sg_dig_ctrl != expected_sg_dig_ctrl) { | 2474 | if (sg_dig_ctrl != expected_sg_dig_ctrl) { |
2475 | if ((tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && | ||
2476 | tp->serdes_counter && | ||
2477 | ((mac_status & (MAC_STATUS_PCS_SYNCED | | ||
2478 | MAC_STATUS_RCVD_CFG)) == | ||
2479 | MAC_STATUS_PCS_SYNCED)) { | ||
2480 | tp->serdes_counter--; | ||
2481 | current_link_up = 1; | ||
2482 | goto out; | ||
2483 | } | ||
2484 | restart_autoneg: | ||
2409 | if (workaround) | 2485 | if (workaround) |
2410 | tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000); | 2486 | tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000); |
2411 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1 << 30)); | 2487 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1 << 30)); |
2412 | udelay(5); | 2488 | udelay(5); |
2413 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl); | 2489 | tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl); |
2414 | 2490 | ||
2415 | tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED; | 2491 | tp->serdes_counter = SERDES_AN_TIMEOUT_5704S; |
2492 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; | ||
2416 | } else if (mac_status & (MAC_STATUS_PCS_SYNCED | | 2493 | } else if (mac_status & (MAC_STATUS_PCS_SYNCED | |
2417 | MAC_STATUS_SIGNAL_DET)) { | 2494 | MAC_STATUS_SIGNAL_DET)) { |
2418 | int i; | 2495 | sg_dig_status = tr32(SG_DIG_STATUS); |
2419 | |||
2420 | /* Giver time to negotiate (~200ms) */ | ||
2421 | for (i = 0; i < 40000; i++) { | ||
2422 | sg_dig_status = tr32(SG_DIG_STATUS); | ||
2423 | if (sg_dig_status & (0x3)) | ||
2424 | break; | ||
2425 | udelay(5); | ||
2426 | } | ||
2427 | mac_status = tr32(MAC_STATUS); | 2496 | mac_status = tr32(MAC_STATUS); |
2428 | 2497 | ||
2429 | if ((sg_dig_status & (1 << 1)) && | 2498 | if ((sg_dig_status & (1 << 1)) && |
@@ -2439,10 +2508,11 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2439 | 2508 | ||
2440 | tg3_setup_flow_control(tp, local_adv, remote_adv); | 2509 | tg3_setup_flow_control(tp, local_adv, remote_adv); |
2441 | current_link_up = 1; | 2510 | current_link_up = 1; |
2442 | tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED; | 2511 | tp->serdes_counter = 0; |
2512 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; | ||
2443 | } else if (!(sg_dig_status & (1 << 1))) { | 2513 | } else if (!(sg_dig_status & (1 << 1))) { |
2444 | if (tp->tg3_flags2 & TG3_FLG2_PHY_JUST_INITTED) | 2514 | if (tp->serdes_counter) |
2445 | tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED; | 2515 | tp->serdes_counter--; |
2446 | else { | 2516 | else { |
2447 | if (workaround) { | 2517 | if (workaround) { |
2448 | u32 val = serdes_cfg; | 2518 | u32 val = serdes_cfg; |
@@ -2466,9 +2536,17 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) | |||
2466 | !(mac_status & MAC_STATUS_RCVD_CFG)) { | 2536 | !(mac_status & MAC_STATUS_RCVD_CFG)) { |
2467 | tg3_setup_flow_control(tp, 0, 0); | 2537 | tg3_setup_flow_control(tp, 0, 0); |
2468 | current_link_up = 1; | 2538 | current_link_up = 1; |
2469 | } | 2539 | tp->tg3_flags2 |= |
2540 | TG3_FLG2_PARALLEL_DETECT; | ||
2541 | tp->serdes_counter = | ||
2542 | SERDES_PARALLEL_DET_TIMEOUT; | ||
2543 | } else | ||
2544 | goto restart_autoneg; | ||
2470 | } | 2545 | } |
2471 | } | 2546 | } |
2547 | } else { | ||
2548 | tp->serdes_counter = SERDES_AN_TIMEOUT_5704S; | ||
2549 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; | ||
2472 | } | 2550 | } |
2473 | 2551 | ||
2474 | out: | 2552 | out: |
@@ -2599,14 +2677,16 @@ static int tg3_setup_fiber_phy(struct tg3 *tp, int force_reset) | |||
2599 | MAC_STATUS_CFG_CHANGED)); | 2677 | MAC_STATUS_CFG_CHANGED)); |
2600 | udelay(5); | 2678 | udelay(5); |
2601 | if ((tr32(MAC_STATUS) & (MAC_STATUS_SYNC_CHANGED | | 2679 | if ((tr32(MAC_STATUS) & (MAC_STATUS_SYNC_CHANGED | |
2602 | MAC_STATUS_CFG_CHANGED)) == 0) | 2680 | MAC_STATUS_CFG_CHANGED | |
2681 | MAC_STATUS_LNKSTATE_CHANGED)) == 0) | ||
2603 | break; | 2682 | break; |
2604 | } | 2683 | } |
2605 | 2684 | ||
2606 | mac_status = tr32(MAC_STATUS); | 2685 | mac_status = tr32(MAC_STATUS); |
2607 | if ((mac_status & MAC_STATUS_PCS_SYNCED) == 0) { | 2686 | if ((mac_status & MAC_STATUS_PCS_SYNCED) == 0) { |
2608 | current_link_up = 0; | 2687 | current_link_up = 0; |
2609 | if (tp->link_config.autoneg == AUTONEG_ENABLE) { | 2688 | if (tp->link_config.autoneg == AUTONEG_ENABLE && |
2689 | tp->serdes_counter == 0) { | ||
2610 | tw32_f(MAC_MODE, (tp->mac_mode | | 2690 | tw32_f(MAC_MODE, (tp->mac_mode | |
2611 | MAC_MODE_SEND_CONFIGS)); | 2691 | MAC_MODE_SEND_CONFIGS)); |
2612 | udelay(1); | 2692 | udelay(1); |
@@ -2711,7 +2791,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset) | |||
2711 | tg3_writephy(tp, MII_BMCR, bmcr); | 2791 | tg3_writephy(tp, MII_BMCR, bmcr); |
2712 | 2792 | ||
2713 | tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED); | 2793 | tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED); |
2714 | tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED; | 2794 | tp->serdes_counter = SERDES_AN_TIMEOUT_5714S; |
2715 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; | 2795 | tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; |
2716 | 2796 | ||
2717 | return err; | 2797 | return err; |
@@ -2816,9 +2896,9 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset) | |||
2816 | 2896 | ||
2817 | static void tg3_serdes_parallel_detect(struct tg3 *tp) | 2897 | static void tg3_serdes_parallel_detect(struct tg3 *tp) |
2818 | { | 2898 | { |
2819 | if (tp->tg3_flags2 & TG3_FLG2_PHY_JUST_INITTED) { | 2899 | if (tp->serdes_counter) { |
2820 | /* Give autoneg time to complete. */ | 2900 | /* Give autoneg time to complete. */ |
2821 | tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED; | 2901 | tp->serdes_counter--; |
2822 | return; | 2902 | return; |
2823 | } | 2903 | } |
2824 | if (!netif_carrier_ok(tp->dev) && | 2904 | if (!netif_carrier_ok(tp->dev) && |
@@ -3535,8 +3615,7 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id, | |||
3535 | 3615 | ||
3536 | if ((sblk->status & SD_STATUS_UPDATED) || | 3616 | if ((sblk->status & SD_STATUS_UPDATED) || |
3537 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | 3617 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { |
3538 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3618 | tg3_disable_ints(tp); |
3539 | 0x00000001); | ||
3540 | return IRQ_RETVAL(1); | 3619 | return IRQ_RETVAL(1); |
3541 | } | 3620 | } |
3542 | return IRQ_RETVAL(0); | 3621 | return IRQ_RETVAL(0); |
@@ -4644,6 +4723,44 @@ static void tg3_write_sig_legacy(struct tg3 *tp, int kind) | |||
4644 | } | 4723 | } |
4645 | } | 4724 | } |
4646 | 4725 | ||
4726 | static int tg3_poll_fw(struct tg3 *tp) | ||
4727 | { | ||
4728 | int i; | ||
4729 | u32 val; | ||
4730 | |||
4731 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
4732 | for (i = 0; i < 400; i++) { | ||
4733 | if (tr32(VCPU_STATUS) & VCPU_STATUS_INIT_DONE) | ||
4734 | return 0; | ||
4735 | udelay(10); | ||
4736 | } | ||
4737 | return -ENODEV; | ||
4738 | } | ||
4739 | |||
4740 | /* Wait for firmware initialization to complete. */ | ||
4741 | for (i = 0; i < 100000; i++) { | ||
4742 | tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); | ||
4743 | if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) | ||
4744 | break; | ||
4745 | udelay(10); | ||
4746 | } | ||
4747 | |||
4748 | /* Chip might not be fitted with firmware. Some Sun onboard | ||
4749 | * parts are configured like that. So don't signal the timeout | ||
4750 | * of the above loop as an error, but do report the lack of | ||
4751 | * running firmware once. | ||
4752 | */ | ||
4753 | if (i >= 100000 && | ||
4754 | !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { | ||
4755 | tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; | ||
4756 | |||
4757 | printk(KERN_INFO PFX "%s: No firmware running.\n", | ||
4758 | tp->dev->name); | ||
4759 | } | ||
4760 | |||
4761 | return 0; | ||
4762 | } | ||
4763 | |||
4647 | static void tg3_stop_fw(struct tg3 *); | 4764 | static void tg3_stop_fw(struct tg3 *); |
4648 | 4765 | ||
4649 | /* tp->lock is held. */ | 4766 | /* tp->lock is held. */ |
@@ -4651,7 +4768,7 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4651 | { | 4768 | { |
4652 | u32 val; | 4769 | u32 val; |
4653 | void (*write_op)(struct tg3 *, u32, u32); | 4770 | void (*write_op)(struct tg3 *, u32, u32); |
4654 | int i; | 4771 | int err; |
4655 | 4772 | ||
4656 | tg3_nvram_lock(tp); | 4773 | tg3_nvram_lock(tp); |
4657 | 4774 | ||
@@ -4688,6 +4805,12 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4688 | } | 4805 | } |
4689 | } | 4806 | } |
4690 | 4807 | ||
4808 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
4809 | tw32(VCPU_STATUS, tr32(VCPU_STATUS) | VCPU_STATUS_DRV_RESET); | ||
4810 | tw32(GRC_VCPU_EXT_CTRL, | ||
4811 | tr32(GRC_VCPU_EXT_CTRL) & ~GRC_VCPU_EXT_CTRL_HALT_CPU); | ||
4812 | } | ||
4813 | |||
4691 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | 4814 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) |
4692 | val |= GRC_MISC_CFG_KEEP_GPHY_POWER; | 4815 | val |= GRC_MISC_CFG_KEEP_GPHY_POWER; |
4693 | tw32(GRC_MISC_CFG, val); | 4816 | tw32(GRC_MISC_CFG, val); |
@@ -4811,26 +4934,9 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
4811 | tw32_f(MAC_MODE, 0); | 4934 | tw32_f(MAC_MODE, 0); |
4812 | udelay(40); | 4935 | udelay(40); |
4813 | 4936 | ||
4814 | /* Wait for firmware initialization to complete. */ | 4937 | err = tg3_poll_fw(tp); |
4815 | for (i = 0; i < 100000; i++) { | 4938 | if (err) |
4816 | tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); | 4939 | return err; |
4817 | if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) | ||
4818 | break; | ||
4819 | udelay(10); | ||
4820 | } | ||
4821 | |||
4822 | /* Chip might not be fitted with firmare. Some Sun onboard | ||
4823 | * parts are configured like that. So don't signal the timeout | ||
4824 | * of the above loop as an error, but do report the lack of | ||
4825 | * running firmware once. | ||
4826 | */ | ||
4827 | if (i >= 100000 && | ||
4828 | !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) { | ||
4829 | tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED; | ||
4830 | |||
4831 | printk(KERN_INFO PFX "%s: No firmware running.\n", | ||
4832 | tp->dev->name); | ||
4833 | } | ||
4834 | 4940 | ||
4835 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && | 4941 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && |
4836 | tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) { | 4942 | tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) { |
@@ -5036,6 +5142,12 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset) | |||
5036 | BUG_ON(offset == TX_CPU_BASE && | 5142 | BUG_ON(offset == TX_CPU_BASE && |
5037 | (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)); | 5143 | (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)); |
5038 | 5144 | ||
5145 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
5146 | u32 val = tr32(GRC_VCPU_EXT_CTRL); | ||
5147 | |||
5148 | tw32(GRC_VCPU_EXT_CTRL, val | GRC_VCPU_EXT_CTRL_HALT_CPU); | ||
5149 | return 0; | ||
5150 | } | ||
5039 | if (offset == RX_CPU_BASE) { | 5151 | if (offset == RX_CPU_BASE) { |
5040 | for (i = 0; i < 10000; i++) { | 5152 | for (i = 0; i < 10000; i++) { |
5041 | tw32(offset + CPU_STATE, 0xffffffff); | 5153 | tw32(offset + CPU_STATE, 0xffffffff); |
@@ -6040,6 +6152,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6040 | val = 1; | 6152 | val = 1; |
6041 | else if (val > tp->rx_std_max_post) | 6153 | else if (val > tp->rx_std_max_post) |
6042 | val = tp->rx_std_max_post; | 6154 | val = tp->rx_std_max_post; |
6155 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
6156 | if (tp->pci_chip_rev_id == CHIPREV_ID_5906_A1) | ||
6157 | tw32(ISO_PKT_TX, (tr32(ISO_PKT_TX) & ~0x3) | 0x2); | ||
6158 | |||
6159 | if (val > (TG3_RX_INTERNAL_RING_SZ_5906 / 2)) | ||
6160 | val = TG3_RX_INTERNAL_RING_SZ_5906 / 2; | ||
6161 | } | ||
6043 | 6162 | ||
6044 | tw32(RCVBDI_STD_THRESH, val); | 6163 | tw32(RCVBDI_STD_THRESH, val); |
6045 | 6164 | ||
@@ -6460,7 +6579,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6460 | if (err) | 6579 | if (err) |
6461 | return err; | 6580 | return err; |
6462 | 6581 | ||
6463 | if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { | 6582 | if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && |
6583 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) { | ||
6464 | u32 tmp; | 6584 | u32 tmp; |
6465 | 6585 | ||
6466 | /* Clear CRC stats. */ | 6586 | /* Clear CRC stats. */ |
@@ -6660,12 +6780,14 @@ static void tg3_timer(unsigned long __opaque) | |||
6660 | need_setup = 1; | 6780 | need_setup = 1; |
6661 | } | 6781 | } |
6662 | if (need_setup) { | 6782 | if (need_setup) { |
6663 | tw32_f(MAC_MODE, | 6783 | if (!tp->serdes_counter) { |
6664 | (tp->mac_mode & | 6784 | tw32_f(MAC_MODE, |
6665 | ~MAC_MODE_PORT_MODE_MASK)); | 6785 | (tp->mac_mode & |
6666 | udelay(40); | 6786 | ~MAC_MODE_PORT_MODE_MASK)); |
6667 | tw32_f(MAC_MODE, tp->mac_mode); | 6787 | udelay(40); |
6668 | udelay(40); | 6788 | tw32_f(MAC_MODE, tp->mac_mode); |
6789 | udelay(40); | ||
6790 | } | ||
6669 | tg3_setup_phy(tp, 0); | 6791 | tg3_setup_phy(tp, 0); |
6670 | } | 6792 | } |
6671 | } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) | 6793 | } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) |
@@ -6674,13 +6796,29 @@ static void tg3_timer(unsigned long __opaque) | |||
6674 | tp->timer_counter = tp->timer_multiplier; | 6796 | tp->timer_counter = tp->timer_multiplier; |
6675 | } | 6797 | } |
6676 | 6798 | ||
6677 | /* Heartbeat is only sent once every 2 seconds. */ | 6799 | /* Heartbeat is only sent once every 2 seconds. |
6800 | * | ||
6801 | * The heartbeat is to tell the ASF firmware that the host | ||
6802 | * driver is still alive. In the event that the OS crashes, | ||
6803 | * ASF needs to reset the hardware to free up the FIFO space | ||
6804 | * that may be filled with rx packets destined for the host. | ||
6805 | * If the FIFO is full, ASF will no longer function properly. | ||
6806 | * | ||
6807 | * Unintended resets have been reported on real time kernels | ||
6808 | * where the timer doesn't run on time. Netpoll will also have | ||
6809 | * same problem. | ||
6810 | * | ||
6811 | * The new FWCMD_NICDRV_ALIVE3 command tells the ASF firmware | ||
6812 | * to check the ring condition when the heartbeat is expiring | ||
6813 | * before doing the reset. This will prevent most unintended | ||
6814 | * resets. | ||
6815 | */ | ||
6678 | if (!--tp->asf_counter) { | 6816 | if (!--tp->asf_counter) { |
6679 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { | 6817 | if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) { |
6680 | u32 val; | 6818 | u32 val; |
6681 | 6819 | ||
6682 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, | 6820 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, |
6683 | FWCMD_NICDRV_ALIVE2); | 6821 | FWCMD_NICDRV_ALIVE3); |
6684 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); | 6822 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); |
6685 | /* 5 seconds timeout */ | 6823 | /* 5 seconds timeout */ |
6686 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); | 6824 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); |
@@ -6721,8 +6859,7 @@ static int tg3_request_irq(struct tg3 *tp) | |||
6721 | static int tg3_test_interrupt(struct tg3 *tp) | 6859 | static int tg3_test_interrupt(struct tg3 *tp) |
6722 | { | 6860 | { |
6723 | struct net_device *dev = tp->dev; | 6861 | struct net_device *dev = tp->dev; |
6724 | int err, i; | 6862 | int err, i, intr_ok = 0; |
6725 | u32 int_mbox = 0; | ||
6726 | 6863 | ||
6727 | if (!netif_running(dev)) | 6864 | if (!netif_running(dev)) |
6728 | return -ENODEV; | 6865 | return -ENODEV; |
@@ -6743,10 +6880,18 @@ static int tg3_test_interrupt(struct tg3 *tp) | |||
6743 | HOSTCC_MODE_NOW); | 6880 | HOSTCC_MODE_NOW); |
6744 | 6881 | ||
6745 | for (i = 0; i < 5; i++) { | 6882 | for (i = 0; i < 5; i++) { |
6883 | u32 int_mbox, misc_host_ctrl; | ||
6884 | |||
6746 | int_mbox = tr32_mailbox(MAILBOX_INTERRUPT_0 + | 6885 | int_mbox = tr32_mailbox(MAILBOX_INTERRUPT_0 + |
6747 | TG3_64BIT_REG_LOW); | 6886 | TG3_64BIT_REG_LOW); |
6748 | if (int_mbox != 0) | 6887 | misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL); |
6888 | |||
6889 | if ((int_mbox != 0) || | ||
6890 | (misc_host_ctrl & MISC_HOST_CTRL_MASK_PCI_INT)) { | ||
6891 | intr_ok = 1; | ||
6749 | break; | 6892 | break; |
6893 | } | ||
6894 | |||
6750 | msleep(10); | 6895 | msleep(10); |
6751 | } | 6896 | } |
6752 | 6897 | ||
@@ -6759,7 +6904,7 @@ static int tg3_test_interrupt(struct tg3 *tp) | |||
6759 | if (err) | 6904 | if (err) |
6760 | return err; | 6905 | return err; |
6761 | 6906 | ||
6762 | if (int_mbox != 0) | 6907 | if (intr_ok) |
6763 | return 0; | 6908 | return 0; |
6764 | 6909 | ||
6765 | return -EIO; | 6910 | return -EIO; |
@@ -6936,9 +7081,10 @@ static int tg3_open(struct net_device *dev) | |||
6936 | 7081 | ||
6937 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { | 7082 | if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { |
6938 | if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) { | 7083 | if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) { |
6939 | u32 val = tr32(0x7c04); | 7084 | u32 val = tr32(PCIE_TRANSACTION_CFG); |
6940 | 7085 | ||
6941 | tw32(0x7c04, val | (1 << 29)); | 7086 | tw32(PCIE_TRANSACTION_CFG, |
7087 | val | PCIE_TRANS_CFG_1SHOT_MSI); | ||
6942 | } | 7088 | } |
6943 | } | 7089 | } |
6944 | } | 7090 | } |
@@ -7857,7 +8003,7 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
7857 | if (wol->wolopts & ~WAKE_MAGIC) | 8003 | if (wol->wolopts & ~WAKE_MAGIC) |
7858 | return -EINVAL; | 8004 | return -EINVAL; |
7859 | if ((wol->wolopts & WAKE_MAGIC) && | 8005 | if ((wol->wolopts & WAKE_MAGIC) && |
7860 | tp->tg3_flags2 & TG3_FLG2_PHY_SERDES && | 8006 | tp->tg3_flags2 & TG3_FLG2_ANY_SERDES && |
7861 | !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP)) | 8007 | !(tp->tg3_flags & TG3_FLAG_SERDES_WOL_CAP)) |
7862 | return -EINVAL; | 8008 | return -EINVAL; |
7863 | 8009 | ||
@@ -7893,7 +8039,8 @@ static int tg3_set_tso(struct net_device *dev, u32 value) | |||
7893 | return -EINVAL; | 8039 | return -EINVAL; |
7894 | return 0; | 8040 | return 0; |
7895 | } | 8041 | } |
7896 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) { | 8042 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) && |
8043 | (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)) { | ||
7897 | if (value) | 8044 | if (value) |
7898 | dev->features |= NETIF_F_TSO6; | 8045 | dev->features |= NETIF_F_TSO6; |
7899 | else | 8046 | else |
@@ -8147,6 +8294,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev, | |||
8147 | 8294 | ||
8148 | #define NVRAM_TEST_SIZE 0x100 | 8295 | #define NVRAM_TEST_SIZE 0x100 |
8149 | #define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14 | 8296 | #define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14 |
8297 | #define NVRAM_SELFBOOT_HW_SIZE 0x20 | ||
8298 | #define NVRAM_SELFBOOT_DATA_SIZE 0x1c | ||
8150 | 8299 | ||
8151 | static int tg3_test_nvram(struct tg3 *tp) | 8300 | static int tg3_test_nvram(struct tg3 *tp) |
8152 | { | 8301 | { |
@@ -8158,12 +8307,14 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8158 | 8307 | ||
8159 | if (magic == TG3_EEPROM_MAGIC) | 8308 | if (magic == TG3_EEPROM_MAGIC) |
8160 | size = NVRAM_TEST_SIZE; | 8309 | size = NVRAM_TEST_SIZE; |
8161 | else if ((magic & 0xff000000) == 0xa5000000) { | 8310 | else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { |
8162 | if ((magic & 0xe00000) == 0x200000) | 8311 | if ((magic & 0xe00000) == 0x200000) |
8163 | size = NVRAM_SELFBOOT_FORMAT1_SIZE; | 8312 | size = NVRAM_SELFBOOT_FORMAT1_SIZE; |
8164 | else | 8313 | else |
8165 | return 0; | 8314 | return 0; |
8166 | } else | 8315 | } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) |
8316 | size = NVRAM_SELFBOOT_HW_SIZE; | ||
8317 | else | ||
8167 | return -EIO; | 8318 | return -EIO; |
8168 | 8319 | ||
8169 | buf = kmalloc(size, GFP_KERNEL); | 8320 | buf = kmalloc(size, GFP_KERNEL); |
@@ -8182,7 +8333,8 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8182 | goto out; | 8333 | goto out; |
8183 | 8334 | ||
8184 | /* Selfboot format */ | 8335 | /* Selfboot format */ |
8185 | if (cpu_to_be32(buf[0]) != TG3_EEPROM_MAGIC) { | 8336 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) == |
8337 | TG3_EEPROM_MAGIC_FW) { | ||
8186 | u8 *buf8 = (u8 *) buf, csum8 = 0; | 8338 | u8 *buf8 = (u8 *) buf, csum8 = 0; |
8187 | 8339 | ||
8188 | for (i = 0; i < size; i++) | 8340 | for (i = 0; i < size; i++) |
@@ -8197,6 +8349,51 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8197 | goto out; | 8349 | goto out; |
8198 | } | 8350 | } |
8199 | 8351 | ||
8352 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) == | ||
8353 | TG3_EEPROM_MAGIC_HW) { | ||
8354 | u8 data[NVRAM_SELFBOOT_DATA_SIZE]; | ||
8355 | u8 parity[NVRAM_SELFBOOT_DATA_SIZE]; | ||
8356 | u8 *buf8 = (u8 *) buf; | ||
8357 | int j, k; | ||
8358 | |||
8359 | /* Separate the parity bits and the data bytes. */ | ||
8360 | for (i = 0, j = 0, k = 0; i < NVRAM_SELFBOOT_HW_SIZE; i++) { | ||
8361 | if ((i == 0) || (i == 8)) { | ||
8362 | int l; | ||
8363 | u8 msk; | ||
8364 | |||
8365 | for (l = 0, msk = 0x80; l < 7; l++, msk >>= 1) | ||
8366 | parity[k++] = buf8[i] & msk; | ||
8367 | i++; | ||
8368 | } | ||
8369 | else if (i == 16) { | ||
8370 | int l; | ||
8371 | u8 msk; | ||
8372 | |||
8373 | for (l = 0, msk = 0x20; l < 6; l++, msk >>= 1) | ||
8374 | parity[k++] = buf8[i] & msk; | ||
8375 | i++; | ||
8376 | |||
8377 | for (l = 0, msk = 0x80; l < 8; l++, msk >>= 1) | ||
8378 | parity[k++] = buf8[i] & msk; | ||
8379 | i++; | ||
8380 | } | ||
8381 | data[j++] = buf8[i]; | ||
8382 | } | ||
8383 | |||
8384 | err = -EIO; | ||
8385 | for (i = 0; i < NVRAM_SELFBOOT_DATA_SIZE; i++) { | ||
8386 | u8 hw8 = hweight8(data[i]); | ||
8387 | |||
8388 | if ((hw8 & 0x1) && parity[i]) | ||
8389 | goto out; | ||
8390 | else if (!(hw8 & 0x1) && !parity[i]) | ||
8391 | goto out; | ||
8392 | } | ||
8393 | err = 0; | ||
8394 | goto out; | ||
8395 | } | ||
8396 | |||
8200 | /* Bootstrap checksum at offset 0x10 */ | 8397 | /* Bootstrap checksum at offset 0x10 */ |
8201 | csum = calc_crc((unsigned char *) buf, 0x10); | 8398 | csum = calc_crc((unsigned char *) buf, 0x10); |
8202 | if(csum != cpu_to_le32(buf[0x10/4])) | 8399 | if(csum != cpu_to_le32(buf[0x10/4])) |
@@ -8243,7 +8440,7 @@ static int tg3_test_link(struct tg3 *tp) | |||
8243 | /* Only test the commonly used registers */ | 8440 | /* Only test the commonly used registers */ |
8244 | static int tg3_test_registers(struct tg3 *tp) | 8441 | static int tg3_test_registers(struct tg3 *tp) |
8245 | { | 8442 | { |
8246 | int i, is_5705; | 8443 | int i, is_5705, is_5750; |
8247 | u32 offset, read_mask, write_mask, val, save_val, read_val; | 8444 | u32 offset, read_mask, write_mask, val, save_val, read_val; |
8248 | static struct { | 8445 | static struct { |
8249 | u16 offset; | 8446 | u16 offset; |
@@ -8251,6 +8448,7 @@ static int tg3_test_registers(struct tg3 *tp) | |||
8251 | #define TG3_FL_5705 0x1 | 8448 | #define TG3_FL_5705 0x1 |
8252 | #define TG3_FL_NOT_5705 0x2 | 8449 | #define TG3_FL_NOT_5705 0x2 |
8253 | #define TG3_FL_NOT_5788 0x4 | 8450 | #define TG3_FL_NOT_5788 0x4 |
8451 | #define TG3_FL_NOT_5750 0x8 | ||
8254 | u32 read_mask; | 8452 | u32 read_mask; |
8255 | u32 write_mask; | 8453 | u32 write_mask; |
8256 | } reg_tbl[] = { | 8454 | } reg_tbl[] = { |
@@ -8361,9 +8559,9 @@ static int tg3_test_registers(struct tg3 *tp) | |||
8361 | 0xffffffff, 0x00000000 }, | 8559 | 0xffffffff, 0x00000000 }, |
8362 | 8560 | ||
8363 | /* Buffer Manager Control Registers. */ | 8561 | /* Buffer Manager Control Registers. */ |
8364 | { BUFMGR_MB_POOL_ADDR, 0x0000, | 8562 | { BUFMGR_MB_POOL_ADDR, TG3_FL_NOT_5750, |
8365 | 0x00000000, 0x007fff80 }, | 8563 | 0x00000000, 0x007fff80 }, |
8366 | { BUFMGR_MB_POOL_SIZE, 0x0000, | 8564 | { BUFMGR_MB_POOL_SIZE, TG3_FL_NOT_5750, |
8367 | 0x00000000, 0x007fffff }, | 8565 | 0x00000000, 0x007fffff }, |
8368 | { BUFMGR_MB_RDMA_LOW_WATER, 0x0000, | 8566 | { BUFMGR_MB_RDMA_LOW_WATER, 0x0000, |
8369 | 0x00000000, 0x0000003f }, | 8567 | 0x00000000, 0x0000003f }, |
@@ -8389,10 +8587,12 @@ static int tg3_test_registers(struct tg3 *tp) | |||
8389 | { 0xffff, 0x0000, 0x00000000, 0x00000000 }, | 8587 | { 0xffff, 0x0000, 0x00000000, 0x00000000 }, |
8390 | }; | 8588 | }; |
8391 | 8589 | ||
8392 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) | 8590 | is_5705 = is_5750 = 0; |
8591 | if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { | ||
8393 | is_5705 = 1; | 8592 | is_5705 = 1; |
8394 | else | 8593 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) |
8395 | is_5705 = 0; | 8594 | is_5750 = 1; |
8595 | } | ||
8396 | 8596 | ||
8397 | for (i = 0; reg_tbl[i].offset != 0xffff; i++) { | 8597 | for (i = 0; reg_tbl[i].offset != 0xffff; i++) { |
8398 | if (is_5705 && (reg_tbl[i].flags & TG3_FL_NOT_5705)) | 8598 | if (is_5705 && (reg_tbl[i].flags & TG3_FL_NOT_5705)) |
@@ -8405,6 +8605,9 @@ static int tg3_test_registers(struct tg3 *tp) | |||
8405 | (reg_tbl[i].flags & TG3_FL_NOT_5788)) | 8605 | (reg_tbl[i].flags & TG3_FL_NOT_5788)) |
8406 | continue; | 8606 | continue; |
8407 | 8607 | ||
8608 | if (is_5750 && (reg_tbl[i].flags & TG3_FL_NOT_5750)) | ||
8609 | continue; | ||
8610 | |||
8408 | offset = (u32) reg_tbl[i].offset; | 8611 | offset = (u32) reg_tbl[i].offset; |
8409 | read_mask = reg_tbl[i].read_mask; | 8612 | read_mask = reg_tbl[i].read_mask; |
8410 | write_mask = reg_tbl[i].write_mask; | 8613 | write_mask = reg_tbl[i].write_mask; |
@@ -8496,6 +8699,13 @@ static int tg3_test_memory(struct tg3 *tp) | |||
8496 | { 0x00008000, 0x02000}, | 8699 | { 0x00008000, 0x02000}, |
8497 | { 0x00010000, 0x0c000}, | 8700 | { 0x00010000, 0x0c000}, |
8498 | { 0xffffffff, 0x00000} | 8701 | { 0xffffffff, 0x00000} |
8702 | }, mem_tbl_5906[] = { | ||
8703 | { 0x00000200, 0x00008}, | ||
8704 | { 0x00004000, 0x00400}, | ||
8705 | { 0x00006000, 0x00400}, | ||
8706 | { 0x00008000, 0x01000}, | ||
8707 | { 0x00010000, 0x01000}, | ||
8708 | { 0xffffffff, 0x00000} | ||
8499 | }; | 8709 | }; |
8500 | struct mem_entry *mem_tbl; | 8710 | struct mem_entry *mem_tbl; |
8501 | int err = 0; | 8711 | int err = 0; |
@@ -8505,6 +8715,8 @@ static int tg3_test_memory(struct tg3 *tp) | |||
8505 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 8715 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
8506 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) | 8716 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) |
8507 | mem_tbl = mem_tbl_5755; | 8717 | mem_tbl = mem_tbl_5755; |
8718 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
8719 | mem_tbl = mem_tbl_5906; | ||
8508 | else | 8720 | else |
8509 | mem_tbl = mem_tbl_5705; | 8721 | mem_tbl = mem_tbl_5705; |
8510 | } else | 8722 | } else |
@@ -8541,13 +8753,41 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8541 | return 0; | 8753 | return 0; |
8542 | 8754 | ||
8543 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | 8755 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | |
8544 | MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY | | 8756 | MAC_MODE_PORT_INT_LPBACK | MAC_MODE_LINK_POLARITY; |
8545 | MAC_MODE_PORT_MODE_GMII; | 8757 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) |
8758 | mac_mode |= MAC_MODE_PORT_MODE_MII; | ||
8759 | else | ||
8760 | mac_mode |= MAC_MODE_PORT_MODE_GMII; | ||
8546 | tw32(MAC_MODE, mac_mode); | 8761 | tw32(MAC_MODE, mac_mode); |
8547 | } else if (loopback_mode == TG3_PHY_LOOPBACK) { | 8762 | } else if (loopback_mode == TG3_PHY_LOOPBACK) { |
8548 | tg3_writephy(tp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | | 8763 | u32 val; |
8549 | BMCR_SPEED1000); | 8764 | |
8765 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
8766 | u32 phytest; | ||
8767 | |||
8768 | if (!tg3_readphy(tp, MII_TG3_EPHY_TEST, &phytest)) { | ||
8769 | u32 phy; | ||
8770 | |||
8771 | tg3_writephy(tp, MII_TG3_EPHY_TEST, | ||
8772 | phytest | MII_TG3_EPHY_SHADOW_EN); | ||
8773 | if (!tg3_readphy(tp, 0x1b, &phy)) | ||
8774 | tg3_writephy(tp, 0x1b, phy & ~0x20); | ||
8775 | if (!tg3_readphy(tp, 0x10, &phy)) | ||
8776 | tg3_writephy(tp, 0x10, phy & ~0x4000); | ||
8777 | tg3_writephy(tp, MII_TG3_EPHY_TEST, phytest); | ||
8778 | } | ||
8779 | } | ||
8780 | val = BMCR_LOOPBACK | BMCR_FULLDPLX; | ||
8781 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | ||
8782 | val |= BMCR_SPEED100; | ||
8783 | else | ||
8784 | val |= BMCR_SPEED1000; | ||
8785 | |||
8786 | tg3_writephy(tp, MII_BMCR, val); | ||
8550 | udelay(40); | 8787 | udelay(40); |
8788 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
8789 | tg3_writephy(tp, MII_TG3_EPHY_PTEST, 0x1800); | ||
8790 | |||
8551 | /* reset to prevent losing 1st rx packet intermittently */ | 8791 | /* reset to prevent losing 1st rx packet intermittently */ |
8552 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { | 8792 | if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { |
8553 | tw32_f(MAC_RX_MODE, RX_MODE_RESET); | 8793 | tw32_f(MAC_RX_MODE, RX_MODE_RESET); |
@@ -8555,7 +8795,11 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8555 | tw32_f(MAC_RX_MODE, tp->rx_mode); | 8795 | tw32_f(MAC_RX_MODE, tp->rx_mode); |
8556 | } | 8796 | } |
8557 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | | 8797 | mac_mode = (tp->mac_mode & ~MAC_MODE_PORT_MODE_MASK) | |
8558 | MAC_MODE_LINK_POLARITY | MAC_MODE_PORT_MODE_GMII; | 8798 | MAC_MODE_LINK_POLARITY; |
8799 | if (tp->tg3_flags & TG3_FLAG_10_100_ONLY) | ||
8800 | mac_mode |= MAC_MODE_PORT_MODE_MII; | ||
8801 | else | ||
8802 | mac_mode |= MAC_MODE_PORT_MODE_GMII; | ||
8559 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { | 8803 | if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { |
8560 | mac_mode &= ~MAC_MODE_LINK_POLARITY; | 8804 | mac_mode &= ~MAC_MODE_LINK_POLARITY; |
8561 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 8805 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
@@ -8604,7 +8848,8 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode) | |||
8604 | 8848 | ||
8605 | udelay(10); | 8849 | udelay(10); |
8606 | 8850 | ||
8607 | for (i = 0; i < 10; i++) { | 8851 | /* 250 usec to allow enough time on some 10/100 Mbps devices. */ |
8852 | for (i = 0; i < 25; i++) { | ||
8608 | tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE | | 8853 | tw32_f(HOSTCC_MODE, tp->coalesce_mode | HOSTCC_MODE_ENABLE | |
8609 | HOSTCC_MODE_NOW); | 8854 | HOSTCC_MODE_NOW); |
8610 | 8855 | ||
@@ -8956,7 +9201,9 @@ static void __devinit tg3_get_eeprom_size(struct tg3 *tp) | |||
8956 | if (tg3_nvram_read_swab(tp, 0, &magic) != 0) | 9201 | if (tg3_nvram_read_swab(tp, 0, &magic) != 0) |
8957 | return; | 9202 | return; |
8958 | 9203 | ||
8959 | if ((magic != TG3_EEPROM_MAGIC) && ((magic & 0xff000000) != 0xa5000000)) | 9204 | if ((magic != TG3_EEPROM_MAGIC) && |
9205 | ((magic & TG3_EEPROM_MAGIC_FW_MSK) != TG3_EEPROM_MAGIC_FW) && | ||
9206 | ((magic & TG3_EEPROM_MAGIC_HW_MSK) != TG3_EEPROM_MAGIC_HW)) | ||
8960 | return; | 9207 | return; |
8961 | 9208 | ||
8962 | /* | 9209 | /* |
@@ -9194,6 +9441,13 @@ static void __devinit tg3_get_5787_nvram_info(struct tg3 *tp) | |||
9194 | } | 9441 | } |
9195 | } | 9442 | } |
9196 | 9443 | ||
9444 | static void __devinit tg3_get_5906_nvram_info(struct tg3 *tp) | ||
9445 | { | ||
9446 | tp->nvram_jedecnum = JEDEC_ATMEL; | ||
9447 | tp->tg3_flags |= TG3_FLAG_NVRAM_BUFFERED; | ||
9448 | tp->nvram_pagesize = ATMEL_AT24C512_CHIP_SIZE; | ||
9449 | } | ||
9450 | |||
9197 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ | 9451 | /* Chips other than 5700/5701 use the NVRAM for fetching info. */ |
9198 | static void __devinit tg3_nvram_init(struct tg3 *tp) | 9452 | static void __devinit tg3_nvram_init(struct tg3 *tp) |
9199 | { | 9453 | { |
@@ -9230,6 +9484,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) | |||
9230 | tg3_get_5755_nvram_info(tp); | 9484 | tg3_get_5755_nvram_info(tp); |
9231 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) | 9485 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) |
9232 | tg3_get_5787_nvram_info(tp); | 9486 | tg3_get_5787_nvram_info(tp); |
9487 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
9488 | tg3_get_5906_nvram_info(tp); | ||
9233 | else | 9489 | else |
9234 | tg3_get_nvram_info(tp); | 9490 | tg3_get_nvram_info(tp); |
9235 | 9491 | ||
@@ -9703,6 +9959,12 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
9703 | /* Assume an onboard device by default. */ | 9959 | /* Assume an onboard device by default. */ |
9704 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; | 9960 | tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; |
9705 | 9961 | ||
9962 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
9963 | if (!(tr32(PCIE_TRANSACTION_CFG) & PCIE_TRANS_CFG_LOM)) | ||
9964 | tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT; | ||
9965 | return; | ||
9966 | } | ||
9967 | |||
9706 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); | 9968 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); |
9707 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { | 9969 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { |
9708 | u32 nic_cfg, led_cfg; | 9970 | u32 nic_cfg, led_cfg; |
@@ -10034,7 +10296,10 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
10034 | } | 10296 | } |
10035 | 10297 | ||
10036 | out_not_found: | 10298 | out_not_found: |
10037 | strcpy(tp->board_part_number, "none"); | 10299 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) |
10300 | strcpy(tp->board_part_number, "BCM95906"); | ||
10301 | else | ||
10302 | strcpy(tp->board_part_number, "none"); | ||
10038 | } | 10303 | } |
10039 | 10304 | ||
10040 | static void __devinit tg3_read_fw_ver(struct tg3 *tp) | 10305 | static void __devinit tg3_read_fw_ver(struct tg3 *tp) |
@@ -10236,6 +10501,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10236 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || | 10501 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || |
10237 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10502 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
10238 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || | 10503 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || |
10504 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 || | ||
10239 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) | 10505 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) |
10240 | tp->tg3_flags2 |= TG3_FLG2_5750_PLUS; | 10506 | tp->tg3_flags2 |= TG3_FLG2_5750_PLUS; |
10241 | 10507 | ||
@@ -10245,7 +10511,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10245 | 10511 | ||
10246 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { | 10512 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { |
10247 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10513 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
10248 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) { | 10514 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || |
10515 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
10249 | tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2; | 10516 | tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2; |
10250 | tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI; | 10517 | tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI; |
10251 | } else { | 10518 | } else { |
@@ -10262,7 +10529,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10262 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750 && | 10529 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750 && |
10263 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752 && | 10530 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752 && |
10264 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5755 && | 10531 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5755 && |
10265 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787) | 10532 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5787 && |
10533 | GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) | ||
10266 | tp->tg3_flags2 |= TG3_FLG2_JUMBO_CAPABLE; | 10534 | tp->tg3_flags2 |= TG3_FLG2_JUMBO_CAPABLE; |
10267 | 10535 | ||
10268 | if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) | 10536 | if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) |
@@ -10392,6 +10660,12 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10392 | pci_cmd &= ~PCI_COMMAND_MEMORY; | 10660 | pci_cmd &= ~PCI_COMMAND_MEMORY; |
10393 | pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); | 10661 | pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd); |
10394 | } | 10662 | } |
10663 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
10664 | tp->read32_mbox = tg3_read32_mbox_5906; | ||
10665 | tp->write32_mbox = tg3_write32_mbox_5906; | ||
10666 | tp->write32_tx_mbox = tg3_write32_mbox_5906; | ||
10667 | tp->write32_rx_mbox = tg3_write32_mbox_5906; | ||
10668 | } | ||
10395 | 10669 | ||
10396 | if (tp->write32 == tg3_write_indirect_reg32 || | 10670 | if (tp->write32 == tg3_write_indirect_reg32 || |
10397 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && | 10671 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) && |
@@ -10463,6 +10737,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10463 | ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && | 10737 | ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && |
10464 | (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && | 10738 | (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && |
10465 | (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) || | 10739 | (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) || |
10740 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) || | ||
10466 | (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) | 10741 | (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) |
10467 | tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; | 10742 | tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; |
10468 | 10743 | ||
@@ -10476,7 +10751,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10476 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10751 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
10477 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) | 10752 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) |
10478 | tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG; | 10753 | tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG; |
10479 | else | 10754 | else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906) |
10480 | tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; | 10755 | tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG; |
10481 | } | 10756 | } |
10482 | 10757 | ||
@@ -10566,7 +10841,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10566 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || | 10841 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) || |
10567 | (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && | 10842 | (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM && |
10568 | (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F || | 10843 | (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F || |
10569 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F))) | 10844 | tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F)) || |
10845 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
10570 | tp->tg3_flags |= TG3_FLAG_10_100_ONLY; | 10846 | tp->tg3_flags |= TG3_FLAG_10_100_ONLY; |
10571 | 10847 | ||
10572 | err = tg3_phy_probe(tp); | 10848 | err = tg3_phy_probe(tp); |
@@ -10617,7 +10893,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10617 | * straddle the 4GB address boundary in some cases. | 10893 | * straddle the 4GB address boundary in some cases. |
10618 | */ | 10894 | */ |
10619 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || | 10895 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || |
10620 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) | 10896 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 || |
10897 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
10621 | tp->dev->hard_start_xmit = tg3_start_xmit; | 10898 | tp->dev->hard_start_xmit = tg3_start_xmit; |
10622 | else | 10899 | else |
10623 | tp->dev->hard_start_xmit = tg3_start_xmit_dma_bug; | 10900 | tp->dev->hard_start_xmit = tg3_start_xmit_dma_bug; |
@@ -10698,6 +10975,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
10698 | else | 10975 | else |
10699 | tg3_nvram_unlock(tp); | 10976 | tg3_nvram_unlock(tp); |
10700 | } | 10977 | } |
10978 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
10979 | mac_offset = 0x10; | ||
10701 | 10980 | ||
10702 | /* First try to get it from MAC address mailbox. */ | 10981 | /* First try to get it from MAC address mailbox. */ |
10703 | tg3_read_mem(tp, NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi); | 10982 | tg3_read_mem(tp, NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi); |
@@ -11181,6 +11460,12 @@ static void __devinit tg3_init_bufmgr_config(struct tg3 *tp) | |||
11181 | DEFAULT_MB_MACRX_LOW_WATER_5705; | 11460 | DEFAULT_MB_MACRX_LOW_WATER_5705; |
11182 | tp->bufmgr_config.mbuf_high_water = | 11461 | tp->bufmgr_config.mbuf_high_water = |
11183 | DEFAULT_MB_HIGH_WATER_5705; | 11462 | DEFAULT_MB_HIGH_WATER_5705; |
11463 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | ||
11464 | tp->bufmgr_config.mbuf_mac_rx_low_water = | ||
11465 | DEFAULT_MB_MACRX_LOW_WATER_5906; | ||
11466 | tp->bufmgr_config.mbuf_high_water = | ||
11467 | DEFAULT_MB_HIGH_WATER_5906; | ||
11468 | } | ||
11184 | 11469 | ||
11185 | tp->bufmgr_config.mbuf_read_dma_low_water_jumbo = | 11470 | tp->bufmgr_config.mbuf_read_dma_low_water_jumbo = |
11186 | DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780; | 11471 | DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780; |
@@ -11224,6 +11509,8 @@ static char * __devinit tg3_phy_string(struct tg3 *tp) | |||
11224 | case PHY_ID_BCM5780: return "5780"; | 11509 | case PHY_ID_BCM5780: return "5780"; |
11225 | case PHY_ID_BCM5755: return "5755"; | 11510 | case PHY_ID_BCM5755: return "5755"; |
11226 | case PHY_ID_BCM5787: return "5787"; | 11511 | case PHY_ID_BCM5787: return "5787"; |
11512 | case PHY_ID_BCM5756: return "5722/5756"; | ||
11513 | case PHY_ID_BCM5906: return "5906"; | ||
11227 | case PHY_ID_BCM8002: return "8002/serdes"; | 11514 | case PHY_ID_BCM8002: return "8002/serdes"; |
11228 | case 0: return "serdes"; | 11515 | case 0: return "serdes"; |
11229 | default: return "unknown"; | 11516 | default: return "unknown"; |
@@ -11526,7 +11813,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
11526 | */ | 11813 | */ |
11527 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { | 11814 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { |
11528 | dev->features |= NETIF_F_TSO; | 11815 | dev->features |= NETIF_F_TSO; |
11529 | if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) | 11816 | if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_2) && |
11817 | (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)) | ||
11530 | dev->features |= NETIF_F_TSO6; | 11818 | dev->features |= NETIF_F_TSO6; |
11531 | } | 11819 | } |
11532 | 11820 | ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 3ecf356cfb08..92f53000bce6 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | #define RX_COPY_THRESHOLD 256 | 25 | #define RX_COPY_THRESHOLD 256 |
26 | 26 | ||
27 | #define TG3_RX_INTERNAL_RING_SZ_5906 32 | ||
28 | |||
27 | #define RX_STD_MAX_SIZE 1536 | 29 | #define RX_STD_MAX_SIZE 1536 |
28 | #define RX_STD_MAX_SIZE_5705 512 | 30 | #define RX_STD_MAX_SIZE_5705 512 |
29 | #define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */ | 31 | #define RX_JUMBO_MAX_SIZE 0xdeadbeef /* XXX */ |
@@ -129,6 +131,7 @@ | |||
129 | #define CHIPREV_ID_5752_A0_HW 0x5000 | 131 | #define CHIPREV_ID_5752_A0_HW 0x5000 |
130 | #define CHIPREV_ID_5752_A0 0x6000 | 132 | #define CHIPREV_ID_5752_A0 0x6000 |
131 | #define CHIPREV_ID_5752_A1 0x6001 | 133 | #define CHIPREV_ID_5752_A1 0x6001 |
134 | #define CHIPREV_ID_5906_A1 0xc001 | ||
132 | #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) | 135 | #define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) |
133 | #define ASIC_REV_5700 0x07 | 136 | #define ASIC_REV_5700 0x07 |
134 | #define ASIC_REV_5701 0x00 | 137 | #define ASIC_REV_5701 0x00 |
@@ -141,6 +144,7 @@ | |||
141 | #define ASIC_REV_5714 0x09 | 144 | #define ASIC_REV_5714 0x09 |
142 | #define ASIC_REV_5755 0x0a | 145 | #define ASIC_REV_5755 0x0a |
143 | #define ASIC_REV_5787 0x0b | 146 | #define ASIC_REV_5787 0x0b |
147 | #define ASIC_REV_5906 0x0c | ||
144 | #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) | 148 | #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) |
145 | #define CHIPREV_5700_AX 0x70 | 149 | #define CHIPREV_5700_AX 0x70 |
146 | #define CHIPREV_5700_BX 0x71 | 150 | #define CHIPREV_5700_BX 0x71 |
@@ -646,7 +650,8 @@ | |||
646 | #define SNDDATAI_SCTRL_FORCE_ZERO 0x00000010 | 650 | #define SNDDATAI_SCTRL_FORCE_ZERO 0x00000010 |
647 | #define SNDDATAI_STATSENAB 0x00000c0c | 651 | #define SNDDATAI_STATSENAB 0x00000c0c |
648 | #define SNDDATAI_STATSINCMASK 0x00000c10 | 652 | #define SNDDATAI_STATSINCMASK 0x00000c10 |
649 | /* 0xc14 --> 0xc80 unused */ | 653 | #define ISO_PKT_TX 0x00000c20 |
654 | /* 0xc24 --> 0xc80 unused */ | ||
650 | #define SNDDATAI_COS_CNT_0 0x00000c80 | 655 | #define SNDDATAI_COS_CNT_0 0x00000c80 |
651 | #define SNDDATAI_COS_CNT_1 0x00000c84 | 656 | #define SNDDATAI_COS_CNT_1 0x00000c84 |
652 | #define SNDDATAI_COS_CNT_2 0x00000c88 | 657 | #define SNDDATAI_COS_CNT_2 0x00000c88 |
@@ -997,11 +1002,13 @@ | |||
997 | #define BUFMGR_MB_MACRX_LOW_WATER 0x00004414 | 1002 | #define BUFMGR_MB_MACRX_LOW_WATER 0x00004414 |
998 | #define DEFAULT_MB_MACRX_LOW_WATER 0x00000020 | 1003 | #define DEFAULT_MB_MACRX_LOW_WATER 0x00000020 |
999 | #define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010 | 1004 | #define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010 |
1005 | #define DEFAULT_MB_MACRX_LOW_WATER_5906 0x00000004 | ||
1000 | #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098 | 1006 | #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098 |
1001 | #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780 0x0000004b | 1007 | #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780 0x0000004b |
1002 | #define BUFMGR_MB_HIGH_WATER 0x00004418 | 1008 | #define BUFMGR_MB_HIGH_WATER 0x00004418 |
1003 | #define DEFAULT_MB_HIGH_WATER 0x00000060 | 1009 | #define DEFAULT_MB_HIGH_WATER 0x00000060 |
1004 | #define DEFAULT_MB_HIGH_WATER_5705 0x00000060 | 1010 | #define DEFAULT_MB_HIGH_WATER_5705 0x00000060 |
1011 | #define DEFAULT_MB_HIGH_WATER_5906 0x00000010 | ||
1005 | #define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c | 1012 | #define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c |
1006 | #define DEFAULT_MB_HIGH_WATER_JUMBO_5780 0x00000096 | 1013 | #define DEFAULT_MB_HIGH_WATER_JUMBO_5780 0x00000096 |
1007 | #define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c | 1014 | #define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c |
@@ -1138,7 +1145,12 @@ | |||
1138 | #define TX_CPU_STATE 0x00005404 | 1145 | #define TX_CPU_STATE 0x00005404 |
1139 | #define TX_CPU_PGMCTR 0x0000541c | 1146 | #define TX_CPU_PGMCTR 0x0000541c |
1140 | 1147 | ||
1148 | #define VCPU_STATUS 0x00005100 | ||
1149 | #define VCPU_STATUS_INIT_DONE 0x04000000 | ||
1150 | #define VCPU_STATUS_DRV_RESET 0x08000000 | ||
1151 | |||
1141 | /* Mailboxes */ | 1152 | /* Mailboxes */ |
1153 | #define GRCMBOX_BASE 0x00005600 | ||
1142 | #define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ | 1154 | #define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ |
1143 | #define GRCMBOX_INTERRUPT_1 0x00005808 /* 64-bit */ | 1155 | #define GRCMBOX_INTERRUPT_1 0x00005808 /* 64-bit */ |
1144 | #define GRCMBOX_INTERRUPT_2 0x00005810 /* 64-bit */ | 1156 | #define GRCMBOX_INTERRUPT_2 0x00005810 /* 64-bit */ |
@@ -1398,7 +1410,10 @@ | |||
1398 | #define GRC_EEPROM_CTRL 0x00006840 | 1410 | #define GRC_EEPROM_CTRL 0x00006840 |
1399 | #define GRC_MDI_CTRL 0x00006844 | 1411 | #define GRC_MDI_CTRL 0x00006844 |
1400 | #define GRC_SEEPROM_DELAY 0x00006848 | 1412 | #define GRC_SEEPROM_DELAY 0x00006848 |
1401 | /* 0x684c --> 0x6c00 unused */ | 1413 | /* 0x684c --> 0x6890 unused */ |
1414 | #define GRC_VCPU_EXT_CTRL 0x00006890 | ||
1415 | #define GRC_VCPU_EXT_CTRL_HALT_CPU 0x00400000 | ||
1416 | #define GRC_VCPU_EXT_CTRL_DISABLE_WOL 0x20000000 | ||
1402 | #define GRC_FASTBOOT_PC 0x00006894 /* 5752, 5755, 5787 */ | 1417 | #define GRC_FASTBOOT_PC 0x00006894 /* 5752, 5755, 5787 */ |
1403 | 1418 | ||
1404 | /* 0x6c00 --> 0x7000 unused */ | 1419 | /* 0x6c00 --> 0x7000 unused */ |
@@ -1485,9 +1500,17 @@ | |||
1485 | #define NVRAM_WRITE1 0x00007028 | 1500 | #define NVRAM_WRITE1 0x00007028 |
1486 | /* 0x702c --> 0x7400 unused */ | 1501 | /* 0x702c --> 0x7400 unused */ |
1487 | 1502 | ||
1488 | /* 0x7400 --> 0x8000 unused */ | 1503 | /* 0x7400 --> 0x7c00 unused */ |
1504 | #define PCIE_TRANSACTION_CFG 0x00007c04 | ||
1505 | #define PCIE_TRANS_CFG_1SHOT_MSI 0x20000000 | ||
1506 | #define PCIE_TRANS_CFG_LOM 0x00000020 | ||
1507 | |||
1489 | 1508 | ||
1490 | #define TG3_EEPROM_MAGIC 0x669955aa | 1509 | #define TG3_EEPROM_MAGIC 0x669955aa |
1510 | #define TG3_EEPROM_MAGIC_FW 0xa5000000 | ||
1511 | #define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 | ||
1512 | #define TG3_EEPROM_MAGIC_HW 0xabcd | ||
1513 | #define TG3_EEPROM_MAGIC_HW_MSK 0xffff | ||
1491 | 1514 | ||
1492 | /* 32K Window into NIC internal memory */ | 1515 | /* 32K Window into NIC internal memory */ |
1493 | #define NIC_SRAM_WIN_BASE 0x00008000 | 1516 | #define NIC_SRAM_WIN_BASE 0x00008000 |
@@ -1537,6 +1560,7 @@ | |||
1537 | #define FWCMD_NICDRV_FIX_DMAR 0x00000005 | 1560 | #define FWCMD_NICDRV_FIX_DMAR 0x00000005 |
1538 | #define FWCMD_NICDRV_FIX_DMAW 0x00000006 | 1561 | #define FWCMD_NICDRV_FIX_DMAW 0x00000006 |
1539 | #define FWCMD_NICDRV_ALIVE2 0x0000000d | 1562 | #define FWCMD_NICDRV_ALIVE2 0x0000000d |
1563 | #define FWCMD_NICDRV_ALIVE3 0x0000000e | ||
1540 | #define NIC_SRAM_FW_CMD_LEN_MBOX 0x00000b7c | 1564 | #define NIC_SRAM_FW_CMD_LEN_MBOX 0x00000b7c |
1541 | #define NIC_SRAM_FW_CMD_DATA_MBOX 0x00000b80 | 1565 | #define NIC_SRAM_FW_CMD_DATA_MBOX 0x00000b80 |
1542 | #define NIC_SRAM_FW_ASF_STATUS_MBOX 0x00000c00 | 1566 | #define NIC_SRAM_FW_ASF_STATUS_MBOX 0x00000c00 |
@@ -1604,6 +1628,7 @@ | |||
1604 | #define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */ | 1628 | #define MII_TG3_DSP_RW_PORT 0x15 /* DSP coefficient read/write port */ |
1605 | 1629 | ||
1606 | #define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */ | 1630 | #define MII_TG3_DSP_ADDRESS 0x17 /* DSP address register */ |
1631 | #define MII_TG3_EPHY_PTEST 0x17 /* 5906 PHY register */ | ||
1607 | 1632 | ||
1608 | #define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */ | 1633 | #define MII_TG3_AUX_CTRL 0x18 /* auxilliary control register */ |
1609 | 1634 | ||
@@ -1617,6 +1642,8 @@ | |||
1617 | #define MII_TG3_AUX_STAT_100FULL 0x0500 | 1642 | #define MII_TG3_AUX_STAT_100FULL 0x0500 |
1618 | #define MII_TG3_AUX_STAT_1000HALF 0x0600 | 1643 | #define MII_TG3_AUX_STAT_1000HALF 0x0600 |
1619 | #define MII_TG3_AUX_STAT_1000FULL 0x0700 | 1644 | #define MII_TG3_AUX_STAT_1000FULL 0x0700 |
1645 | #define MII_TG3_AUX_STAT_100 0x0008 | ||
1646 | #define MII_TG3_AUX_STAT_FULL 0x0001 | ||
1620 | 1647 | ||
1621 | #define MII_TG3_ISTAT 0x1a /* IRQ status register */ | 1648 | #define MII_TG3_ISTAT 0x1a /* IRQ status register */ |
1622 | #define MII_TG3_IMASK 0x1b /* IRQ mask register */ | 1649 | #define MII_TG3_IMASK 0x1b /* IRQ mask register */ |
@@ -1627,6 +1654,9 @@ | |||
1627 | #define MII_TG3_INT_DUPLEXCHG 0x0008 | 1654 | #define MII_TG3_INT_DUPLEXCHG 0x0008 |
1628 | #define MII_TG3_INT_ANEG_PAGE_RX 0x0400 | 1655 | #define MII_TG3_INT_ANEG_PAGE_RX 0x0400 |
1629 | 1656 | ||
1657 | #define MII_TG3_EPHY_TEST 0x1f /* 5906 PHY register */ | ||
1658 | #define MII_TG3_EPHY_SHADOW_EN 0x80 | ||
1659 | |||
1630 | /* There are two ways to manage the TX descriptors on the tigon3. | 1660 | /* There are two ways to manage the TX descriptors on the tigon3. |
1631 | * Either the descriptors are in host DMA'able memory, or they | 1661 | * Either the descriptors are in host DMA'able memory, or they |
1632 | * exist only in the cards on-chip SRAM. All 16 send bds are under | 1662 | * exist only in the cards on-chip SRAM. All 16 send bds are under |
@@ -2203,7 +2233,6 @@ struct tg3 { | |||
2203 | #define TG3_FLG2_PCI_EXPRESS 0x00000200 | 2233 | #define TG3_FLG2_PCI_EXPRESS 0x00000200 |
2204 | #define TG3_FLG2_ASF_NEW_HANDSHAKE 0x00000400 | 2234 | #define TG3_FLG2_ASF_NEW_HANDSHAKE 0x00000400 |
2205 | #define TG3_FLG2_HW_AUTONEG 0x00000800 | 2235 | #define TG3_FLG2_HW_AUTONEG 0x00000800 |
2206 | #define TG3_FLG2_PHY_JUST_INITTED 0x00001000 | ||
2207 | #define TG3_FLG2_PHY_SERDES 0x00002000 | 2236 | #define TG3_FLG2_PHY_SERDES 0x00002000 |
2208 | #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 | 2237 | #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 |
2209 | #define TG3_FLG2_FLASH 0x00008000 | 2238 | #define TG3_FLG2_FLASH 0x00008000 |
@@ -2236,6 +2265,12 @@ struct tg3 { | |||
2236 | u16 asf_counter; | 2265 | u16 asf_counter; |
2237 | u16 asf_multiplier; | 2266 | u16 asf_multiplier; |
2238 | 2267 | ||
2268 | /* 1 second counter for transient serdes link events */ | ||
2269 | u32 serdes_counter; | ||
2270 | #define SERDES_AN_TIMEOUT_5704S 2 | ||
2271 | #define SERDES_PARALLEL_DET_TIMEOUT 1 | ||
2272 | #define SERDES_AN_TIMEOUT_5714S 1 | ||
2273 | |||
2239 | struct tg3_link_config link_config; | 2274 | struct tg3_link_config link_config; |
2240 | struct tg3_bufmgr_config bufmgr_config; | 2275 | struct tg3_bufmgr_config bufmgr_config; |
2241 | 2276 | ||
@@ -2276,6 +2311,8 @@ struct tg3 { | |||
2276 | #define PHY_ID_BCM5780 0x60008350 | 2311 | #define PHY_ID_BCM5780 0x60008350 |
2277 | #define PHY_ID_BCM5755 0xbc050cc0 | 2312 | #define PHY_ID_BCM5755 0xbc050cc0 |
2278 | #define PHY_ID_BCM5787 0xbc050ce0 | 2313 | #define PHY_ID_BCM5787 0xbc050ce0 |
2314 | #define PHY_ID_BCM5756 0xbc050ed0 | ||
2315 | #define PHY_ID_BCM5906 0xdc00ac40 | ||
2279 | #define PHY_ID_BCM8002 0x60010140 | 2316 | #define PHY_ID_BCM8002 0x60010140 |
2280 | #define PHY_ID_INVALID 0xffffffff | 2317 | #define PHY_ID_INVALID 0xffffffff |
2281 | #define PHY_ID_REV_MASK 0x0000000f | 2318 | #define PHY_ID_REV_MASK 0x0000000f |
@@ -2302,7 +2339,8 @@ struct tg3 { | |||
2302 | (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \ | 2339 | (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \ |
2303 | (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5714 || \ | 2340 | (X) == PHY_ID_BCM5752 || (X) == PHY_ID_BCM5714 || \ |
2304 | (X) == PHY_ID_BCM5780 || (X) == PHY_ID_BCM5787 || \ | 2341 | (X) == PHY_ID_BCM5780 || (X) == PHY_ID_BCM5787 || \ |
2305 | (X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM8002) | 2342 | (X) == PHY_ID_BCM5755 || (X) == PHY_ID_BCM5756 || \ |
2343 | (X) == PHY_ID_BCM5906 || (X) == PHY_ID_BCM8002) | ||
2306 | 2344 | ||
2307 | struct tg3_hw_stats *hw_stats; | 2345 | struct tg3_hw_stats *hw_stats; |
2308 | dma_addr_t stats_mapping; | 2346 | dma_addr_t stats_mapping; |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 7ec2b2f9b7ee..b0bc5ddcf1b1 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -161,7 +161,7 @@ static int cisco_rx(struct sk_buff *skb) | |||
161 | struct hdlc_header *data = (struct hdlc_header*)skb->data; | 161 | struct hdlc_header *data = (struct hdlc_header*)skb->data; |
162 | struct cisco_packet *cisco_data; | 162 | struct cisco_packet *cisco_data; |
163 | struct in_device *in_dev; | 163 | struct in_device *in_dev; |
164 | u32 addr, mask; | 164 | __be32 addr, mask; |
165 | 165 | ||
166 | if (skb->len < sizeof(struct hdlc_header)) | 166 | if (skb->len < sizeof(struct hdlc_header)) |
167 | goto rx_error; | 167 | goto rx_error; |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index c13b459a0137..d1173089f334 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -763,7 +763,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) | |||
763 | { | 763 | { |
764 | struct in_device *in_dev; | 764 | struct in_device *in_dev; |
765 | struct in_ifaddr *ifa; | 765 | struct in_ifaddr *ifa; |
766 | u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ | 766 | __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ |
767 | #ifdef CONFIG_INET | 767 | #ifdef CONFIG_INET |
768 | rcu_read_lock(); | 768 | rcu_read_lock(); |
769 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) | 769 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index ccaf28e8db0a..337c692f6fd6 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -1342,7 +1342,7 @@ static unsigned char *strip_make_packet(unsigned char *buffer, | |||
1342 | * 'broadcast hub' radio (First byte of address being 0xFF means broadcast) | 1342 | * 'broadcast hub' radio (First byte of address being 0xFF means broadcast) |
1343 | */ | 1343 | */ |
1344 | if (haddr.c[0] == 0xFF) { | 1344 | if (haddr.c[0] == 0xFF) { |
1345 | u32 brd = 0; | 1345 | __be32 brd = 0; |
1346 | struct in_device *in_dev; | 1346 | struct in_device *in_dev; |
1347 | 1347 | ||
1348 | rcu_read_lock(); | 1348 | rcu_read_lock(); |
@@ -1406,7 +1406,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) | |||
1406 | int doreset = (long) jiffies - strip_info->watchdog_doreset >= 0; | 1406 | int doreset = (long) jiffies - strip_info->watchdog_doreset >= 0; |
1407 | int doprobe = (long) jiffies - strip_info->watchdog_doprobe >= 0 | 1407 | int doprobe = (long) jiffies - strip_info->watchdog_doprobe >= 0 |
1408 | && !doreset; | 1408 | && !doreset; |
1409 | u32 addr, brd; | 1409 | __be32 addr, brd; |
1410 | 1410 | ||
1411 | /* | 1411 | /* |
1412 | * 1. If we have a packet, encapsulate it and put it in the buffer | 1412 | * 1. If we have a packet, encapsulate it and put it in the buffer |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 5613b4564fa2..8364d5475ac7 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -8067,7 +8067,7 @@ qeth_arp_constructor(struct neighbour *neigh) | |||
8067 | neigh->parms = neigh_parms_clone(parms); | 8067 | neigh->parms = neigh_parms_clone(parms); |
8068 | rcu_read_unlock(); | 8068 | rcu_read_unlock(); |
8069 | 8069 | ||
8070 | neigh->type = inet_addr_type(*(u32 *) neigh->primary_key); | 8070 | neigh->type = inet_addr_type(*(__be32 *) neigh->primary_key); |
8071 | neigh->nud_state = NUD_NOARP; | 8071 | neigh->nud_state = NUD_NOARP; |
8072 | neigh->ops = arp_direct_ops; | 8072 | neigh->ops = arp_direct_ops; |
8073 | neigh->output = neigh->ops->queue_xmit; | 8073 | neigh->output = neigh->ops->queue_xmit; |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 1df2ac30a4d2..f7a52e19b4be 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -58,6 +58,7 @@ header-y += elf-em.h | |||
58 | header-y += fadvise.h | 58 | header-y += fadvise.h |
59 | header-y += fd.h | 59 | header-y += fd.h |
60 | header-y += fdreg.h | 60 | header-y += fdreg.h |
61 | header-y += fib_rules.h | ||
61 | header-y += ftape-header-segment.h | 62 | header-y += ftape-header-segment.h |
62 | header-y += ftape-vendors.h | 63 | header-y += ftape-vendors.h |
63 | header-y += fuse.h | 64 | header-y += fuse.h |
@@ -70,6 +71,7 @@ header-y += hysdn_if.h | |||
70 | header-y += i2c-dev.h | 71 | header-y += i2c-dev.h |
71 | header-y += i8k.h | 72 | header-y += i8k.h |
72 | header-y += icmp.h | 73 | header-y += icmp.h |
74 | header-y += if_addr.h | ||
73 | header-y += if_arcnet.h | 75 | header-y += if_arcnet.h |
74 | header-y += if_arp.h | 76 | header-y += if_arp.h |
75 | header-y += if_bonding.h | 77 | header-y += if_bonding.h |
@@ -79,6 +81,7 @@ header-y += if_fddi.h | |||
79 | header-y += if.h | 81 | header-y += if.h |
80 | header-y += if_hippi.h | 82 | header-y += if_hippi.h |
81 | header-y += if_infiniband.h | 83 | header-y += if_infiniband.h |
84 | header-y += if_link.h | ||
82 | header-y += if_packet.h | 85 | header-y += if_packet.h |
83 | header-y += if_plip.h | 86 | header-y += if_plip.h |
84 | header-y += if_ppp.h | 87 | header-y += if_ppp.h |
@@ -110,6 +113,7 @@ header-y += mmtimer.h | |||
110 | header-y += mqueue.h | 113 | header-y += mqueue.h |
111 | header-y += mtio.h | 114 | header-y += mtio.h |
112 | header-y += ncp_no.h | 115 | header-y += ncp_no.h |
116 | header-y += neighbour.h | ||
113 | header-y += netfilter_arp.h | 117 | header-y += netfilter_arp.h |
114 | header-y += netrom.h | 118 | header-y += netrom.h |
115 | header-y += nfs2.h | 119 | header-y += nfs2.h |
diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 6ba3aa8a81f4..75b8baca08f3 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h | |||
@@ -88,15 +88,7 @@ static inline struct atalk_sock *at_sk(struct sock *sk) | |||
88 | #include <asm/byteorder.h> | 88 | #include <asm/byteorder.h> |
89 | 89 | ||
90 | struct ddpehdr { | 90 | struct ddpehdr { |
91 | #ifdef __LITTLE_ENDIAN_BITFIELD | 91 | __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */ |
92 | __u16 deh_len:10, | ||
93 | deh_hops:4, | ||
94 | deh_pad:2; | ||
95 | #else | ||
96 | __u16 deh_pad:2, | ||
97 | deh_hops:4, | ||
98 | deh_len:10; | ||
99 | #endif | ||
100 | __be16 deh_sum; | 92 | __be16 deh_sum; |
101 | __be16 deh_dnet; | 93 | __be16 deh_dnet; |
102 | __be16 deh_snet; | 94 | __be16 deh_snet; |
@@ -112,36 +104,6 @@ static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) | |||
112 | return (struct ddpehdr *)skb->h.raw; | 104 | return (struct ddpehdr *)skb->h.raw; |
113 | } | 105 | } |
114 | 106 | ||
115 | /* | ||
116 | * Don't drop the struct into the struct above. You'll get some | ||
117 | * surprise padding. | ||
118 | */ | ||
119 | struct ddpebits { | ||
120 | #ifdef __LITTLE_ENDIAN_BITFIELD | ||
121 | __u16 deh_len:10, | ||
122 | deh_hops:4, | ||
123 | deh_pad:2; | ||
124 | #else | ||
125 | __u16 deh_pad:2, | ||
126 | deh_hops:4, | ||
127 | deh_len:10; | ||
128 | #endif | ||
129 | }; | ||
130 | |||
131 | /* Short form header */ | ||
132 | struct ddpshdr { | ||
133 | #ifdef __LITTLE_ENDIAN_BITFIELD | ||
134 | __u16 dsh_len:10, | ||
135 | dsh_pad:6; | ||
136 | #else | ||
137 | __u16 dsh_pad:6, | ||
138 | dsh_len:10; | ||
139 | #endif | ||
140 | __u8 dsh_dport; | ||
141 | __u8 dsh_sport; | ||
142 | /* And netatalk apps expect to stick the type in themselves */ | ||
143 | }; | ||
144 | |||
145 | /* AppleTalk AARP headers */ | 107 | /* AppleTalk AARP headers */ |
146 | struct elapaarp { | 108 | struct elapaarp { |
147 | __be16 hw_type; | 109 | __be16 hw_type; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 40a6c26294ae..42719d07612a 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -95,6 +95,12 @@ | |||
95 | #define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ | 95 | #define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */ |
96 | #define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ | 96 | #define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */ |
97 | #define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ | 97 | #define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */ |
98 | #define AUDIT_MAC_UNLBL_ACCEPT 1406 /* NetLabel: allow unlabeled traffic */ | ||
99 | #define AUDIT_MAC_UNLBL_DENY 1407 /* NetLabel: deny unlabeled traffic */ | ||
100 | #define AUDIT_MAC_CIPSOV4_ADD 1408 /* NetLabel: add CIPSOv4 DOI entry */ | ||
101 | #define AUDIT_MAC_CIPSOV4_DEL 1409 /* NetLabel: del CIPSOv4 DOI entry */ | ||
102 | #define AUDIT_MAC_MAP_ADD 1410 /* NetLabel: add LSM domain mapping */ | ||
103 | #define AUDIT_MAC_MAP_DEL 1411 /* NetLabel: del LSM domain mapping */ | ||
98 | 104 | ||
99 | #define AUDIT_FIRST_KERN_ANOM_MSG 1700 | 105 | #define AUDIT_FIRST_KERN_ANOM_MSG 1700 |
100 | #define AUDIT_LAST_KERN_ANOM_MSG 1799 | 106 | #define AUDIT_LAST_KERN_ANOM_MSG 1799 |
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h index 408118a07763..92f8d4fab32b 100644 --- a/include/linux/errqueue.h +++ b/include/linux/errqueue.h | |||
@@ -38,7 +38,7 @@ struct sock_exterr_skb | |||
38 | } header; | 38 | } header; |
39 | struct sock_extended_err ee; | 39 | struct sock_extended_err ee; |
40 | u16 addr_offset; | 40 | u16 addr_offset; |
41 | u16 port; | 41 | __be16 port; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/include/linux/icmp.h b/include/linux/icmp.h index f0b571f1060b..878cfe4e587f 100644 --- a/include/linux/icmp.h +++ b/include/linux/icmp.h | |||
@@ -68,16 +68,16 @@ | |||
68 | struct icmphdr { | 68 | struct icmphdr { |
69 | __u8 type; | 69 | __u8 type; |
70 | __u8 code; | 70 | __u8 code; |
71 | __u16 checksum; | 71 | __be16 checksum; |
72 | union { | 72 | union { |
73 | struct { | 73 | struct { |
74 | __u16 id; | 74 | __be16 id; |
75 | __u16 sequence; | 75 | __be16 sequence; |
76 | } echo; | 76 | } echo; |
77 | __u32 gateway; | 77 | __be32 gateway; |
78 | struct { | 78 | struct { |
79 | __u16 __unused; | 79 | __be16 __unused; |
80 | __u16 mtu; | 80 | __be16 mtu; |
81 | } frag; | 81 | } frag; |
82 | } un; | 82 | } un; |
83 | }; | 83 | }; |
diff --git a/include/linux/if.h b/include/linux/if.h index 8018c2e22c0c..32bf419351f1 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -214,134 +214,4 @@ struct ifconf | |||
214 | #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ | 214 | #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ |
215 | #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ | 215 | #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ |
216 | 216 | ||
217 | /* The struct should be in sync with struct net_device_stats */ | ||
218 | struct rtnl_link_stats | ||
219 | { | ||
220 | __u32 rx_packets; /* total packets received */ | ||
221 | __u32 tx_packets; /* total packets transmitted */ | ||
222 | __u32 rx_bytes; /* total bytes received */ | ||
223 | __u32 tx_bytes; /* total bytes transmitted */ | ||
224 | __u32 rx_errors; /* bad packets received */ | ||
225 | __u32 tx_errors; /* packet transmit problems */ | ||
226 | __u32 rx_dropped; /* no space in linux buffers */ | ||
227 | __u32 tx_dropped; /* no space available in linux */ | ||
228 | __u32 multicast; /* multicast packets received */ | ||
229 | __u32 collisions; | ||
230 | |||
231 | /* detailed rx_errors: */ | ||
232 | __u32 rx_length_errors; | ||
233 | __u32 rx_over_errors; /* receiver ring buff overflow */ | ||
234 | __u32 rx_crc_errors; /* recved pkt with crc error */ | ||
235 | __u32 rx_frame_errors; /* recv'd frame alignment error */ | ||
236 | __u32 rx_fifo_errors; /* recv'r fifo overrun */ | ||
237 | __u32 rx_missed_errors; /* receiver missed packet */ | ||
238 | |||
239 | /* detailed tx_errors */ | ||
240 | __u32 tx_aborted_errors; | ||
241 | __u32 tx_carrier_errors; | ||
242 | __u32 tx_fifo_errors; | ||
243 | __u32 tx_heartbeat_errors; | ||
244 | __u32 tx_window_errors; | ||
245 | |||
246 | /* for cslip etc */ | ||
247 | __u32 rx_compressed; | ||
248 | __u32 tx_compressed; | ||
249 | }; | ||
250 | |||
251 | /* The struct should be in sync with struct ifmap */ | ||
252 | struct rtnl_link_ifmap | ||
253 | { | ||
254 | __u64 mem_start; | ||
255 | __u64 mem_end; | ||
256 | __u64 base_addr; | ||
257 | __u16 irq; | ||
258 | __u8 dma; | ||
259 | __u8 port; | ||
260 | }; | ||
261 | |||
262 | enum | ||
263 | { | ||
264 | IFLA_UNSPEC, | ||
265 | IFLA_ADDRESS, | ||
266 | IFLA_BROADCAST, | ||
267 | IFLA_IFNAME, | ||
268 | IFLA_MTU, | ||
269 | IFLA_LINK, | ||
270 | IFLA_QDISC, | ||
271 | IFLA_STATS, | ||
272 | IFLA_COST, | ||
273 | #define IFLA_COST IFLA_COST | ||
274 | IFLA_PRIORITY, | ||
275 | #define IFLA_PRIORITY IFLA_PRIORITY | ||
276 | IFLA_MASTER, | ||
277 | #define IFLA_MASTER IFLA_MASTER | ||
278 | IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ | ||
279 | #define IFLA_WIRELESS IFLA_WIRELESS | ||
280 | IFLA_PROTINFO, /* Protocol specific information for a link */ | ||
281 | #define IFLA_PROTINFO IFLA_PROTINFO | ||
282 | IFLA_TXQLEN, | ||
283 | #define IFLA_TXQLEN IFLA_TXQLEN | ||
284 | IFLA_MAP, | ||
285 | #define IFLA_MAP IFLA_MAP | ||
286 | IFLA_WEIGHT, | ||
287 | #define IFLA_WEIGHT IFLA_WEIGHT | ||
288 | IFLA_OPERSTATE, | ||
289 | IFLA_LINKMODE, | ||
290 | __IFLA_MAX | ||
291 | }; | ||
292 | |||
293 | |||
294 | #define IFLA_MAX (__IFLA_MAX - 1) | ||
295 | |||
296 | /* ifi_flags. | ||
297 | |||
298 | IFF_* flags. | ||
299 | |||
300 | The only change is: | ||
301 | IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are | ||
302 | more not changeable by user. They describe link media | ||
303 | characteristics and set by device driver. | ||
304 | |||
305 | Comments: | ||
306 | - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid | ||
307 | - If neither of these three flags are set; | ||
308 | the interface is NBMA. | ||
309 | |||
310 | - IFF_MULTICAST does not mean anything special: | ||
311 | multicasts can be used on all not-NBMA links. | ||
312 | IFF_MULTICAST means that this media uses special encapsulation | ||
313 | for multicast frames. Apparently, all IFF_POINTOPOINT and | ||
314 | IFF_BROADCAST devices are able to use multicasts too. | ||
315 | */ | ||
316 | |||
317 | /* IFLA_LINK. | ||
318 | For usual devices it is equal ifi_index. | ||
319 | If it is a "virtual interface" (f.e. tunnel), ifi_link | ||
320 | can point to real physical interface (f.e. for bandwidth calculations), | ||
321 | or maybe 0, what means, that real media is unknown (usual | ||
322 | for IPIP tunnels, when route to endpoint is allowed to change) | ||
323 | */ | ||
324 | |||
325 | /* Subtype attributes for IFLA_PROTINFO */ | ||
326 | enum | ||
327 | { | ||
328 | IFLA_INET6_UNSPEC, | ||
329 | IFLA_INET6_FLAGS, /* link flags */ | ||
330 | IFLA_INET6_CONF, /* sysctl parameters */ | ||
331 | IFLA_INET6_STATS, /* statistics */ | ||
332 | IFLA_INET6_MCAST, /* MC things. What of them? */ | ||
333 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | ||
334 | __IFLA_INET6_MAX | ||
335 | }; | ||
336 | |||
337 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) | ||
338 | |||
339 | struct ifla_cacheinfo | ||
340 | { | ||
341 | __u32 max_reasm_len; | ||
342 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ | ||
343 | __u32 reachable_time; | ||
344 | __u32 retrans_time; | ||
345 | }; | ||
346 | |||
347 | #endif /* _LINUX_IF_H */ | 217 | #endif /* _LINUX_IF_H */ |
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index a8b1a2071838..7f5714214ee3 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
@@ -130,11 +130,11 @@ struct arpreq_old { | |||
130 | 130 | ||
131 | struct arphdr | 131 | struct arphdr |
132 | { | 132 | { |
133 | unsigned short ar_hrd; /* format of hardware address */ | 133 | __be16 ar_hrd; /* format of hardware address */ |
134 | unsigned short ar_pro; /* format of protocol address */ | 134 | __be16 ar_pro; /* format of protocol address */ |
135 | unsigned char ar_hln; /* length of hardware address */ | 135 | unsigned char ar_hln; /* length of hardware address */ |
136 | unsigned char ar_pln; /* length of protocol address */ | 136 | unsigned char ar_pln; /* length of protocol address */ |
137 | unsigned short ar_op; /* ARP opcode (command) */ | 137 | __be16 ar_op; /* ARP opcode (command) */ |
138 | 138 | ||
139 | #if 0 | 139 | #if 0 |
140 | /* | 140 | /* |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h new file mode 100644 index 000000000000..e963a077e6f5 --- /dev/null +++ b/include/linux/if_link.h | |||
@@ -0,0 +1,136 @@ | |||
1 | #ifndef _LINUX_IF_LINK_H | ||
2 | #define _LINUX_IF_LINK_H | ||
3 | |||
4 | #include <linux/netlink.h> | ||
5 | |||
6 | /* The struct should be in sync with struct net_device_stats */ | ||
7 | struct rtnl_link_stats | ||
8 | { | ||
9 | __u32 rx_packets; /* total packets received */ | ||
10 | __u32 tx_packets; /* total packets transmitted */ | ||
11 | __u32 rx_bytes; /* total bytes received */ | ||
12 | __u32 tx_bytes; /* total bytes transmitted */ | ||
13 | __u32 rx_errors; /* bad packets received */ | ||
14 | __u32 tx_errors; /* packet transmit problems */ | ||
15 | __u32 rx_dropped; /* no space in linux buffers */ | ||
16 | __u32 tx_dropped; /* no space available in linux */ | ||
17 | __u32 multicast; /* multicast packets received */ | ||
18 | __u32 collisions; | ||
19 | |||
20 | /* detailed rx_errors: */ | ||
21 | __u32 rx_length_errors; | ||
22 | __u32 rx_over_errors; /* receiver ring buff overflow */ | ||
23 | __u32 rx_crc_errors; /* recved pkt with crc error */ | ||
24 | __u32 rx_frame_errors; /* recv'd frame alignment error */ | ||
25 | __u32 rx_fifo_errors; /* recv'r fifo overrun */ | ||
26 | __u32 rx_missed_errors; /* receiver missed packet */ | ||
27 | |||
28 | /* detailed tx_errors */ | ||
29 | __u32 tx_aborted_errors; | ||
30 | __u32 tx_carrier_errors; | ||
31 | __u32 tx_fifo_errors; | ||
32 | __u32 tx_heartbeat_errors; | ||
33 | __u32 tx_window_errors; | ||
34 | |||
35 | /* for cslip etc */ | ||
36 | __u32 rx_compressed; | ||
37 | __u32 tx_compressed; | ||
38 | }; | ||
39 | |||
40 | /* The struct should be in sync with struct ifmap */ | ||
41 | struct rtnl_link_ifmap | ||
42 | { | ||
43 | __u64 mem_start; | ||
44 | __u64 mem_end; | ||
45 | __u64 base_addr; | ||
46 | __u16 irq; | ||
47 | __u8 dma; | ||
48 | __u8 port; | ||
49 | }; | ||
50 | |||
51 | enum | ||
52 | { | ||
53 | IFLA_UNSPEC, | ||
54 | IFLA_ADDRESS, | ||
55 | IFLA_BROADCAST, | ||
56 | IFLA_IFNAME, | ||
57 | IFLA_MTU, | ||
58 | IFLA_LINK, | ||
59 | IFLA_QDISC, | ||
60 | IFLA_STATS, | ||
61 | IFLA_COST, | ||
62 | #define IFLA_COST IFLA_COST | ||
63 | IFLA_PRIORITY, | ||
64 | #define IFLA_PRIORITY IFLA_PRIORITY | ||
65 | IFLA_MASTER, | ||
66 | #define IFLA_MASTER IFLA_MASTER | ||
67 | IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ | ||
68 | #define IFLA_WIRELESS IFLA_WIRELESS | ||
69 | IFLA_PROTINFO, /* Protocol specific information for a link */ | ||
70 | #define IFLA_PROTINFO IFLA_PROTINFO | ||
71 | IFLA_TXQLEN, | ||
72 | #define IFLA_TXQLEN IFLA_TXQLEN | ||
73 | IFLA_MAP, | ||
74 | #define IFLA_MAP IFLA_MAP | ||
75 | IFLA_WEIGHT, | ||
76 | #define IFLA_WEIGHT IFLA_WEIGHT | ||
77 | IFLA_OPERSTATE, | ||
78 | IFLA_LINKMODE, | ||
79 | __IFLA_MAX | ||
80 | }; | ||
81 | |||
82 | |||
83 | #define IFLA_MAX (__IFLA_MAX - 1) | ||
84 | |||
85 | /* ifi_flags. | ||
86 | |||
87 | IFF_* flags. | ||
88 | |||
89 | The only change is: | ||
90 | IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are | ||
91 | more not changeable by user. They describe link media | ||
92 | characteristics and set by device driver. | ||
93 | |||
94 | Comments: | ||
95 | - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid | ||
96 | - If neither of these three flags are set; | ||
97 | the interface is NBMA. | ||
98 | |||
99 | - IFF_MULTICAST does not mean anything special: | ||
100 | multicasts can be used on all not-NBMA links. | ||
101 | IFF_MULTICAST means that this media uses special encapsulation | ||
102 | for multicast frames. Apparently, all IFF_POINTOPOINT and | ||
103 | IFF_BROADCAST devices are able to use multicasts too. | ||
104 | */ | ||
105 | |||
106 | /* IFLA_LINK. | ||
107 | For usual devices it is equal ifi_index. | ||
108 | If it is a "virtual interface" (f.e. tunnel), ifi_link | ||
109 | can point to real physical interface (f.e. for bandwidth calculations), | ||
110 | or maybe 0, what means, that real media is unknown (usual | ||
111 | for IPIP tunnels, when route to endpoint is allowed to change) | ||
112 | */ | ||
113 | |||
114 | /* Subtype attributes for IFLA_PROTINFO */ | ||
115 | enum | ||
116 | { | ||
117 | IFLA_INET6_UNSPEC, | ||
118 | IFLA_INET6_FLAGS, /* link flags */ | ||
119 | IFLA_INET6_CONF, /* sysctl parameters */ | ||
120 | IFLA_INET6_STATS, /* statistics */ | ||
121 | IFLA_INET6_MCAST, /* MC things. What of them? */ | ||
122 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | ||
123 | __IFLA_INET6_MAX | ||
124 | }; | ||
125 | |||
126 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) | ||
127 | |||
128 | struct ifla_cacheinfo | ||
129 | { | ||
130 | __u32 max_reasm_len; | ||
131 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ | ||
132 | __u32 reachable_time; | ||
133 | __u32 retrans_time; | ||
134 | }; | ||
135 | |||
136 | #endif /* _LINUX_IF_LINK_H */ | ||
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 899c3d4776f3..03f43e2893a4 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -30,8 +30,8 @@ struct igmphdr | |||
30 | { | 30 | { |
31 | __u8 type; | 31 | __u8 type; |
32 | __u8 code; /* For newer IGMP */ | 32 | __u8 code; /* For newer IGMP */ |
33 | __u16 csum; | 33 | __be16 csum; |
34 | __u32 group; | 34 | __be32 group; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | /* V3 group record types [grec_type] */ | 37 | /* V3 group record types [grec_type] */ |
@@ -45,25 +45,25 @@ struct igmphdr | |||
45 | struct igmpv3_grec { | 45 | struct igmpv3_grec { |
46 | __u8 grec_type; | 46 | __u8 grec_type; |
47 | __u8 grec_auxwords; | 47 | __u8 grec_auxwords; |
48 | __u16 grec_nsrcs; | 48 | __be16 grec_nsrcs; |
49 | __u32 grec_mca; | 49 | __be32 grec_mca; |
50 | __u32 grec_src[0]; | 50 | __be32 grec_src[0]; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct igmpv3_report { | 53 | struct igmpv3_report { |
54 | __u8 type; | 54 | __u8 type; |
55 | __u8 resv1; | 55 | __u8 resv1; |
56 | __u16 csum; | 56 | __be16 csum; |
57 | __u16 resv2; | 57 | __be16 resv2; |
58 | __u16 ngrec; | 58 | __be16 ngrec; |
59 | struct igmpv3_grec grec[0]; | 59 | struct igmpv3_grec grec[0]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | struct igmpv3_query { | 62 | struct igmpv3_query { |
63 | __u8 type; | 63 | __u8 type; |
64 | __u8 code; | 64 | __u8 code; |
65 | __u16 csum; | 65 | __be16 csum; |
66 | __u32 group; | 66 | __be32 group; |
67 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 67 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
68 | __u8 qrv:3, | 68 | __u8 qrv:3, |
69 | suppress:1, | 69 | suppress:1, |
@@ -76,8 +76,8 @@ struct igmpv3_query { | |||
76 | #error "Please fix <asm/byteorder.h>" | 76 | #error "Please fix <asm/byteorder.h>" |
77 | #endif | 77 | #endif |
78 | __u8 qqic; | 78 | __u8 qqic; |
79 | __u16 nsrcs; | 79 | __be16 nsrcs; |
80 | __u32 srcs[0]; | 80 | __be32 srcs[0]; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ | 83 | #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ |
@@ -136,11 +136,11 @@ struct ip_sf_socklist | |||
136 | { | 136 | { |
137 | unsigned int sl_max; | 137 | unsigned int sl_max; |
138 | unsigned int sl_count; | 138 | unsigned int sl_count; |
139 | __u32 sl_addr[0]; | 139 | __be32 sl_addr[0]; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | #define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ | 142 | #define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ |
143 | (count) * sizeof(__u32)) | 143 | (count) * sizeof(__be32)) |
144 | 144 | ||
145 | #define IP_SFBLOCK 10 /* allocate this many at once */ | 145 | #define IP_SFBLOCK 10 /* allocate this many at once */ |
146 | 146 | ||
@@ -159,7 +159,7 @@ struct ip_mc_socklist | |||
159 | struct ip_sf_list | 159 | struct ip_sf_list |
160 | { | 160 | { |
161 | struct ip_sf_list *sf_next; | 161 | struct ip_sf_list *sf_next; |
162 | __u32 sf_inaddr; | 162 | __be32 sf_inaddr; |
163 | unsigned long sf_count[2]; /* include/exclude counts */ | 163 | unsigned long sf_count[2]; /* include/exclude counts */ |
164 | unsigned char sf_gsresp; /* include in g & s response? */ | 164 | unsigned char sf_gsresp; /* include in g & s response? */ |
165 | unsigned char sf_oldin; /* change state */ | 165 | unsigned char sf_oldin; /* change state */ |
@@ -197,7 +197,7 @@ struct ip_mc_list | |||
197 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) | 197 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) |
198 | #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) | 198 | #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) |
199 | 199 | ||
200 | extern int ip_check_mc(struct in_device *dev, u32 mc_addr, u32 src_addr, u16 proto); | 200 | extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto); |
201 | extern int igmp_rcv(struct sk_buff *); | 201 | extern int igmp_rcv(struct sk_buff *); |
202 | extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); | 202 | extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); |
203 | extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); | 203 | extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); |
@@ -209,13 +209,13 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, | |||
209 | struct ip_msfilter __user *optval, int __user *optlen); | 209 | struct ip_msfilter __user *optval, int __user *optlen); |
210 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | 210 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, |
211 | struct group_filter __user *optval, int __user *optlen); | 211 | struct group_filter __user *optval, int __user *optlen); |
212 | extern int ip_mc_sf_allow(struct sock *sk, u32 local, u32 rmt, int dif); | 212 | extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif); |
213 | extern void ip_mr_init(void); | 213 | extern void ip_mr_init(void); |
214 | extern void ip_mc_init_dev(struct in_device *); | 214 | extern void ip_mc_init_dev(struct in_device *); |
215 | extern void ip_mc_destroy_dev(struct in_device *); | 215 | extern void ip_mc_destroy_dev(struct in_device *); |
216 | extern void ip_mc_up(struct in_device *); | 216 | extern void ip_mc_up(struct in_device *); |
217 | extern void ip_mc_down(struct in_device *); | 217 | extern void ip_mc_down(struct in_device *); |
218 | extern void ip_mc_dec_group(struct in_device *in_dev, u32 addr); | 218 | extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); |
219 | extern void ip_mc_inc_group(struct in_device *in_dev, u32 addr); | 219 | extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); |
220 | #endif | 220 | #endif |
221 | #endif | 221 | #endif |
diff --git a/include/linux/in.h b/include/linux/in.h index bcaca8399aed..d79fc75fa7c2 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -123,17 +123,17 @@ struct ip_mreqn | |||
123 | }; | 123 | }; |
124 | 124 | ||
125 | struct ip_mreq_source { | 125 | struct ip_mreq_source { |
126 | __u32 imr_multiaddr; | 126 | __be32 imr_multiaddr; |
127 | __u32 imr_interface; | 127 | __be32 imr_interface; |
128 | __u32 imr_sourceaddr; | 128 | __be32 imr_sourceaddr; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct ip_msfilter { | 131 | struct ip_msfilter { |
132 | __u32 imsf_multiaddr; | 132 | __be32 imsf_multiaddr; |
133 | __u32 imsf_interface; | 133 | __be32 imsf_interface; |
134 | __u32 imsf_fmode; | 134 | __u32 imsf_fmode; |
135 | __u32 imsf_numsrc; | 135 | __u32 imsf_numsrc; |
136 | __u32 imsf_slist[1]; | 136 | __be32 imsf_slist[1]; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | #define IP_MSFILTER_SIZE(numsrc) \ | 139 | #define IP_MSFILTER_SIZE(numsrc) \ |
diff --git a/include/linux/in6.h b/include/linux/in6.h index d776829b443f..9be6a4756f0b 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
@@ -32,8 +32,8 @@ struct in6_addr | |||
32 | union | 32 | union |
33 | { | 33 | { |
34 | __u8 u6_addr8[16]; | 34 | __u8 u6_addr8[16]; |
35 | __u16 u6_addr16[8]; | 35 | __be16 u6_addr16[8]; |
36 | __u32 u6_addr32[4]; | 36 | __be32 u6_addr32[4]; |
37 | } in6_u; | 37 | } in6_u; |
38 | #define s6_addr in6_u.u6_addr8 | 38 | #define s6_addr in6_u.u6_addr8 |
39 | #define s6_addr16 in6_u.u6_addr16 | 39 | #define s6_addr16 in6_u.u6_addr16 |
@@ -53,7 +53,7 @@ extern const struct in6_addr in6addr_loopback; | |||
53 | 53 | ||
54 | struct sockaddr_in6 { | 54 | struct sockaddr_in6 { |
55 | unsigned short int sin6_family; /* AF_INET6 */ | 55 | unsigned short int sin6_family; /* AF_INET6 */ |
56 | __u16 sin6_port; /* Transport layer port # */ | 56 | __be16 sin6_port; /* Transport layer port # */ |
57 | __u32 sin6_flowinfo; /* IPv6 flow information */ | 57 | __u32 sin6_flowinfo; /* IPv6 flow information */ |
58 | struct in6_addr sin6_addr; /* IPv6 address */ | 58 | struct in6_addr sin6_addr; /* IPv6 address */ |
59 | __u32 sin6_scope_id; /* scope id (new in RFC2553) */ | 59 | __u32 sin6_scope_id; /* scope id (new in RFC2553) */ |
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h index a4606e5810e5..6e8bc548635a 100644 --- a/include/linux/inet_diag.h +++ b/include/linux/inet_diag.h | |||
@@ -9,10 +9,10 @@ | |||
9 | 9 | ||
10 | /* Socket identity */ | 10 | /* Socket identity */ |
11 | struct inet_diag_sockid { | 11 | struct inet_diag_sockid { |
12 | __u16 idiag_sport; | 12 | __be16 idiag_sport; |
13 | __u16 idiag_dport; | 13 | __be16 idiag_dport; |
14 | __u32 idiag_src[4]; | 14 | __be32 idiag_src[4]; |
15 | __u32 idiag_dst[4]; | 15 | __be32 idiag_dst[4]; |
16 | __u32 idiag_if; | 16 | __u32 idiag_if; |
17 | __u32 idiag_cookie[2]; | 17 | __u32 idiag_cookie[2]; |
18 | #define INET_DIAG_NOCOOKIE (~0U) | 18 | #define INET_DIAG_NOCOOKIE (~0U) |
@@ -67,7 +67,7 @@ struct inet_diag_hostcond { | |||
67 | __u8 family; | 67 | __u8 family; |
68 | __u8 prefix_len; | 68 | __u8 prefix_len; |
69 | int port; | 69 | int port; |
70 | __u32 addr[0]; | 70 | __be32 addr[0]; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | /* Base info structure. It contains socket identity (addrs/ports/cookie) | 73 | /* Base info structure. It contains socket identity (addrs/ports/cookie) |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 92297ff24e85..5a0ab04627bc 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -90,11 +90,11 @@ struct in_ifaddr | |||
90 | struct in_ifaddr *ifa_next; | 90 | struct in_ifaddr *ifa_next; |
91 | struct in_device *ifa_dev; | 91 | struct in_device *ifa_dev; |
92 | struct rcu_head rcu_head; | 92 | struct rcu_head rcu_head; |
93 | u32 ifa_local; | 93 | __be32 ifa_local; |
94 | u32 ifa_address; | 94 | __be32 ifa_address; |
95 | u32 ifa_mask; | 95 | __be32 ifa_mask; |
96 | u32 ifa_broadcast; | 96 | __be32 ifa_broadcast; |
97 | u32 ifa_anycast; | 97 | __be32 ifa_anycast; |
98 | unsigned char ifa_scope; | 98 | unsigned char ifa_scope; |
99 | unsigned char ifa_flags; | 99 | unsigned char ifa_flags; |
100 | unsigned char ifa_prefixlen; | 100 | unsigned char ifa_prefixlen; |
@@ -104,18 +104,18 @@ struct in_ifaddr | |||
104 | extern int register_inetaddr_notifier(struct notifier_block *nb); | 104 | extern int register_inetaddr_notifier(struct notifier_block *nb); |
105 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); | 105 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); |
106 | 106 | ||
107 | extern struct net_device *ip_dev_find(u32 addr); | 107 | extern struct net_device *ip_dev_find(__be32 addr); |
108 | extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b); | 108 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); |
109 | extern int devinet_ioctl(unsigned int cmd, void __user *); | 109 | extern int devinet_ioctl(unsigned int cmd, void __user *); |
110 | extern void devinet_init(void); | 110 | extern void devinet_init(void); |
111 | extern struct in_device *inetdev_init(struct net_device *dev); | 111 | extern struct in_device *inetdev_init(struct net_device *dev); |
112 | extern struct in_device *inetdev_by_index(int); | 112 | extern struct in_device *inetdev_by_index(int); |
113 | extern u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope); | 113 | extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); |
114 | extern u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope); | 114 | extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope); |
115 | extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask); | 115 | extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); |
116 | extern void inet_forward_change(void); | 116 | extern void inet_forward_change(void); |
117 | 117 | ||
118 | static __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa) | 118 | static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) |
119 | { | 119 | { |
120 | return !((addr^ifa->ifa_address)&ifa->ifa_mask); | 120 | return !((addr^ifa->ifa_address)&ifa->ifa_mask); |
121 | } | 121 | } |
@@ -183,7 +183,7 @@ static inline void in_dev_put(struct in_device *idev) | |||
183 | 183 | ||
184 | #endif /* __KERNEL__ */ | 184 | #endif /* __KERNEL__ */ |
185 | 185 | ||
186 | static __inline__ __u32 inet_make_mask(int logmask) | 186 | static __inline__ __be32 inet_make_mask(int logmask) |
187 | { | 187 | { |
188 | if (logmask) | 188 | if (logmask) |
189 | return htonl(~((1<<(32-logmask))-1)); | 189 | return htonl(~((1<<(32-logmask))-1)); |
diff --git a/include/linux/ip.h b/include/linux/ip.h index 2f4600146f83..6b25d36fc54c 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
@@ -96,7 +96,7 @@ struct iphdr { | |||
96 | __be16 frag_off; | 96 | __be16 frag_off; |
97 | __u8 ttl; | 97 | __u8 ttl; |
98 | __u8 protocol; | 98 | __u8 protocol; |
99 | __u16 check; | 99 | __be16 check; |
100 | __be32 saddr; | 100 | __be32 saddr; |
101 | __be32 daddr; | 101 | __be32 daddr; |
102 | /*The options start here. */ | 102 | /*The options start here. */ |
@@ -105,22 +105,22 @@ struct iphdr { | |||
105 | struct ip_auth_hdr { | 105 | struct ip_auth_hdr { |
106 | __u8 nexthdr; | 106 | __u8 nexthdr; |
107 | __u8 hdrlen; /* This one is measured in 32 bit units! */ | 107 | __u8 hdrlen; /* This one is measured in 32 bit units! */ |
108 | __u16 reserved; | 108 | __be16 reserved; |
109 | __u32 spi; | 109 | __be32 spi; |
110 | __u32 seq_no; /* Sequence number */ | 110 | __be32 seq_no; /* Sequence number */ |
111 | __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ | 111 | __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | struct ip_esp_hdr { | 114 | struct ip_esp_hdr { |
115 | __u32 spi; | 115 | __be32 spi; |
116 | __u32 seq_no; /* Sequence number */ | 116 | __be32 seq_no; /* Sequence number */ |
117 | __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ | 117 | __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct ip_comp_hdr { | 120 | struct ip_comp_hdr { |
121 | __u8 nexthdr; | 121 | __u8 nexthdr; |
122 | __u8 flags; | 122 | __u8 flags; |
123 | __u16 cpi; | 123 | __be16 cpi; |
124 | }; | 124 | }; |
125 | 125 | ||
126 | #endif /* _LINUX_IP_H */ | 126 | #endif /* _LINUX_IP_H */ |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index caca57df0d7d..4f435c59de06 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -99,22 +99,22 @@ struct ipv6_destopt_hao { | |||
99 | struct ipv6_auth_hdr { | 99 | struct ipv6_auth_hdr { |
100 | __u8 nexthdr; | 100 | __u8 nexthdr; |
101 | __u8 hdrlen; /* This one is measured in 32 bit units! */ | 101 | __u8 hdrlen; /* This one is measured in 32 bit units! */ |
102 | __u16 reserved; | 102 | __be16 reserved; |
103 | __u32 spi; | 103 | __be32 spi; |
104 | __u32 seq_no; /* Sequence number */ | 104 | __be32 seq_no; /* Sequence number */ |
105 | __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */ | 105 | __u8 auth_data[0]; /* Length variable but >=4. Mind the 64 bit alignment! */ |
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct ipv6_esp_hdr { | 108 | struct ipv6_esp_hdr { |
109 | __u32 spi; | 109 | __be32 spi; |
110 | __u32 seq_no; /* Sequence number */ | 110 | __be32 seq_no; /* Sequence number */ |
111 | __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ | 111 | __u8 enc_data[0]; /* Length variable but >=8. Mind the 64 bit alignment! */ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | struct ipv6_comp_hdr { | 114 | struct ipv6_comp_hdr { |
115 | __u8 nexthdr; | 115 | __u8 nexthdr; |
116 | __u8 flags; | 116 | __u8 flags; |
117 | __u16 cpi; | 117 | __be16 cpi; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* | 120 | /* |
@@ -136,7 +136,7 @@ struct ipv6hdr { | |||
136 | #endif | 136 | #endif |
137 | __u8 flow_lbl[3]; | 137 | __u8 flow_lbl[3]; |
138 | 138 | ||
139 | __u16 payload_len; | 139 | __be16 payload_len; |
140 | __u8 nexthdr; | 140 | __u8 nexthdr; |
141 | __u8 hop_limit; | 141 | __u8 hop_limit; |
142 | 142 | ||
@@ -461,7 +461,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
461 | 461 | ||
462 | #define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ | 462 | #define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ |
463 | (((__sk)->sk_hash == (__hash)) && \ | 463 | (((__sk)->sk_hash == (__hash)) && \ |
464 | ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 464 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
465 | ((__sk)->sk_family == AF_INET6) && \ | 465 | ((__sk)->sk_family == AF_INET6) && \ |
466 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ | 466 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ |
467 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ | 467 | ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ |
diff --git a/include/linux/mroute.h b/include/linux/mroute.h index e05d54a90743..7da2cee8e132 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h | |||
@@ -142,7 +142,7 @@ struct vif_device | |||
142 | unsigned long rate_limit; /* Traffic shaping (NI) */ | 142 | unsigned long rate_limit; /* Traffic shaping (NI) */ |
143 | unsigned char threshold; /* TTL threshold */ | 143 | unsigned char threshold; /* TTL threshold */ |
144 | unsigned short flags; /* Control flags */ | 144 | unsigned short flags; /* Control flags */ |
145 | __u32 local,remote; /* Addresses(remote for tunnels)*/ | 145 | __be32 local,remote; /* Addresses(remote for tunnels)*/ |
146 | int link; /* Physical interface index */ | 146 | int link; /* Physical interface index */ |
147 | }; | 147 | }; |
148 | 148 | ||
@@ -151,8 +151,8 @@ struct vif_device | |||
151 | struct mfc_cache | 151 | struct mfc_cache |
152 | { | 152 | { |
153 | struct mfc_cache *next; /* Next entry on cache line */ | 153 | struct mfc_cache *next; /* Next entry on cache line */ |
154 | __u32 mfc_mcastgrp; /* Group the entry belongs to */ | 154 | __be32 mfc_mcastgrp; /* Group the entry belongs to */ |
155 | __u32 mfc_origin; /* Source of packet */ | 155 | __be32 mfc_origin; /* Source of packet */ |
156 | vifi_t mfc_parent; /* Source interface */ | 156 | vifi_t mfc_parent; /* Source interface */ |
157 | int mfc_flags; /* Flags on line */ | 157 | int mfc_flags; /* Flags on line */ |
158 | 158 | ||
@@ -179,9 +179,9 @@ struct mfc_cache | |||
179 | #define MFC_LINES 64 | 179 | #define MFC_LINES 64 |
180 | 180 | ||
181 | #ifdef __BIG_ENDIAN | 181 | #ifdef __BIG_ENDIAN |
182 | #define MFC_HASH(a,b) ((((a)>>24)^((b)>>26))&(MFC_LINES-1)) | 182 | #define MFC_HASH(a,b) (((((__force u32)(__be32)a)>>24)^(((__force u32)(__be32)b)>>26))&(MFC_LINES-1)) |
183 | #else | 183 | #else |
184 | #define MFC_HASH(a,b) (((a)^((b)>>2))&(MFC_LINES-1)) | 184 | #define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1)) |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | #endif | 187 | #endif |
@@ -213,8 +213,8 @@ struct pimreghdr | |||
213 | { | 213 | { |
214 | __u8 type; | 214 | __u8 type; |
215 | __u8 reserved; | 215 | __u8 reserved; |
216 | __u16 csum; | 216 | __be16 csum; |
217 | __u32 flags; | 217 | __be32 flags; |
218 | }; | 218 | }; |
219 | 219 | ||
220 | extern int pim_rcv_v1(struct sk_buff *); | 220 | extern int pim_rcv_v1(struct sk_buff *); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 13d6d4eb8b3a..9264139bd8df 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -187,7 +187,7 @@ struct hh_cache | |||
187 | { | 187 | { |
188 | struct hh_cache *hh_next; /* Next entry */ | 188 | struct hh_cache *hh_next; /* Next entry */ |
189 | atomic_t hh_refcnt; /* number of users */ | 189 | atomic_t hh_refcnt; /* number of users */ |
190 | unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP | 190 | __be16 hh_type; /* protocol identifier, f.e ETH_P_IP |
191 | * NOTE: For VLANs, this will be the | 191 | * NOTE: For VLANs, this will be the |
192 | * encapuslated type. --BLG | 192 | * encapuslated type. --BLG |
193 | */ | 193 | */ |
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 149e87c9ab13..44e39b61d9e7 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h | |||
@@ -46,11 +46,11 @@ struct arpt_arp { | |||
46 | struct arpt_devaddr_info tgt_devaddr; | 46 | struct arpt_devaddr_info tgt_devaddr; |
47 | 47 | ||
48 | /* ARP operation code. */ | 48 | /* ARP operation code. */ |
49 | u_int16_t arpop, arpop_mask; | 49 | __be16 arpop, arpop_mask; |
50 | 50 | ||
51 | /* ARP hardware address and protocol address format. */ | 51 | /* ARP hardware address and protocol address format. */ |
52 | u_int16_t arhrd, arhrd_mask; | 52 | __be16 arhrd, arhrd_mask; |
53 | u_int16_t arpro, arpro_mask; | 53 | __be16 arpro, arpro_mask; |
54 | 54 | ||
55 | /* The protocol address length is only accepted if it is 4 | 55 | /* The protocol address length is only accepted if it is 4 |
56 | * so there is no use in offering a way to do filtering on it. | 56 | * so there is no use in offering a way to do filtering on it. |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index 51dbec1892c8..64e868034c4a 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h | |||
@@ -157,7 +157,7 @@ struct ip_conntrack_expect | |||
157 | unsigned int flags; | 157 | unsigned int flags; |
158 | 158 | ||
159 | #ifdef CONFIG_IP_NF_NAT_NEEDED | 159 | #ifdef CONFIG_IP_NF_NAT_NEEDED |
160 | u_int32_t saved_ip; | 160 | __be32 saved_ip; |
161 | /* This is the original per-proto part, used to map the | 161 | /* This is the original per-proto part, used to map the |
162 | * expected connection the way the recipient expects. */ | 162 | * expected connection the way the recipient expects. */ |
163 | union ip_conntrack_manip_proto saved_proto; | 163 | union ip_conntrack_manip_proto saved_proto; |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h index 3cbff7379002..943cc6a4871d 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h | |||
@@ -30,7 +30,7 @@ struct ip_ct_h323_master { | |||
30 | struct ip_conntrack_expect; | 30 | struct ip_conntrack_expect; |
31 | 31 | ||
32 | extern int get_h225_addr(unsigned char *data, TransportAddress * addr, | 32 | extern int get_h225_addr(unsigned char *data, TransportAddress * addr, |
33 | u_int32_t * ip, u_int16_t * port); | 33 | __be32 * ip, u_int16_t * port); |
34 | extern void ip_conntrack_h245_expect(struct ip_conntrack *new, | 34 | extern void ip_conntrack_h245_expect(struct ip_conntrack *new, |
35 | struct ip_conntrack_expect *this); | 35 | struct ip_conntrack_expect *this); |
36 | extern void ip_conntrack_q931_expect(struct ip_conntrack *new, | 36 | extern void ip_conntrack_q931_expect(struct ip_conntrack *new, |
@@ -38,11 +38,11 @@ extern void ip_conntrack_q931_expect(struct ip_conntrack *new, | |||
38 | extern int (*set_h245_addr_hook) (struct sk_buff ** pskb, | 38 | extern int (*set_h245_addr_hook) (struct sk_buff ** pskb, |
39 | unsigned char **data, int dataoff, | 39 | unsigned char **data, int dataoff, |
40 | H245_TransportAddress * addr, | 40 | H245_TransportAddress * addr, |
41 | u_int32_t ip, u_int16_t port); | 41 | __be32 ip, u_int16_t port); |
42 | extern int (*set_h225_addr_hook) (struct sk_buff ** pskb, | 42 | extern int (*set_h225_addr_hook) (struct sk_buff ** pskb, |
43 | unsigned char **data, int dataoff, | 43 | unsigned char **data, int dataoff, |
44 | TransportAddress * addr, | 44 | TransportAddress * addr, |
45 | u_int32_t ip, u_int16_t port); | 45 | __be32 ip, u_int16_t port); |
46 | extern int (*set_sig_addr_hook) (struct sk_buff ** pskb, | 46 | extern int (*set_sig_addr_hook) (struct sk_buff ** pskb, |
47 | struct ip_conntrack * ct, | 47 | struct ip_conntrack * ct, |
48 | enum ip_conntrack_info ctinfo, | 48 | enum ip_conntrack_info ctinfo, |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index 2fdabdb4c0ef..c228bde74c33 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h | |||
@@ -23,13 +23,13 @@ union ip_conntrack_manip_proto | |||
23 | __be16 port; | 23 | __be16 port; |
24 | } tcp; | 24 | } tcp; |
25 | struct { | 25 | struct { |
26 | u_int16_t port; | 26 | __be16 port; |
27 | } udp; | 27 | } udp; |
28 | struct { | 28 | struct { |
29 | u_int16_t id; | 29 | __be16 id; |
30 | } icmp; | 30 | } icmp; |
31 | struct { | 31 | struct { |
32 | u_int16_t port; | 32 | __be16 port; |
33 | } sctp; | 33 | } sctp; |
34 | struct { | 34 | struct { |
35 | __be16 key; /* key is 32bit, pptp only uses 16 */ | 35 | __be16 key; /* key is 32bit, pptp only uses 16 */ |
@@ -39,7 +39,7 @@ union ip_conntrack_manip_proto | |||
39 | /* The manipulable part of the tuple. */ | 39 | /* The manipulable part of the tuple. */ |
40 | struct ip_conntrack_manip | 40 | struct ip_conntrack_manip |
41 | { | 41 | { |
42 | u_int32_t ip; | 42 | __be32 ip; |
43 | union ip_conntrack_manip_proto u; | 43 | union ip_conntrack_manip_proto u; |
44 | }; | 44 | }; |
45 | 45 | ||
@@ -50,22 +50,22 @@ struct ip_conntrack_tuple | |||
50 | 50 | ||
51 | /* These are the parts of the tuple which are fixed. */ | 51 | /* These are the parts of the tuple which are fixed. */ |
52 | struct { | 52 | struct { |
53 | u_int32_t ip; | 53 | __be32 ip; |
54 | union { | 54 | union { |
55 | /* Add other protocols here. */ | 55 | /* Add other protocols here. */ |
56 | u_int16_t all; | 56 | u_int16_t all; |
57 | 57 | ||
58 | struct { | 58 | struct { |
59 | u_int16_t port; | 59 | __be16 port; |
60 | } tcp; | 60 | } tcp; |
61 | struct { | 61 | struct { |
62 | u_int16_t port; | 62 | __be16 port; |
63 | } udp; | 63 | } udp; |
64 | struct { | 64 | struct { |
65 | u_int8_t type, code; | 65 | u_int8_t type, code; |
66 | } icmp; | 66 | } icmp; |
67 | struct { | 67 | struct { |
68 | u_int16_t port; | 68 | __be16 port; |
69 | } sctp; | 69 | } sctp; |
70 | struct { | 70 | struct { |
71 | __be16 key; /* key is 32bit, | 71 | __be16 key; /* key is 32bit, |
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h index 98f8407e4cb5..bdf553620ca1 100644 --- a/include/linux/netfilter_ipv4/ip_nat.h +++ b/include/linux/netfilter_ipv4/ip_nat.h | |||
@@ -33,7 +33,7 @@ struct ip_nat_range | |||
33 | unsigned int flags; | 33 | unsigned int flags; |
34 | 34 | ||
35 | /* Inclusive: network order. */ | 35 | /* Inclusive: network order. */ |
36 | u_int32_t min_ip, max_ip; | 36 | __be32 min_ip, max_ip; |
37 | 37 | ||
38 | /* Inclusive: network order */ | 38 | /* Inclusive: network order */ |
39 | union ip_conntrack_manip_proto min, max; | 39 | union ip_conntrack_manip_proto min, max; |
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h index aa08d68c4841..a03507f465f8 100644 --- a/include/linux/netfilter_ipv4/ip_queue.h +++ b/include/linux/netfilter_ipv4/ip_queue.h | |||
@@ -26,7 +26,7 @@ typedef struct ipq_packet_msg { | |||
26 | unsigned int hook; /* Netfilter hook we rode in on */ | 26 | unsigned int hook; /* Netfilter hook we rode in on */ |
27 | char indev_name[IFNAMSIZ]; /* Name of incoming interface */ | 27 | char indev_name[IFNAMSIZ]; /* Name of incoming interface */ |
28 | char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ | 28 | char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ |
29 | unsigned short hw_protocol; /* Hardware protocol (network order) */ | 29 | __be16 hw_protocol; /* Hardware protocol (network order) */ |
30 | unsigned short hw_type; /* Hardware type */ | 30 | unsigned short hw_type; /* Hardware type */ |
31 | unsigned char hw_addrlen; /* Hardware address length */ | 31 | unsigned char hw_addrlen; /* Hardware address length */ |
32 | unsigned char hw_addr[8]; /* Hardware address */ | 32 | unsigned char hw_addr[8]; /* Hardware address */ |
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h index 3ecb3bd63676..34ab0fb736e2 100644 --- a/include/linux/netfilter_ipv4/ipt_iprange.h +++ b/include/linux/netfilter_ipv4/ipt_iprange.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | struct ipt_iprange { | 9 | struct ipt_iprange { |
10 | /* Inclusive: network order. */ | 10 | /* Inclusive: network order. */ |
11 | u_int32_t min_ip, max_ip; | 11 | __be32 min_ip, max_ip; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | struct ipt_iprange_info | 14 | struct ipt_iprange_info |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 61db1907f06f..b7e85ff045ea 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1904,6 +1904,7 @@ | |||
1904 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 1904 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
1905 | #define PCI_DEVICE_ID_TIGON3_5720 0x1658 | 1905 | #define PCI_DEVICE_ID_TIGON3_5720 0x1658 |
1906 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 | 1906 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 |
1907 | #define PCI_DEVICE_ID_TIGON3_5722 0x165a | ||
1907 | #define PCI_DEVICE_ID_TIGON3_5705M 0x165d | 1908 | #define PCI_DEVICE_ID_TIGON3_5705M 0x165d |
1908 | #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e | 1909 | #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e |
1909 | #define PCI_DEVICE_ID_TIGON3_5714 0x1668 | 1910 | #define PCI_DEVICE_ID_TIGON3_5714 0x1668 |
@@ -1913,6 +1914,7 @@ | |||
1913 | #define PCI_DEVICE_ID_TIGON3_5705F 0x166e | 1914 | #define PCI_DEVICE_ID_TIGON3_5705F 0x166e |
1914 | #define PCI_DEVICE_ID_TIGON3_5754M 0x1672 | 1915 | #define PCI_DEVICE_ID_TIGON3_5754M 0x1672 |
1915 | #define PCI_DEVICE_ID_TIGON3_5755M 0x1673 | 1916 | #define PCI_DEVICE_ID_TIGON3_5755M 0x1673 |
1917 | #define PCI_DEVICE_ID_TIGON3_5756 0x1674 | ||
1916 | #define PCI_DEVICE_ID_TIGON3_5750 0x1676 | 1918 | #define PCI_DEVICE_ID_TIGON3_5750 0x1676 |
1917 | #define PCI_DEVICE_ID_TIGON3_5751 0x1677 | 1919 | #define PCI_DEVICE_ID_TIGON3_5751 0x1677 |
1918 | #define PCI_DEVICE_ID_TIGON3_5715 0x1678 | 1920 | #define PCI_DEVICE_ID_TIGON3_5715 0x1678 |
@@ -1942,6 +1944,8 @@ | |||
1942 | #define PCI_DEVICE_ID_TIGON3_5901 0x170d | 1944 | #define PCI_DEVICE_ID_TIGON3_5901 0x170d |
1943 | #define PCI_DEVICE_ID_BCM4401B1 0x170c | 1945 | #define PCI_DEVICE_ID_BCM4401B1 0x170c |
1944 | #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e | 1946 | #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e |
1947 | #define PCI_DEVICE_ID_TIGON3_5906 0x1712 | ||
1948 | #define PCI_DEVICE_ID_TIGON3_5906M 0x1713 | ||
1945 | #define PCI_DEVICE_ID_BCM4401 0x4401 | 1949 | #define PCI_DEVICE_ID_BCM4401 0x4401 |
1946 | #define PCI_DEVICE_ID_BCM4401B0 0x4402 | 1950 | #define PCI_DEVICE_ID_BCM4401B0 0x4402 |
1947 | 1951 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 9c92dc8b9a08..3a18addaed4c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __LINUX_RTNETLINK_H | 2 | #define __LINUX_RTNETLINK_H |
3 | 3 | ||
4 | #include <linux/netlink.h> | 4 | #include <linux/netlink.h> |
5 | #include <linux/if.h> | 5 | #include <linux/if_link.h> |
6 | 6 | ||
7 | /**** | 7 | /**** |
8 | * Routing/neighbour discovery messages. | 8 | * Routing/neighbour discovery messages. |
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index a6de332e57d4..862c0d8c8381 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -109,13 +109,13 @@ struct rpc_credops { | |||
109 | void (*crdestroy)(struct rpc_cred *); | 109 | void (*crdestroy)(struct rpc_cred *); |
110 | 110 | ||
111 | int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); | 111 | int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); |
112 | u32 * (*crmarshal)(struct rpc_task *, u32 *); | 112 | __be32 * (*crmarshal)(struct rpc_task *, __be32 *); |
113 | int (*crrefresh)(struct rpc_task *); | 113 | int (*crrefresh)(struct rpc_task *); |
114 | u32 * (*crvalidate)(struct rpc_task *, u32 *); | 114 | __be32 * (*crvalidate)(struct rpc_task *, __be32 *); |
115 | int (*crwrap_req)(struct rpc_task *, kxdrproc_t, | 115 | int (*crwrap_req)(struct rpc_task *, kxdrproc_t, |
116 | void *, u32 *, void *); | 116 | void *, __be32 *, void *); |
117 | int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, | 117 | int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, |
118 | void *, u32 *, void *); | 118 | void *, __be32 *, void *); |
119 | }; | 119 | }; |
120 | 120 | ||
121 | extern struct rpc_authops authunix_ops; | 121 | extern struct rpc_authops authunix_ops; |
@@ -134,10 +134,10 @@ struct rpc_cred * rpcauth_bindcred(struct rpc_task *); | |||
134 | void rpcauth_holdcred(struct rpc_task *); | 134 | void rpcauth_holdcred(struct rpc_task *); |
135 | void put_rpccred(struct rpc_cred *); | 135 | void put_rpccred(struct rpc_cred *); |
136 | void rpcauth_unbindcred(struct rpc_task *); | 136 | void rpcauth_unbindcred(struct rpc_task *); |
137 | u32 * rpcauth_marshcred(struct rpc_task *, u32 *); | 137 | __be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); |
138 | u32 * rpcauth_checkverf(struct rpc_task *, u32 *); | 138 | __be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); |
139 | int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, u32 *data, void *obj); | 139 | int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj); |
140 | int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, u32 *data, void *obj); | 140 | int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj); |
141 | int rpcauth_refreshcred(struct rpc_task *); | 141 | int rpcauth_refreshcred(struct rpc_task *); |
142 | void rpcauth_invalcred(struct rpc_task *); | 142 | void rpcauth_invalcred(struct rpc_task *); |
143 | int rpcauth_uptodatecred(struct rpc_task *); | 143 | int rpcauth_uptodatecred(struct rpc_task *); |
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index f43f237360ae..d9f5934ac9fe 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h | |||
@@ -95,7 +95,7 @@ enum rpc_auth_stat { | |||
95 | * 2GB. | 95 | * 2GB. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | typedef u32 rpc_fraghdr; | 98 | typedef __be32 rpc_fraghdr; |
99 | 99 | ||
100 | #define RPC_LAST_STREAM_FRAGMENT (1U << 31) | 100 | #define RPC_LAST_STREAM_FRAGMENT (1U << 31) |
101 | #define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) | 101 | #define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 7b27c09b5604..73140ee5c638 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -78,28 +78,45 @@ struct svc_serv { | |||
78 | */ | 78 | */ |
79 | #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) | 79 | #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) |
80 | 80 | ||
81 | static inline u32 svc_getu32(struct kvec *iov) | 81 | static inline u32 svc_getnl(struct kvec *iov) |
82 | { | 82 | { |
83 | u32 val, *vp; | 83 | __be32 val, *vp; |
84 | vp = iov->iov_base; | 84 | vp = iov->iov_base; |
85 | val = *vp++; | 85 | val = *vp++; |
86 | iov->iov_base = (void*)vp; | 86 | iov->iov_base = (void*)vp; |
87 | iov->iov_len -= sizeof(u32); | 87 | iov->iov_len -= sizeof(__be32); |
88 | return ntohl(val); | ||
89 | } | ||
90 | |||
91 | static inline void svc_putnl(struct kvec *iov, u32 val) | ||
92 | { | ||
93 | __be32 *vp = iov->iov_base + iov->iov_len; | ||
94 | *vp = htonl(val); | ||
95 | iov->iov_len += sizeof(__be32); | ||
96 | } | ||
97 | |||
98 | static inline __be32 svc_getu32(struct kvec *iov) | ||
99 | { | ||
100 | __be32 val, *vp; | ||
101 | vp = iov->iov_base; | ||
102 | val = *vp++; | ||
103 | iov->iov_base = (void*)vp; | ||
104 | iov->iov_len -= sizeof(__be32); | ||
88 | return val; | 105 | return val; |
89 | } | 106 | } |
90 | 107 | ||
91 | static inline void svc_ungetu32(struct kvec *iov) | 108 | static inline void svc_ungetu32(struct kvec *iov) |
92 | { | 109 | { |
93 | u32 *vp = (u32 *)iov->iov_base; | 110 | __be32 *vp = (__be32 *)iov->iov_base; |
94 | iov->iov_base = (void *)(vp - 1); | 111 | iov->iov_base = (void *)(vp - 1); |
95 | iov->iov_len += sizeof(*vp); | 112 | iov->iov_len += sizeof(*vp); |
96 | } | 113 | } |
97 | 114 | ||
98 | static inline void svc_putu32(struct kvec *iov, u32 val) | 115 | static inline void svc_putu32(struct kvec *iov, __be32 val) |
99 | { | 116 | { |
100 | u32 *vp = iov->iov_base + iov->iov_len; | 117 | __be32 *vp = iov->iov_base + iov->iov_len; |
101 | *vp = val; | 118 | *vp = val; |
102 | iov->iov_len += sizeof(u32); | 119 | iov->iov_len += sizeof(__be32); |
103 | } | 120 | } |
104 | 121 | ||
105 | 122 | ||
@@ -130,7 +147,7 @@ struct svc_rqst { | |||
130 | short rq_arghi; /* pages available in argument page list */ | 147 | short rq_arghi; /* pages available in argument page list */ |
131 | short rq_resused; /* pages used for result */ | 148 | short rq_resused; /* pages used for result */ |
132 | 149 | ||
133 | u32 rq_xid; /* transmission id */ | 150 | __be32 rq_xid; /* transmission id */ |
134 | u32 rq_prog; /* program number */ | 151 | u32 rq_prog; /* program number */ |
135 | u32 rq_vers; /* program version */ | 152 | u32 rq_vers; /* program version */ |
136 | u32 rq_proc; /* procedure number */ | 153 | u32 rq_proc; /* procedure number */ |
@@ -139,7 +156,7 @@ struct svc_rqst { | |||
139 | rq_secure : 1; /* secure port */ | 156 | rq_secure : 1; /* secure port */ |
140 | 157 | ||
141 | 158 | ||
142 | __u32 rq_daddr; /* dest addr of request - reply from here */ | 159 | __be32 rq_daddr; /* dest addr of request - reply from here */ |
143 | 160 | ||
144 | void * rq_argp; /* decoded arguments */ | 161 | void * rq_argp; /* decoded arguments */ |
145 | void * rq_resp; /* xdr'd results */ | 162 | void * rq_resp; /* xdr'd results */ |
@@ -169,7 +186,7 @@ struct svc_rqst { | |||
169 | * Check buffer bounds after decoding arguments | 186 | * Check buffer bounds after decoding arguments |
170 | */ | 187 | */ |
171 | static inline int | 188 | static inline int |
172 | xdr_argsize_check(struct svc_rqst *rqstp, u32 *p) | 189 | xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p) |
173 | { | 190 | { |
174 | char *cp = (char *)p; | 191 | char *cp = (char *)p; |
175 | struct kvec *vec = &rqstp->rq_arg.head[0]; | 192 | struct kvec *vec = &rqstp->rq_arg.head[0]; |
@@ -178,7 +195,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p) | |||
178 | } | 195 | } |
179 | 196 | ||
180 | static inline int | 197 | static inline int |
181 | xdr_ressize_check(struct svc_rqst *rqstp, u32 *p) | 198 | xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p) |
182 | { | 199 | { |
183 | struct kvec *vec = &rqstp->rq_res.head[0]; | 200 | struct kvec *vec = &rqstp->rq_res.head[0]; |
184 | char *cp = (char*)p; | 201 | char *cp = (char*)p; |
@@ -249,10 +266,10 @@ struct svc_deferred_req { | |||
249 | u32 prot; /* protocol (UDP or TCP) */ | 266 | u32 prot; /* protocol (UDP or TCP) */ |
250 | struct sockaddr_in addr; | 267 | struct sockaddr_in addr; |
251 | struct svc_sock *svsk; /* where reply must go */ | 268 | struct svc_sock *svsk; /* where reply must go */ |
252 | u32 daddr; /* where reply must come from */ | 269 | __be32 daddr; /* where reply must come from */ |
253 | struct cache_deferred_req handle; | 270 | struct cache_deferred_req handle; |
254 | int argslen; | 271 | int argslen; |
255 | u32 args[0]; | 272 | __be32 args[0]; |
256 | }; | 273 | }; |
257 | 274 | ||
258 | /* | 275 | /* |
@@ -284,7 +301,7 @@ struct svc_version { | |||
284 | * A return value of 0 means drop the request. | 301 | * A return value of 0 means drop the request. |
285 | * vs_dispatch == NULL means use default dispatcher. | 302 | * vs_dispatch == NULL means use default dispatcher. |
286 | */ | 303 | */ |
287 | int (*vs_dispatch)(struct svc_rqst *, u32 *); | 304 | int (*vs_dispatch)(struct svc_rqst *, __be32 *); |
288 | }; | 305 | }; |
289 | 306 | ||
290 | /* | 307 | /* |
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h index 2fe2087edd66..a6601650deeb 100644 --- a/include/linux/sunrpc/svcauth.h +++ b/include/linux/sunrpc/svcauth.h | |||
@@ -95,7 +95,7 @@ struct auth_ops { | |||
95 | char * name; | 95 | char * name; |
96 | struct module *owner; | 96 | struct module *owner; |
97 | int flavour; | 97 | int flavour; |
98 | int (*accept)(struct svc_rqst *rq, u32 *authp); | 98 | int (*accept)(struct svc_rqst *rq, __be32 *authp); |
99 | int (*release)(struct svc_rqst *rq); | 99 | int (*release)(struct svc_rqst *rq); |
100 | void (*domain_release)(struct auth_domain *); | 100 | void (*domain_release)(struct auth_domain *); |
101 | int (*set_client)(struct svc_rqst *rq); | 101 | int (*set_client)(struct svc_rqst *rq); |
@@ -112,7 +112,7 @@ struct auth_ops { | |||
112 | #define SVC_COMPLETE 9 | 112 | #define SVC_COMPLETE 9 |
113 | 113 | ||
114 | 114 | ||
115 | extern int svc_authenticate(struct svc_rqst *rqstp, u32 *authp); | 115 | extern int svc_authenticate(struct svc_rqst *rqstp, __be32 *authp); |
116 | extern int svc_authorise(struct svc_rqst *rqstp); | 116 | extern int svc_authorise(struct svc_rqst *rqstp); |
117 | extern int svc_set_client(struct svc_rqst *rqstp); | 117 | extern int svc_set_client(struct svc_rqst *rqstp); |
118 | extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops); | 118 | extern int svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops); |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index e6d3d349506c..953723b09bc6 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -32,7 +32,7 @@ struct xdr_netobj { | |||
32 | * side) or svc_rqst pointer (server side). | 32 | * side) or svc_rqst pointer (server side). |
33 | * Encode functions always assume there's enough room in the buffer. | 33 | * Encode functions always assume there's enough room in the buffer. |
34 | */ | 34 | */ |
35 | typedef int (*kxdrproc_t)(void *rqstp, u32 *data, void *obj); | 35 | typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * Basic structure for transmission/reception of a client XDR message. | 38 | * Basic structure for transmission/reception of a client XDR message. |
@@ -88,19 +88,19 @@ struct xdr_buf { | |||
88 | /* | 88 | /* |
89 | * Miscellaneous XDR helper functions | 89 | * Miscellaneous XDR helper functions |
90 | */ | 90 | */ |
91 | u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len); | 91 | __be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len); |
92 | u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len); | 92 | __be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len); |
93 | u32 * xdr_encode_string(u32 *p, const char *s); | 93 | __be32 *xdr_encode_string(__be32 *p, const char *s); |
94 | u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen); | 94 | __be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen); |
95 | u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); | 95 | __be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *); |
96 | u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); | 96 | __be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *); |
97 | 97 | ||
98 | void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int, | 98 | void xdr_encode_pages(struct xdr_buf *, struct page **, unsigned int, |
99 | unsigned int); | 99 | unsigned int); |
100 | void xdr_inline_pages(struct xdr_buf *, unsigned int, | 100 | void xdr_inline_pages(struct xdr_buf *, unsigned int, |
101 | struct page **, unsigned int, unsigned int); | 101 | struct page **, unsigned int, unsigned int); |
102 | 102 | ||
103 | static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len) | 103 | static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int len) |
104 | { | 104 | { |
105 | return xdr_encode_opaque(p, s, len); | 105 | return xdr_encode_opaque(p, s, len); |
106 | } | 106 | } |
@@ -108,16 +108,16 @@ static inline u32 *xdr_encode_array(u32 *p, const void *s, unsigned int len) | |||
108 | /* | 108 | /* |
109 | * Decode 64bit quantities (NFSv3 support) | 109 | * Decode 64bit quantities (NFSv3 support) |
110 | */ | 110 | */ |
111 | static inline u32 * | 111 | static inline __be32 * |
112 | xdr_encode_hyper(u32 *p, __u64 val) | 112 | xdr_encode_hyper(__be32 *p, __u64 val) |
113 | { | 113 | { |
114 | *p++ = htonl(val >> 32); | 114 | *p++ = htonl(val >> 32); |
115 | *p++ = htonl(val & 0xFFFFFFFF); | 115 | *p++ = htonl(val & 0xFFFFFFFF); |
116 | return p; | 116 | return p; |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline u32 * | 119 | static inline __be32 * |
120 | xdr_decode_hyper(u32 *p, __u64 *valp) | 120 | xdr_decode_hyper(__be32 *p, __u64 *valp) |
121 | { | 121 | { |
122 | *valp = ((__u64) ntohl(*p++)) << 32; | 122 | *valp = ((__u64) ntohl(*p++)) << 32; |
123 | *valp |= ntohl(*p++); | 123 | *valp |= ntohl(*p++); |
@@ -128,7 +128,7 @@ xdr_decode_hyper(u32 *p, __u64 *valp) | |||
128 | * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) | 128 | * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) |
129 | */ | 129 | */ |
130 | static inline int | 130 | static inline int |
131 | xdr_adjust_iovec(struct kvec *iov, u32 *p) | 131 | xdr_adjust_iovec(struct kvec *iov, __be32 *p) |
132 | { | 132 | { |
133 | return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); | 133 | return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); |
134 | } | 134 | } |
@@ -180,19 +180,19 @@ extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, | |||
180 | * Provide some simple tools for XDR buffer overflow-checking etc. | 180 | * Provide some simple tools for XDR buffer overflow-checking etc. |
181 | */ | 181 | */ |
182 | struct xdr_stream { | 182 | struct xdr_stream { |
183 | uint32_t *p; /* start of available buffer */ | 183 | __be32 *p; /* start of available buffer */ |
184 | struct xdr_buf *buf; /* XDR buffer to read/write */ | 184 | struct xdr_buf *buf; /* XDR buffer to read/write */ |
185 | 185 | ||
186 | uint32_t *end; /* end of available buffer space */ | 186 | __be32 *end; /* end of available buffer space */ |
187 | struct kvec *iov; /* pointer to the current kvec */ | 187 | struct kvec *iov; /* pointer to the current kvec */ |
188 | }; | 188 | }; |
189 | 189 | ||
190 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); | 190 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); |
191 | extern uint32_t *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); | 191 | extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); |
192 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, | 192 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, |
193 | unsigned int base, unsigned int len); | 193 | unsigned int base, unsigned int len); |
194 | extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p); | 194 | extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); |
195 | extern uint32_t *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); | 195 | extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); |
196 | extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); | 196 | extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); |
197 | extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); | 197 | extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); |
198 | 198 | ||
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index bdeba8538c71..6cf626580752 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -79,7 +79,7 @@ struct rpc_rqst { | |||
79 | * This is the private part | 79 | * This is the private part |
80 | */ | 80 | */ |
81 | struct rpc_task * rq_task; /* RPC task data */ | 81 | struct rpc_task * rq_task; /* RPC task data */ |
82 | __u32 rq_xid; /* request XID */ | 82 | __be32 rq_xid; /* request XID */ |
83 | int rq_cong; /* has incremented xprt->cong */ | 83 | int rq_cong; /* has incremented xprt->cong */ |
84 | int rq_received; /* receive completed */ | 84 | int rq_received; /* receive completed */ |
85 | u32 rq_seqno; /* gss seq no. used on req. */ | 85 | u32 rq_seqno; /* gss seq no. used on req. */ |
@@ -171,9 +171,9 @@ struct rpc_xprt { | |||
171 | /* | 171 | /* |
172 | * State of TCP reply receive stuff | 172 | * State of TCP reply receive stuff |
173 | */ | 173 | */ |
174 | u32 tcp_recm, /* Fragment header */ | 174 | __be32 tcp_recm, /* Fragment header */ |
175 | tcp_xid, /* Current XID */ | 175 | tcp_xid; /* Current XID */ |
176 | tcp_reclen, /* fragment length */ | 176 | u32 tcp_reclen, /* fragment length */ |
177 | tcp_offset; /* fragment offset */ | 177 | tcp_offset; /* fragment offset */ |
178 | unsigned long tcp_copied, /* copied to request */ | 178 | unsigned long tcp_copied, /* copied to request */ |
179 | tcp_flags; | 179 | tcp_flags; |
@@ -253,7 +253,7 @@ void xprt_release(struct rpc_task *task); | |||
253 | struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); | 253 | struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); |
254 | void xprt_put(struct rpc_xprt *xprt); | 254 | void xprt_put(struct rpc_xprt *xprt); |
255 | 255 | ||
256 | static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) | 256 | static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) |
257 | { | 257 | { |
258 | return p + xprt->tsh_size; | 258 | return p + xprt->tsh_size; |
259 | } | 259 | } |
@@ -268,7 +268,7 @@ void xprt_wait_for_buffer_space(struct rpc_task *task); | |||
268 | void xprt_write_space(struct rpc_xprt *xprt); | 268 | void xprt_write_space(struct rpc_xprt *xprt); |
269 | void xprt_update_rtt(struct rpc_task *task); | 269 | void xprt_update_rtt(struct rpc_task *task); |
270 | void xprt_adjust_cwnd(struct rpc_task *task, int result); | 270 | void xprt_adjust_cwnd(struct rpc_task *task, int result); |
271 | struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid); | 271 | struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); |
272 | void xprt_complete_rqst(struct rpc_task *task, int copied); | 272 | void xprt_complete_rqst(struct rpc_task *task, int copied); |
273 | void xprt_release_rqst_cong(struct rpc_task *task); | 273 | void xprt_release_rqst_cong(struct rpc_task *task); |
274 | void xprt_disconnect(struct rpc_xprt *xprt); | 274 | void xprt_disconnect(struct rpc_xprt *xprt); |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 8ebf497907f8..0e058a2d1c6d 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -21,10 +21,10 @@ | |||
21 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
22 | 22 | ||
23 | struct tcphdr { | 23 | struct tcphdr { |
24 | __u16 source; | 24 | __be16 source; |
25 | __u16 dest; | 25 | __be16 dest; |
26 | __u32 seq; | 26 | __be32 seq; |
27 | __u32 ack_seq; | 27 | __be32 ack_seq; |
28 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 28 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
29 | __u16 res1:4, | 29 | __u16 res1:4, |
30 | doff:4, | 30 | doff:4, |
@@ -50,9 +50,9 @@ struct tcphdr { | |||
50 | #else | 50 | #else |
51 | #error "Adjust your <asm/byteorder.h> defines" | 51 | #error "Adjust your <asm/byteorder.h> defines" |
52 | #endif | 52 | #endif |
53 | __u16 window; | 53 | __be16 window; |
54 | __u16 check; | 54 | __be16 check; |
55 | __u16 urg_ptr; | 55 | __be16 urg_ptr; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | /* | 58 | /* |
@@ -62,7 +62,7 @@ struct tcphdr { | |||
62 | */ | 62 | */ |
63 | union tcp_word_hdr { | 63 | union tcp_word_hdr { |
64 | struct tcphdr hdr; | 64 | struct tcphdr hdr; |
65 | __u32 words[5]; | 65 | __be32 words[5]; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) | 68 | #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) |
@@ -166,6 +166,11 @@ struct tcp_info | |||
166 | #include <net/inet_timewait_sock.h> | 166 | #include <net/inet_timewait_sock.h> |
167 | 167 | ||
168 | /* This defines a selective acknowledgement block. */ | 168 | /* This defines a selective acknowledgement block. */ |
169 | struct tcp_sack_block_wire { | ||
170 | __be32 start_seq; | ||
171 | __be32 end_seq; | ||
172 | }; | ||
173 | |||
169 | struct tcp_sack_block { | 174 | struct tcp_sack_block { |
170 | __u32 start_seq; | 175 | __u32 start_seq; |
171 | __u32 end_seq; | 176 | __u32 end_seq; |
@@ -211,7 +216,7 @@ struct tcp_sock { | |||
211 | * Header prediction flags | 216 | * Header prediction flags |
212 | * 0x5?10 << 16 + snd_wnd in net byte order | 217 | * 0x5?10 << 16 + snd_wnd in net byte order |
213 | */ | 218 | */ |
214 | __u32 pred_flags; | 219 | __be32 pred_flags; |
215 | 220 | ||
216 | /* | 221 | /* |
217 | * RFC793 variables by their proper names. This means you can | 222 | * RFC793 variables by their proper names. This means you can |
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h index 99e02ef54c47..bfc84a7aecc5 100644 --- a/include/linux/trdevice.h +++ b/include/linux/trdevice.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/if_tr.h> | 28 | #include <linux/if_tr.h> |
29 | 29 | ||
30 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
31 | extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev); | 31 | extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev); |
32 | extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); | 32 | extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); |
33 | extern struct net_device *alloc_trdev(int sizeof_priv); | 33 | extern struct net_device *alloc_trdev(int sizeof_priv); |
34 | 34 | ||
diff --git a/include/linux/udp.h b/include/linux/udp.h index 90223f057d50..014b41d1e308 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -20,10 +20,10 @@ | |||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | 21 | ||
22 | struct udphdr { | 22 | struct udphdr { |
23 | __u16 source; | 23 | __be16 source; |
24 | __u16 dest; | 24 | __be16 dest; |
25 | __u16 len; | 25 | __be16 len; |
26 | __u16 check; | 26 | __be16 check; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | /* UDP socket options */ | 29 | /* UDP socket options */ |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 14ecd19f4cdc..430afd058269 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -12,8 +12,8 @@ | |||
12 | */ | 12 | */ |
13 | typedef union | 13 | typedef union |
14 | { | 14 | { |
15 | __u32 a4; | 15 | __be32 a4; |
16 | __u32 a6[4]; | 16 | __be32 a6[4]; |
17 | } xfrm_address_t; | 17 | } xfrm_address_t; |
18 | 18 | ||
19 | /* Ident of a specific xfrm_state. It is used on input to lookup | 19 | /* Ident of a specific xfrm_state. It is used on input to lookup |
@@ -23,7 +23,7 @@ typedef union | |||
23 | struct xfrm_id | 23 | struct xfrm_id |
24 | { | 24 | { |
25 | xfrm_address_t daddr; | 25 | xfrm_address_t daddr; |
26 | __u32 spi; | 26 | __be32 spi; |
27 | __u8 proto; | 27 | __u8 proto; |
28 | }; | 28 | }; |
29 | 29 | ||
@@ -49,10 +49,10 @@ struct xfrm_selector | |||
49 | { | 49 | { |
50 | xfrm_address_t daddr; | 50 | xfrm_address_t daddr; |
51 | xfrm_address_t saddr; | 51 | xfrm_address_t saddr; |
52 | __u16 dport; | 52 | __be16 dport; |
53 | __u16 dport_mask; | 53 | __be16 dport_mask; |
54 | __u16 sport; | 54 | __be16 sport; |
55 | __u16 sport_mask; | 55 | __be16 sport_mask; |
56 | __u16 family; | 56 | __u16 family; |
57 | __u8 prefixlen_d; | 57 | __u8 prefixlen_d; |
58 | __u8 prefixlen_s; | 58 | __u8 prefixlen_s; |
@@ -281,7 +281,7 @@ struct xfrm_usersa_info { | |||
281 | 281 | ||
282 | struct xfrm_usersa_id { | 282 | struct xfrm_usersa_id { |
283 | xfrm_address_t daddr; | 283 | xfrm_address_t daddr; |
284 | __u32 spi; | 284 | __be32 spi; |
285 | __u16 family; | 285 | __u16 family; |
286 | __u8 proto; | 286 | __u8 proto; |
287 | }; | 287 | }; |
diff --git a/include/net/arp.h b/include/net/arp.h index 643bded9f557..6a3d9a7d302b 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
@@ -12,15 +12,15 @@ extern struct neigh_table arp_tbl; | |||
12 | extern void arp_init(void); | 12 | extern void arp_init(void); |
13 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); | 13 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); |
14 | extern int arp_ioctl(unsigned int cmd, void __user *arg); | 14 | extern int arp_ioctl(unsigned int cmd, void __user *arg); |
15 | extern void arp_send(int type, int ptype, u32 dest_ip, | 15 | extern void arp_send(int type, int ptype, __be32 dest_ip, |
16 | struct net_device *dev, u32 src_ip, | 16 | struct net_device *dev, __be32 src_ip, |
17 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); | 17 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); |
18 | extern int arp_bind_neighbour(struct dst_entry *dst); | 18 | extern int arp_bind_neighbour(struct dst_entry *dst); |
19 | extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); | 19 | extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); |
20 | extern void arp_ifdown(struct net_device *dev); | 20 | extern void arp_ifdown(struct net_device *dev); |
21 | 21 | ||
22 | extern struct sk_buff *arp_create(int type, int ptype, u32 dest_ip, | 22 | extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, |
23 | struct net_device *dev, u32 src_ip, | 23 | struct net_device *dev, __be32 src_ip, |
24 | unsigned char *dest_hw, unsigned char *src_hw, | 24 | unsigned char *dest_hw, unsigned char *src_hw, |
25 | unsigned char *target_hw); | 25 | unsigned char *target_hw); |
26 | extern void arp_xmit(struct sk_buff *skb); | 26 | extern void arp_xmit(struct sk_buff *skb); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index b2bdb1aa0429..10a3eec191fd 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -44,12 +44,13 @@ | |||
44 | #define HCI_NOTIFY_VOICE_SETTING 3 | 44 | #define HCI_NOTIFY_VOICE_SETTING 3 |
45 | 45 | ||
46 | /* HCI device types */ | 46 | /* HCI device types */ |
47 | #define HCI_VHCI 0 | 47 | #define HCI_VIRTUAL 0 |
48 | #define HCI_USB 1 | 48 | #define HCI_USB 1 |
49 | #define HCI_PCCARD 2 | 49 | #define HCI_PCCARD 2 |
50 | #define HCI_UART 3 | 50 | #define HCI_UART 3 |
51 | #define HCI_RS232 4 | 51 | #define HCI_RS232 4 |
52 | #define HCI_PCI 5 | 52 | #define HCI_PCI 5 |
53 | #define HCI_SDIO 6 | ||
53 | 54 | ||
54 | /* HCI device quirks */ | 55 | /* HCI device quirks */ |
55 | enum { | 56 | enum { |
@@ -296,6 +297,7 @@ struct hci_cp_host_buffer_size { | |||
296 | 297 | ||
297 | /* Link Control */ | 298 | /* Link Control */ |
298 | #define OGF_LINK_CTL 0x01 | 299 | #define OGF_LINK_CTL 0x01 |
300 | |||
299 | #define OCF_CREATE_CONN 0x0005 | 301 | #define OCF_CREATE_CONN 0x0005 |
300 | struct hci_cp_create_conn { | 302 | struct hci_cp_create_conn { |
301 | bdaddr_t bdaddr; | 303 | bdaddr_t bdaddr; |
@@ -306,6 +308,11 @@ struct hci_cp_create_conn { | |||
306 | __u8 role_switch; | 308 | __u8 role_switch; |
307 | } __attribute__ ((packed)); | 309 | } __attribute__ ((packed)); |
308 | 310 | ||
311 | #define OCF_CREATE_CONN_CANCEL 0x0008 | ||
312 | struct hci_cp_create_conn_cancel { | ||
313 | bdaddr_t bdaddr; | ||
314 | } __attribute__ ((packed)); | ||
315 | |||
309 | #define OCF_ACCEPT_CONN_REQ 0x0009 | 316 | #define OCF_ACCEPT_CONN_REQ 0x0009 |
310 | struct hci_cp_accept_conn_req { | 317 | struct hci_cp_accept_conn_req { |
311 | bdaddr_t bdaddr; | 318 | bdaddr_t bdaddr; |
@@ -339,6 +346,8 @@ struct hci_cp_inquiry { | |||
339 | 346 | ||
340 | #define OCF_INQUIRY_CANCEL 0x0002 | 347 | #define OCF_INQUIRY_CANCEL 0x0002 |
341 | 348 | ||
349 | #define OCF_EXIT_PERIODIC_INQ 0x0004 | ||
350 | |||
342 | #define OCF_LINK_KEY_REPLY 0x000B | 351 | #define OCF_LINK_KEY_REPLY 0x000B |
343 | struct hci_cp_link_key_reply { | 352 | struct hci_cp_link_key_reply { |
344 | bdaddr_t bdaddr; | 353 | bdaddr_t bdaddr; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d84855fe7336..df22efcfcc0b 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -72,6 +72,9 @@ struct hci_dev { | |||
72 | __u8 type; | 72 | __u8 type; |
73 | bdaddr_t bdaddr; | 73 | bdaddr_t bdaddr; |
74 | __u8 features[8]; | 74 | __u8 features[8]; |
75 | __u8 hci_ver; | ||
76 | __u16 hci_rev; | ||
77 | __u16 manufacturer; | ||
75 | __u16 voice_setting; | 78 | __u16 voice_setting; |
76 | 79 | ||
77 | __u16 pkt_type; | 80 | __u16 pkt_type; |
@@ -165,6 +168,10 @@ struct hci_conn { | |||
165 | struct timer_list disc_timer; | 168 | struct timer_list disc_timer; |
166 | struct timer_list idle_timer; | 169 | struct timer_list idle_timer; |
167 | 170 | ||
171 | struct work_struct work; | ||
172 | |||
173 | struct device dev; | ||
174 | |||
168 | struct hci_dev *hdev; | 175 | struct hci_dev *hdev; |
169 | void *l2cap_data; | 176 | void *l2cap_data; |
170 | void *sco_data; | 177 | void *sco_data; |
@@ -309,10 +316,13 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
309 | if (atomic_dec_and_test(&conn->refcnt)) { | 316 | if (atomic_dec_and_test(&conn->refcnt)) { |
310 | unsigned long timeo; | 317 | unsigned long timeo; |
311 | if (conn->type == ACL_LINK) { | 318 | if (conn->type == ACL_LINK) { |
312 | timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); | ||
313 | if (!conn->out) | ||
314 | timeo *= 2; | ||
315 | del_timer(&conn->idle_timer); | 319 | del_timer(&conn->idle_timer); |
320 | if (conn->state == BT_CONNECTED) { | ||
321 | timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); | ||
322 | if (!conn->out) | ||
323 | timeo *= 2; | ||
324 | } else | ||
325 | timeo = msecs_to_jiffies(10); | ||
316 | } else | 326 | } else |
317 | timeo = msecs_to_jiffies(10); | 327 | timeo = msecs_to_jiffies(10); |
318 | mod_timer(&conn->disc_timer, jiffies + timeo); | 328 | mod_timer(&conn->disc_timer, jiffies + timeo); |
@@ -412,6 +422,8 @@ static inline int hci_recv_frame(struct sk_buff *skb) | |||
412 | 422 | ||
413 | int hci_register_sysfs(struct hci_dev *hdev); | 423 | int hci_register_sysfs(struct hci_dev *hdev); |
414 | void hci_unregister_sysfs(struct hci_dev *hdev); | 424 | void hci_unregister_sysfs(struct hci_dev *hdev); |
425 | void hci_conn_add_sysfs(struct hci_conn *conn); | ||
426 | void hci_conn_del_sysfs(struct hci_conn *conn); | ||
415 | 427 | ||
416 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) | 428 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) |
417 | 429 | ||
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h index 2d72496c2029..5d6ae1b2b196 100644 --- a/include/net/cipso_ipv4.h +++ b/include/net/cipso_ipv4.h | |||
@@ -128,7 +128,9 @@ extern int cipso_v4_rbm_strictvalid; | |||
128 | 128 | ||
129 | #ifdef CONFIG_NETLABEL | 129 | #ifdef CONFIG_NETLABEL |
130 | int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); | 130 | int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); |
131 | int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)); | 131 | int cipso_v4_doi_remove(u32 doi, |
132 | u32 audit_secid, | ||
133 | void (*callback) (struct rcu_head * head)); | ||
132 | struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); | 134 | struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); |
133 | int cipso_v4_doi_walk(u32 *skip_cnt, | 135 | int cipso_v4_doi_walk(u32 *skip_cnt, |
134 | int (*callback) (struct cipso_v4_doi *doi_def, void *arg), | 136 | int (*callback) (struct cipso_v4_doi *doi_def, void *arg), |
@@ -143,6 +145,7 @@ static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) | |||
143 | } | 145 | } |
144 | 146 | ||
145 | static inline int cipso_v4_doi_remove(u32 doi, | 147 | static inline int cipso_v4_doi_remove(u32 doi, |
148 | u32 audit_secid, | ||
146 | void (*callback) (struct rcu_head * head)) | 149 | void (*callback) (struct rcu_head * head)) |
147 | { | 150 | { |
148 | return 0; | 151 | return 0; |
diff --git a/include/net/dst.h b/include/net/dst.h index a8d825f90305..e156e38e4ac3 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -84,7 +84,7 @@ struct dst_entry | |||
84 | struct dst_ops | 84 | struct dst_ops |
85 | { | 85 | { |
86 | unsigned short family; | 86 | unsigned short family; |
87 | unsigned short protocol; | 87 | __be16 protocol; |
88 | unsigned gc_thresh; | 88 | unsigned gc_thresh; |
89 | 89 | ||
90 | int (*gc)(void); | 90 | int (*gc)(void); |
diff --git a/include/net/flow.h b/include/net/flow.h index 3ca210ec1379..ddf5f3ca1720 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -16,8 +16,8 @@ struct flowi { | |||
16 | 16 | ||
17 | union { | 17 | union { |
18 | struct { | 18 | struct { |
19 | __u32 daddr; | 19 | __be32 daddr; |
20 | __u32 saddr; | 20 | __be32 saddr; |
21 | __u32 fwmark; | 21 | __u32 fwmark; |
22 | __u8 tos; | 22 | __u8 tos; |
23 | __u8 scope; | 23 | __u8 scope; |
@@ -56,8 +56,8 @@ struct flowi { | |||
56 | #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 | 56 | #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 |
57 | union { | 57 | union { |
58 | struct { | 58 | struct { |
59 | __u16 sport; | 59 | __be16 sport; |
60 | __u16 dport; | 60 | __be16 dport; |
61 | } ports; | 61 | } ports; |
62 | 62 | ||
63 | struct { | 63 | struct { |
@@ -73,7 +73,7 @@ struct flowi { | |||
73 | __u8 objname[16]; /* Not zero terminated */ | 73 | __u8 objname[16]; /* Not zero terminated */ |
74 | } dnports; | 74 | } dnports; |
75 | 75 | ||
76 | __u32 spi; | 76 | __be32 spi; |
77 | 77 | ||
78 | #ifdef CONFIG_IPV6_MIP6 | 78 | #ifdef CONFIG_IPV6_MIP6 |
79 | struct { | 79 | struct { |
diff --git a/include/net/icmp.h b/include/net/icmp.h index 05f8ff7d9316..dc09474efcf3 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -38,7 +38,7 @@ struct dst_entry; | |||
38 | struct net_proto_family; | 38 | struct net_proto_family; |
39 | struct sk_buff; | 39 | struct sk_buff; |
40 | 40 | ||
41 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); | 41 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); |
42 | extern int icmp_rcv(struct sk_buff *skb); | 42 | extern int icmp_rcv(struct sk_buff *skb); |
43 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 43 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
44 | extern void icmp_init(struct net_proto_family *ops); | 44 | extern void icmp_init(struct net_proto_family *ops); |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index de4e83b6da4b..0bcf9f237e1f 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -238,9 +238,9 @@ extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); | |||
238 | 238 | ||
239 | extern struct request_sock *inet_csk_search_req(const struct sock *sk, | 239 | extern struct request_sock *inet_csk_search_req(const struct sock *sk, |
240 | struct request_sock ***prevp, | 240 | struct request_sock ***prevp, |
241 | const __u16 rport, | 241 | const __be16 rport, |
242 | const __u32 raddr, | 242 | const __be32 raddr, |
243 | const __u32 laddr); | 243 | const __be32 laddr); |
244 | extern int inet_csk_bind_conflict(const struct sock *sk, | 244 | extern int inet_csk_bind_conflict(const struct sock *sk, |
245 | const struct inet_bind_bucket *tb); | 245 | const struct inet_bind_bucket *tb); |
246 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, | 246 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index b4491c9e2a5a..a9eb2eaf094e 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -272,42 +272,56 @@ static inline int inet_iif(const struct sk_buff *skb) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, | 274 | extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, |
275 | const u32 daddr, | 275 | const __be32 daddr, |
276 | const unsigned short hnum, | 276 | const unsigned short hnum, |
277 | const int dif); | 277 | const int dif); |
278 | 278 | ||
279 | static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, | 279 | static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, |
280 | u32 daddr, u16 dport, int dif) | 280 | __be32 daddr, __be16 dport, int dif) |
281 | { | 281 | { |
282 | return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); | 282 | return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); |
283 | } | 283 | } |
284 | 284 | ||
285 | /* Socket demux engine toys. */ | 285 | /* Socket demux engine toys. */ |
286 | /* What happens here is ugly; there's a pair of adjacent fields in | ||
287 | struct inet_sock; __be16 dport followed by __u16 num. We want to | ||
288 | search by pair, so we combine the keys into a single 32bit value | ||
289 | and compare with 32bit value read from &...->dport. Let's at least | ||
290 | make sure that it's not mixed with anything else... | ||
291 | On 64bit targets we combine comparisons with pair of adjacent __be32 | ||
292 | fields in the same way. | ||
293 | */ | ||
294 | typedef __u32 __bitwise __portpair; | ||
286 | #ifdef __BIG_ENDIAN | 295 | #ifdef __BIG_ENDIAN |
287 | #define INET_COMBINED_PORTS(__sport, __dport) \ | 296 | #define INET_COMBINED_PORTS(__sport, __dport) \ |
288 | (((__u32)(__sport) << 16) | (__u32)(__dport)) | 297 | ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport))) |
289 | #else /* __LITTLE_ENDIAN */ | 298 | #else /* __LITTLE_ENDIAN */ |
290 | #define INET_COMBINED_PORTS(__sport, __dport) \ | 299 | #define INET_COMBINED_PORTS(__sport, __dport) \ |
291 | (((__u32)(__dport) << 16) | (__u32)(__sport)) | 300 | ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(__sport))) |
292 | #endif | 301 | #endif |
293 | 302 | ||
294 | #if (BITS_PER_LONG == 64) | 303 | #if (BITS_PER_LONG == 64) |
304 | typedef __u64 __bitwise __addrpair; | ||
295 | #ifdef __BIG_ENDIAN | 305 | #ifdef __BIG_ENDIAN |
296 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 306 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
297 | const __u64 __name = (((__u64)(__saddr)) << 32) | ((__u64)(__daddr)); | 307 | const __addrpair __name = (__force __addrpair) ( \ |
308 | (((__force __u64)(__be32)(__saddr)) << 32) | \ | ||
309 | ((__force __u64)(__be32)(__daddr))); | ||
298 | #else /* __LITTLE_ENDIAN */ | 310 | #else /* __LITTLE_ENDIAN */ |
299 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 311 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
300 | const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr)); | 312 | const __addrpair __name = (__force __addrpair) ( \ |
313 | (((__force __u64)(__be32)(__daddr)) << 32) | \ | ||
314 | ((__force __u64)(__be32)(__saddr))); | ||
301 | #endif /* __BIG_ENDIAN */ | 315 | #endif /* __BIG_ENDIAN */ |
302 | #define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 316 | #define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
303 | (((__sk)->sk_hash == (__hash)) && \ | 317 | (((__sk)->sk_hash == (__hash)) && \ |
304 | ((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 318 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ |
305 | ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 319 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
306 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 320 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
307 | #define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 321 | #define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
308 | (((__sk)->sk_hash == (__hash)) && \ | 322 | (((__sk)->sk_hash == (__hash)) && \ |
309 | ((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ | 323 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ |
310 | ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 324 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
311 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 325 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
312 | #else /* 32-bit arch */ | 326 | #else /* 32-bit arch */ |
313 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 327 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
@@ -315,13 +329,13 @@ static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, | |||
315 | (((__sk)->sk_hash == (__hash)) && \ | 329 | (((__sk)->sk_hash == (__hash)) && \ |
316 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 330 | (inet_sk(__sk)->daddr == (__saddr)) && \ |
317 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 331 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ |
318 | ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 332 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
319 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 333 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
320 | #define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 334 | #define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
321 | (((__sk)->sk_hash == (__hash)) && \ | 335 | (((__sk)->sk_hash == (__hash)) && \ |
322 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ | 336 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ |
323 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ | 337 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ |
324 | ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 338 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
325 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 339 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
326 | #endif /* 64-bit arch */ | 340 | #endif /* 64-bit arch */ |
327 | 341 | ||
@@ -333,12 +347,12 @@ static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, | |||
333 | */ | 347 | */ |
334 | static inline struct sock * | 348 | static inline struct sock * |
335 | __inet_lookup_established(struct inet_hashinfo *hashinfo, | 349 | __inet_lookup_established(struct inet_hashinfo *hashinfo, |
336 | const u32 saddr, const u16 sport, | 350 | const __be32 saddr, const __be16 sport, |
337 | const u32 daddr, const u16 hnum, | 351 | const __be32 daddr, const u16 hnum, |
338 | const int dif) | 352 | const int dif) |
339 | { | 353 | { |
340 | INET_ADDR_COOKIE(acookie, saddr, daddr) | 354 | INET_ADDR_COOKIE(acookie, saddr, daddr) |
341 | const __u32 ports = INET_COMBINED_PORTS(sport, hnum); | 355 | const __portpair ports = INET_COMBINED_PORTS(sport, hnum); |
342 | struct sock *sk; | 356 | struct sock *sk; |
343 | const struct hlist_node *node; | 357 | const struct hlist_node *node; |
344 | /* Optimize here for direct hit, only listening connections can | 358 | /* Optimize here for direct hit, only listening connections can |
@@ -370,8 +384,8 @@ hit: | |||
370 | 384 | ||
371 | static inline struct sock * | 385 | static inline struct sock * |
372 | inet_lookup_established(struct inet_hashinfo *hashinfo, | 386 | inet_lookup_established(struct inet_hashinfo *hashinfo, |
373 | const u32 saddr, const u16 sport, | 387 | const __be32 saddr, const __be16 sport, |
374 | const u32 daddr, const u16 dport, | 388 | const __be32 daddr, const __be16 dport, |
375 | const int dif) | 389 | const int dif) |
376 | { | 390 | { |
377 | return __inet_lookup_established(hashinfo, saddr, sport, daddr, | 391 | return __inet_lookup_established(hashinfo, saddr, sport, daddr, |
@@ -379,8 +393,8 @@ static inline struct sock * | |||
379 | } | 393 | } |
380 | 394 | ||
381 | static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, | 395 | static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, |
382 | const u32 saddr, const u16 sport, | 396 | const __be32 saddr, const __be16 sport, |
383 | const u32 daddr, const u16 dport, | 397 | const __be32 daddr, const __be16 dport, |
384 | const int dif) | 398 | const int dif) |
385 | { | 399 | { |
386 | u16 hnum = ntohs(dport); | 400 | u16 hnum = ntohs(dport); |
@@ -390,8 +404,8 @@ static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, | |||
390 | } | 404 | } |
391 | 405 | ||
392 | static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, | 406 | static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, |
393 | const u32 saddr, const u16 sport, | 407 | const __be32 saddr, const __be16 sport, |
394 | const u32 daddr, const u16 dport, | 408 | const __be32 daddr, const __be16 dport, |
395 | const int dif) | 409 | const int dif) |
396 | { | 410 | { |
397 | struct sock *sk; | 411 | struct sock *sk; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index f6242710f2ff..ce6da97bc848 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -36,7 +36,7 @@ | |||
36 | * @ts_needaddr - Need to record addr of outgoing dev | 36 | * @ts_needaddr - Need to record addr of outgoing dev |
37 | */ | 37 | */ |
38 | struct ip_options { | 38 | struct ip_options { |
39 | __u32 faddr; | 39 | __be32 faddr; |
40 | unsigned char optlen; | 40 | unsigned char optlen; |
41 | unsigned char srr; | 41 | unsigned char srr; |
42 | unsigned char rr; | 42 | unsigned char rr; |
@@ -62,9 +62,9 @@ struct inet_request_sock { | |||
62 | u16 inet6_rsk_offset; | 62 | u16 inet6_rsk_offset; |
63 | /* 2 bytes hole, try to pack */ | 63 | /* 2 bytes hole, try to pack */ |
64 | #endif | 64 | #endif |
65 | u32 loc_addr; | 65 | __be32 loc_addr; |
66 | u32 rmt_addr; | 66 | __be32 rmt_addr; |
67 | u16 rmt_port; | 67 | __be16 rmt_port; |
68 | u16 snd_wscale : 4, | 68 | u16 snd_wscale : 4, |
69 | rcv_wscale : 4, | 69 | rcv_wscale : 4, |
70 | tstamp_ok : 1, | 70 | tstamp_ok : 1, |
@@ -110,15 +110,15 @@ struct inet_sock { | |||
110 | struct ipv6_pinfo *pinet6; | 110 | struct ipv6_pinfo *pinet6; |
111 | #endif | 111 | #endif |
112 | /* Socket demultiplex comparisons on incoming packets. */ | 112 | /* Socket demultiplex comparisons on incoming packets. */ |
113 | __u32 daddr; | 113 | __be32 daddr; |
114 | __u32 rcv_saddr; | 114 | __be32 rcv_saddr; |
115 | __u16 dport; | 115 | __be16 dport; |
116 | __u16 num; | 116 | __u16 num; |
117 | __u32 saddr; | 117 | __be32 saddr; |
118 | __s16 uc_ttl; | 118 | __s16 uc_ttl; |
119 | __u16 cmsg_flags; | 119 | __u16 cmsg_flags; |
120 | struct ip_options *opt; | 120 | struct ip_options *opt; |
121 | __u16 sport; | 121 | __be16 sport; |
122 | __u16 id; | 122 | __u16 id; |
123 | __u8 tos; | 123 | __u8 tos; |
124 | __u8 mc_ttl; | 124 | __u8 mc_ttl; |
@@ -129,7 +129,7 @@ struct inet_sock { | |||
129 | hdrincl:1, | 129 | hdrincl:1, |
130 | mc_loop:1; | 130 | mc_loop:1; |
131 | int mc_index; | 131 | int mc_index; |
132 | __u32 mc_addr; | 132 | __be32 mc_addr; |
133 | struct ip_mc_socklist *mc_list; | 133 | struct ip_mc_socklist *mc_list; |
134 | struct { | 134 | struct { |
135 | unsigned int flags; | 135 | unsigned int flags; |
@@ -137,7 +137,7 @@ struct inet_sock { | |||
137 | struct ip_options *opt; | 137 | struct ip_options *opt; |
138 | struct rtable *rt; | 138 | struct rtable *rt; |
139 | int length; /* Total length of all frames */ | 139 | int length; /* Total length of all frames */ |
140 | u32 addr; | 140 | __be32 addr; |
141 | struct flowi fl; | 141 | struct flowi fl; |
142 | } cork; | 142 | } cork; |
143 | }; | 143 | }; |
@@ -167,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
167 | 167 | ||
168 | extern int inet_sk_rebuild_header(struct sock *sk); | 168 | extern int inet_sk_rebuild_header(struct sock *sk); |
169 | 169 | ||
170 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | 170 | static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, |
171 | const __u32 faddr, const __u16 fport) | 171 | const __be32 faddr, const __be16 fport) |
172 | { | 172 | { |
173 | unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); | 173 | unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); |
174 | h ^= h >> 16; | 174 | h ^= h >> 16; |
175 | h ^= h >> 8; | 175 | h ^= h >> 8; |
176 | return h; | 176 | return h; |
@@ -179,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | |||
179 | static inline int inet_sk_ehashfn(const struct sock *sk) | 179 | static inline int inet_sk_ehashfn(const struct sock *sk) |
180 | { | 180 | { |
181 | const struct inet_sock *inet = inet_sk(sk); | 181 | const struct inet_sock *inet = inet_sk(sk); |
182 | const __u32 laddr = inet->rcv_saddr; | 182 | const __be32 laddr = inet->rcv_saddr; |
183 | const __u16 lport = inet->num; | 183 | const __u16 lport = inet->num; |
184 | const __u32 faddr = inet->daddr; | 184 | const __be32 faddr = inet->daddr; |
185 | const __u16 fport = inet->dport; | 185 | const __be16 fport = inet->dport; |
186 | 186 | ||
187 | return inet_ehashfn(laddr, lport, faddr, fport); | 187 | return inet_ehashfn(laddr, lport, faddr, fport); |
188 | } | 188 | } |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 600cb543550d..6d14c22a00c5 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -120,10 +120,10 @@ struct inet_timewait_sock { | |||
120 | unsigned char tw_rcv_wscale; | 120 | unsigned char tw_rcv_wscale; |
121 | /* Socket demultiplex comparisons on incoming packets. */ | 121 | /* Socket demultiplex comparisons on incoming packets. */ |
122 | /* these five are in inet_sock */ | 122 | /* these five are in inet_sock */ |
123 | __u16 tw_sport; | 123 | __be16 tw_sport; |
124 | __u32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES))); | 124 | __be32 tw_daddr __attribute__((aligned(INET_TIMEWAIT_ADDRCMP_ALIGN_BYTES))); |
125 | __u32 tw_rcv_saddr; | 125 | __be32 tw_rcv_saddr; |
126 | __u16 tw_dport; | 126 | __be16 tw_dport; |
127 | __u16 tw_num; | 127 | __u16 tw_num; |
128 | /* And these are ours. */ | 128 | /* And these are ours. */ |
129 | __u8 tw_ipv6only:1; | 129 | __u8 tw_ipv6only:1; |
@@ -186,7 +186,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) | |||
186 | return (struct inet_timewait_sock *)sk; | 186 | return (struct inet_timewait_sock *)sk; |
187 | } | 187 | } |
188 | 188 | ||
189 | static inline u32 inet_rcv_saddr(const struct sock *sk) | 189 | static inline __be32 inet_rcv_saddr(const struct sock *sk) |
190 | { | 190 | { |
191 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 191 | return likely(sk->sk_state != TCP_TIME_WAIT) ? |
192 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; | 192 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 0965515f40cf..925573fd2aed 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -22,7 +22,7 @@ struct inet_peer | |||
22 | unsigned long dtime; /* the time of last use of not | 22 | unsigned long dtime; /* the time of last use of not |
23 | * referenced entries */ | 23 | * referenced entries */ |
24 | atomic_t refcnt; | 24 | atomic_t refcnt; |
25 | __u32 v4daddr; /* peer's address */ | 25 | __be32 v4daddr; /* peer's address */ |
26 | __u16 avl_height; | 26 | __u16 avl_height; |
27 | __u16 ip_id_count; /* IP ID for the next packet */ | 27 | __u16 ip_id_count; /* IP ID for the next packet */ |
28 | atomic_t rid; /* Frag reception counter */ | 28 | atomic_t rid; /* Frag reception counter */ |
@@ -33,7 +33,7 @@ struct inet_peer | |||
33 | void inet_initpeers(void) __init; | 33 | void inet_initpeers(void) __init; |
34 | 34 | ||
35 | /* can be called with or without local BH being disabled */ | 35 | /* can be called with or without local BH being disabled */ |
36 | struct inet_peer *inet_getpeer(__u32 daddr, int create); | 36 | struct inet_peer *inet_getpeer(__be32 daddr, int create); |
37 | 37 | ||
38 | extern spinlock_t inet_peer_unused_lock; | 38 | extern spinlock_t inet_peer_unused_lock; |
39 | extern struct inet_peer **inet_peer_unused_tailp; | 39 | extern struct inet_peer **inet_peer_unused_tailp; |
diff --git a/include/net/ip.h b/include/net/ip.h index 98f908400771..b6d95e553401 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -45,7 +45,7 @@ struct inet_skb_parm | |||
45 | 45 | ||
46 | struct ipcm_cookie | 46 | struct ipcm_cookie |
47 | { | 47 | { |
48 | u32 addr; | 48 | __be32 addr; |
49 | int oif; | 49 | int oif; |
50 | struct ip_options *opt; | 50 | struct ip_options *opt; |
51 | }; | 51 | }; |
@@ -86,7 +86,7 @@ extern int igmp_mc_proc_init(void); | |||
86 | */ | 86 | */ |
87 | 87 | ||
88 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 88 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, |
89 | u32 saddr, u32 daddr, | 89 | __be32 saddr, __be32 daddr, |
90 | struct ip_options *opt); | 90 | struct ip_options *opt); |
91 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, | 91 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, |
92 | struct packet_type *pt, struct net_device *orig_dev); | 92 | struct packet_type *pt, struct net_device *orig_dev); |
@@ -335,7 +335,7 @@ extern int ip_net_unreachable(struct sk_buff *skb); | |||
335 | * Functions provided by ip_options.c | 335 | * Functions provided by ip_options.c |
336 | */ | 336 | */ |
337 | 337 | ||
338 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, u32 daddr, struct rtable *rt, int is_frag); | 338 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); |
339 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); | 339 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); |
340 | extern void ip_options_fragment(struct sk_buff *skb); | 340 | extern void ip_options_fragment(struct sk_buff *skb); |
341 | extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); | 341 | extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); |
@@ -363,8 +363,8 @@ extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(s | |||
363 | 363 | ||
364 | extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); | 364 | extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); |
365 | extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | 365 | extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, |
366 | u16 port, u32 info, u8 *payload); | 366 | __be16 port, u32 info, u8 *payload); |
367 | extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport, | 367 | extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, |
368 | u32 info); | 368 | u32 info); |
369 | 369 | ||
370 | /* sysctl helpers - any sysctl which holds a value that ends up being | 370 | /* sysctl helpers - any sysctl which holds a value that ends up being |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index fcc159a4ac17..82229146bac7 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -30,13 +30,13 @@ struct fib_config { | |||
30 | u8 fc_type; | 30 | u8 fc_type; |
31 | /* 1 byte unused */ | 31 | /* 1 byte unused */ |
32 | u32 fc_table; | 32 | u32 fc_table; |
33 | u32 fc_dst; | 33 | __be32 fc_dst; |
34 | u32 fc_src; | 34 | __be32 fc_src; |
35 | u32 fc_gw; | 35 | __be32 fc_gw; |
36 | int fc_oif; | 36 | int fc_oif; |
37 | u32 fc_flags; | 37 | u32 fc_flags; |
38 | u32 fc_priority; | 38 | u32 fc_priority; |
39 | u32 fc_prefsrc; | 39 | __be32 fc_prefsrc; |
40 | struct nlattr *fc_mx; | 40 | struct nlattr *fc_mx; |
41 | struct rtnexthop *fc_mp; | 41 | struct rtnexthop *fc_mp; |
42 | int fc_mx_len; | 42 | int fc_mx_len; |
@@ -63,7 +63,7 @@ struct fib_nh { | |||
63 | __u32 nh_tclassid; | 63 | __u32 nh_tclassid; |
64 | #endif | 64 | #endif |
65 | int nh_oif; | 65 | int nh_oif; |
66 | u32 nh_gw; | 66 | __be32 nh_gw; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* | 69 | /* |
@@ -78,7 +78,7 @@ struct fib_info { | |||
78 | int fib_dead; | 78 | int fib_dead; |
79 | unsigned fib_flags; | 79 | unsigned fib_flags; |
80 | int fib_protocol; | 80 | int fib_protocol; |
81 | u32 fib_prefsrc; | 81 | __be32 fib_prefsrc; |
82 | u32 fib_priority; | 82 | u32 fib_priority; |
83 | u32 fib_metrics[RTAX_MAX]; | 83 | u32 fib_metrics[RTAX_MAX]; |
84 | #define fib_mtu fib_metrics[RTAX_MTU-1] | 84 | #define fib_mtu fib_metrics[RTAX_MTU-1] |
@@ -107,8 +107,8 @@ struct fib_result { | |||
107 | unsigned char type; | 107 | unsigned char type; |
108 | unsigned char scope; | 108 | unsigned char scope; |
109 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 109 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
110 | __u32 network; | 110 | __be32 network; |
111 | __u32 netmask; | 111 | __be32 netmask; |
112 | #endif | 112 | #endif |
113 | struct fib_info *fi; | 113 | struct fib_info *fi; |
114 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 114 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
@@ -117,7 +117,7 @@ struct fib_result { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct fib_result_nl { | 119 | struct fib_result_nl { |
120 | u32 fl_addr; /* To be looked up*/ | 120 | __be32 fl_addr; /* To be looked up*/ |
121 | u32 fl_fwmark; | 121 | u32 fl_fwmark; |
122 | unsigned char fl_tos; | 122 | unsigned char fl_tos; |
123 | unsigned char fl_scope; | 123 | unsigned char fl_scope; |
@@ -222,17 +222,17 @@ extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar | |||
222 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 222 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
223 | extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 223 | extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
224 | extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); | 224 | extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); |
225 | extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, | 225 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
226 | struct net_device *dev, u32 *spec_dst, u32 *itag); | 226 | struct net_device *dev, __be32 *spec_dst, u32 *itag); |
227 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 227 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); |
228 | 228 | ||
229 | struct rtentry; | 229 | struct rtentry; |
230 | 230 | ||
231 | /* Exported by fib_semantics.c */ | 231 | /* Exported by fib_semantics.c */ |
232 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); | 232 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); |
233 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); | 233 | extern int fib_sync_down(__be32 local, struct net_device *dev, int force); |
234 | extern int fib_sync_up(struct net_device *dev); | 234 | extern int fib_sync_up(struct net_device *dev); |
235 | extern u32 __fib_res_prefsrc(struct fib_result *res); | 235 | extern __be32 __fib_res_prefsrc(struct fib_result *res); |
236 | 236 | ||
237 | /* Exported by fib_hash.c */ | 237 | /* Exported by fib_hash.c */ |
238 | extern struct fib_table *fib_hash_init(u32 id); | 238 | extern struct fib_table *fib_hash_init(u32 id); |
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h index ac747b64734c..beffdd66ad74 100644 --- a/include/net/ip_mp_alg.h +++ b/include/net/ip_mp_alg.h | |||
@@ -17,7 +17,7 @@ struct ip_mp_alg_ops { | |||
17 | void (*mp_alg_select_route)(const struct flowi *flp, | 17 | void (*mp_alg_select_route)(const struct flowi *flp, |
18 | struct rtable *rth, struct rtable **rp); | 18 | struct rtable *rth, struct rtable **rp); |
19 | void (*mp_alg_flush)(void); | 19 | void (*mp_alg_flush)(void); |
20 | void (*mp_alg_set_nhinfo)(__u32 network, __u32 netmask, | 20 | void (*mp_alg_set_nhinfo)(__be32 network, __be32 netmask, |
21 | unsigned char prefixlen, | 21 | unsigned char prefixlen, |
22 | const struct fib_nh *nh); | 22 | const struct fib_nh *nh); |
23 | void (*mp_alg_remove)(struct rtable *rth); | 23 | void (*mp_alg_remove)(struct rtable *rth); |
@@ -59,7 +59,7 @@ static inline void multipath_flush(void) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | static inline void multipath_set_nhinfo(struct rtable *rth, | 61 | static inline void multipath_set_nhinfo(struct rtable *rth, |
62 | __u32 network, __u32 netmask, | 62 | __be32 network, __be32 netmask, |
63 | unsigned char prefixlen, | 63 | unsigned char prefixlen, |
64 | const struct fib_nh *nh) | 64 | const struct fib_nh *nh) |
65 | { | 65 | { |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 3b57b159b653..49c717e3b040 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -100,22 +100,22 @@ | |||
100 | struct ip_vs_service_user { | 100 | struct ip_vs_service_user { |
101 | /* virtual service addresses */ | 101 | /* virtual service addresses */ |
102 | u_int16_t protocol; | 102 | u_int16_t protocol; |
103 | u_int32_t addr; /* virtual ip address */ | 103 | __be32 addr; /* virtual ip address */ |
104 | u_int16_t port; | 104 | __be16 port; |
105 | u_int32_t fwmark; /* firwall mark of service */ | 105 | u_int32_t fwmark; /* firwall mark of service */ |
106 | 106 | ||
107 | /* virtual service options */ | 107 | /* virtual service options */ |
108 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | 108 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; |
109 | unsigned flags; /* virtual service flags */ | 109 | unsigned flags; /* virtual service flags */ |
110 | unsigned timeout; /* persistent timeout in sec */ | 110 | unsigned timeout; /* persistent timeout in sec */ |
111 | u_int32_t netmask; /* persistent netmask */ | 111 | __be32 netmask; /* persistent netmask */ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | 114 | ||
115 | struct ip_vs_dest_user { | 115 | struct ip_vs_dest_user { |
116 | /* destination server address */ | 116 | /* destination server address */ |
117 | u_int32_t addr; | 117 | __be32 addr; |
118 | u_int16_t port; | 118 | __be16 port; |
119 | 119 | ||
120 | /* real server options */ | 120 | /* real server options */ |
121 | unsigned conn_flags; /* connection flags */ | 121 | unsigned conn_flags; /* connection flags */ |
@@ -163,15 +163,15 @@ struct ip_vs_getinfo { | |||
163 | struct ip_vs_service_entry { | 163 | struct ip_vs_service_entry { |
164 | /* which service: user fills in these */ | 164 | /* which service: user fills in these */ |
165 | u_int16_t protocol; | 165 | u_int16_t protocol; |
166 | u_int32_t addr; /* virtual address */ | 166 | __be32 addr; /* virtual address */ |
167 | u_int16_t port; | 167 | __be16 port; |
168 | u_int32_t fwmark; /* firwall mark of service */ | 168 | u_int32_t fwmark; /* firwall mark of service */ |
169 | 169 | ||
170 | /* service options */ | 170 | /* service options */ |
171 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; | 171 | char sched_name[IP_VS_SCHEDNAME_MAXLEN]; |
172 | unsigned flags; /* virtual service flags */ | 172 | unsigned flags; /* virtual service flags */ |
173 | unsigned timeout; /* persistent timeout */ | 173 | unsigned timeout; /* persistent timeout */ |
174 | u_int32_t netmask; /* persistent netmask */ | 174 | __be32 netmask; /* persistent netmask */ |
175 | 175 | ||
176 | /* number of real servers */ | 176 | /* number of real servers */ |
177 | unsigned int num_dests; | 177 | unsigned int num_dests; |
@@ -182,8 +182,8 @@ struct ip_vs_service_entry { | |||
182 | 182 | ||
183 | 183 | ||
184 | struct ip_vs_dest_entry { | 184 | struct ip_vs_dest_entry { |
185 | u_int32_t addr; /* destination address */ | 185 | __be32 addr; /* destination address */ |
186 | u_int16_t port; | 186 | __be16 port; |
187 | unsigned conn_flags; /* connection flags */ | 187 | unsigned conn_flags; /* connection flags */ |
188 | int weight; /* destination weight */ | 188 | int weight; /* destination weight */ |
189 | 189 | ||
@@ -203,8 +203,8 @@ struct ip_vs_dest_entry { | |||
203 | struct ip_vs_get_dests { | 203 | struct ip_vs_get_dests { |
204 | /* which service: user fills in these */ | 204 | /* which service: user fills in these */ |
205 | u_int16_t protocol; | 205 | u_int16_t protocol; |
206 | u_int32_t addr; /* virtual address */ | 206 | __be32 addr; /* virtual address */ |
207 | u_int16_t port; | 207 | __be16 port; |
208 | u_int32_t fwmark; /* firwall mark of service */ | 208 | u_int32_t fwmark; /* firwall mark of service */ |
209 | 209 | ||
210 | /* number of real servers */ | 210 | /* number of real servers */ |
@@ -502,12 +502,12 @@ struct ip_vs_conn { | |||
502 | struct list_head c_list; /* hashed list heads */ | 502 | struct list_head c_list; /* hashed list heads */ |
503 | 503 | ||
504 | /* Protocol, addresses and port numbers */ | 504 | /* Protocol, addresses and port numbers */ |
505 | __u32 caddr; /* client address */ | 505 | __be32 caddr; /* client address */ |
506 | __u32 vaddr; /* virtual address */ | 506 | __be32 vaddr; /* virtual address */ |
507 | __u32 daddr; /* destination address */ | 507 | __be32 daddr; /* destination address */ |
508 | __u16 cport; | 508 | __be16 cport; |
509 | __u16 vport; | 509 | __be16 vport; |
510 | __u16 dport; | 510 | __be16 dport; |
511 | __u16 protocol; /* Which protocol (TCP/UDP) */ | 511 | __u16 protocol; /* Which protocol (TCP/UDP) */ |
512 | 512 | ||
513 | /* counter and timer */ | 513 | /* counter and timer */ |
@@ -554,12 +554,12 @@ struct ip_vs_service { | |||
554 | atomic_t usecnt; /* use counter */ | 554 | atomic_t usecnt; /* use counter */ |
555 | 555 | ||
556 | __u16 protocol; /* which protocol (TCP/UDP) */ | 556 | __u16 protocol; /* which protocol (TCP/UDP) */ |
557 | __u32 addr; /* IP address for virtual service */ | 557 | __be32 addr; /* IP address for virtual service */ |
558 | __u16 port; /* port number for the service */ | 558 | __be16 port; /* port number for the service */ |
559 | __u32 fwmark; /* firewall mark of the service */ | 559 | __u32 fwmark; /* firewall mark of the service */ |
560 | unsigned flags; /* service status flags */ | 560 | unsigned flags; /* service status flags */ |
561 | unsigned timeout; /* persistent timeout in ticks */ | 561 | unsigned timeout; /* persistent timeout in ticks */ |
562 | __u32 netmask; /* grouping granularity */ | 562 | __be32 netmask; /* grouping granularity */ |
563 | 563 | ||
564 | struct list_head destinations; /* real server d-linked list */ | 564 | struct list_head destinations; /* real server d-linked list */ |
565 | __u32 num_dests; /* number of servers */ | 565 | __u32 num_dests; /* number of servers */ |
@@ -581,8 +581,8 @@ struct ip_vs_dest { | |||
581 | struct list_head n_list; /* for the dests in the service */ | 581 | struct list_head n_list; /* for the dests in the service */ |
582 | struct list_head d_list; /* for table with all the dests */ | 582 | struct list_head d_list; /* for table with all the dests */ |
583 | 583 | ||
584 | __u32 addr; /* IP address of the server */ | 584 | __be32 addr; /* IP address of the server */ |
585 | __u16 port; /* port number of the server */ | 585 | __be16 port; /* port number of the server */ |
586 | volatile unsigned flags; /* dest status flags */ | 586 | volatile unsigned flags; /* dest status flags */ |
587 | atomic_t conn_flags; /* flags to copy to conn */ | 587 | atomic_t conn_flags; /* flags to copy to conn */ |
588 | atomic_t weight; /* server weight */ | 588 | atomic_t weight; /* server weight */ |
@@ -605,8 +605,8 @@ struct ip_vs_dest { | |||
605 | /* for virtual service */ | 605 | /* for virtual service */ |
606 | struct ip_vs_service *svc; /* service it belongs to */ | 606 | struct ip_vs_service *svc; /* service it belongs to */ |
607 | __u16 protocol; /* which protocol (TCP/UDP) */ | 607 | __u16 protocol; /* which protocol (TCP/UDP) */ |
608 | __u32 vaddr; /* virtual IP address */ | 608 | __be32 vaddr; /* virtual IP address */ |
609 | __u16 vport; /* virtual port number */ | 609 | __be16 vport; /* virtual port number */ |
610 | __u32 vfwmark; /* firewall mark of service */ | 610 | __u32 vfwmark; /* firewall mark of service */ |
611 | }; | 611 | }; |
612 | 612 | ||
@@ -648,7 +648,7 @@ struct ip_vs_app | |||
648 | /* members for application incarnations */ | 648 | /* members for application incarnations */ |
649 | struct list_head p_list; /* member in proto app list */ | 649 | struct list_head p_list; /* member in proto app list */ |
650 | struct ip_vs_app *app; /* its real application */ | 650 | struct ip_vs_app *app; /* its real application */ |
651 | __u16 port; /* port number in net order */ | 651 | __be16 port; /* port number in net order */ |
652 | atomic_t usecnt; /* usage counter */ | 652 | atomic_t usecnt; /* usage counter */ |
653 | 653 | ||
654 | /* output hook: return false if can't linearize. diff set for TCP. */ | 654 | /* output hook: return false if can't linearize. diff set for TCP. */ |
@@ -740,11 +740,11 @@ enum { | |||
740 | }; | 740 | }; |
741 | 741 | ||
742 | extern struct ip_vs_conn *ip_vs_conn_in_get | 742 | extern struct ip_vs_conn *ip_vs_conn_in_get |
743 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); | 743 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); |
744 | extern struct ip_vs_conn *ip_vs_ct_in_get | 744 | extern struct ip_vs_conn *ip_vs_ct_in_get |
745 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); | 745 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); |
746 | extern struct ip_vs_conn *ip_vs_conn_out_get | 746 | extern struct ip_vs_conn *ip_vs_conn_out_get |
747 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); | 747 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); |
748 | 748 | ||
749 | /* put back the conn without restarting its timer */ | 749 | /* put back the conn without restarting its timer */ |
750 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 750 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
@@ -752,11 +752,11 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | |||
752 | atomic_dec(&cp->refcnt); | 752 | atomic_dec(&cp->refcnt); |
753 | } | 753 | } |
754 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); | 754 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); |
755 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport); | 755 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); |
756 | 756 | ||
757 | extern struct ip_vs_conn * | 757 | extern struct ip_vs_conn * |
758 | ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport, | 758 | ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport, |
759 | __u32 daddr, __u16 dport, unsigned flags, | 759 | __be32 daddr, __be16 dport, unsigned flags, |
760 | struct ip_vs_dest *dest); | 760 | struct ip_vs_dest *dest); |
761 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); | 761 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); |
762 | 762 | ||
@@ -887,7 +887,7 @@ extern int sysctl_ip_vs_nat_icmp_send; | |||
887 | extern struct ip_vs_stats ip_vs_stats; | 887 | extern struct ip_vs_stats ip_vs_stats; |
888 | 888 | ||
889 | extern struct ip_vs_service * | 889 | extern struct ip_vs_service * |
890 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport); | 890 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); |
891 | 891 | ||
892 | static inline void ip_vs_service_put(struct ip_vs_service *svc) | 892 | static inline void ip_vs_service_put(struct ip_vs_service *svc) |
893 | { | 893 | { |
@@ -895,7 +895,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc) | |||
895 | } | 895 | } |
896 | 896 | ||
897 | extern struct ip_vs_dest * | 897 | extern struct ip_vs_dest * |
898 | ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport); | 898 | ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport); |
899 | extern int ip_vs_use_count_inc(void); | 899 | extern int ip_vs_use_count_inc(void); |
900 | extern void ip_vs_use_count_dec(void); | 900 | extern void ip_vs_use_count_dec(void); |
901 | extern int ip_vs_control_init(void); | 901 | extern int ip_vs_control_init(void); |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 72bf47b2a4e0..8223c4410b4b 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -318,8 +318,8 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, | |||
318 | 318 | ||
319 | #ifndef __HAVE_ARCH_ADDR_SET | 319 | #ifndef __HAVE_ARCH_ADDR_SET |
320 | static inline void ipv6_addr_set(struct in6_addr *addr, | 320 | static inline void ipv6_addr_set(struct in6_addr *addr, |
321 | __u32 w1, __u32 w2, | 321 | __be32 w1, __be32 w2, |
322 | __u32 w3, __u32 w4) | 322 | __be32 w3, __be32 w4) |
323 | { | 323 | { |
324 | addr->s6_addr32[0] = w1; | 324 | addr->s6_addr32[0] = w1; |
325 | addr->s6_addr32[1] = w2; | 325 | addr->s6_addr32[1] = w2; |
@@ -337,7 +337,7 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1, | |||
337 | a1->s6_addr32[3] == a2->s6_addr32[3]); | 337 | a1->s6_addr32[3] == a2->s6_addr32[3]); |
338 | } | 338 | } |
339 | 339 | ||
340 | static inline int __ipv6_prefix_equal(const u32 *a1, const u32 *a2, | 340 | static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, |
341 | unsigned int prefixlen) | 341 | unsigned int prefixlen) |
342 | { | 342 | { |
343 | unsigned pdw, pbi; | 343 | unsigned pdw, pbi; |
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h index 1c73bdbc3eb3..9592c374b41d 100644 --- a/include/net/irda/irlan_common.h +++ b/include/net/irda/irlan_common.h | |||
@@ -98,7 +98,15 @@ | |||
98 | #define IRLAN_SHORT 1 | 98 | #define IRLAN_SHORT 1 |
99 | #define IRLAN_ARRAY 2 | 99 | #define IRLAN_ARRAY 2 |
100 | 100 | ||
101 | #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER) | 101 | /* IrLAN sits on top if IrTTP */ |
102 | #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER) | ||
103 | /* 1 byte for the command code and 1 byte for the parameter count */ | ||
104 | #define IRLAN_CMD_HEADER 2 | ||
105 | |||
106 | #define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \ | ||
107 | + strlen ((value))) | ||
108 | #define IRLAN_BYTE_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 1) | ||
109 | #define IRLAN_SHORT_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 2) | ||
102 | 110 | ||
103 | /* | 111 | /* |
104 | * IrLAN client | 112 | * IrLAN client |
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h index 3452ae257c84..9dd54a5002b2 100644 --- a/include/net/irda/irlap_frame.h +++ b/include/net/irda/irlap_frame.h | |||
@@ -74,6 +74,19 @@ struct discovery_t; | |||
74 | 74 | ||
75 | #define PF_BIT 0x10 /* Poll/final bit */ | 75 | #define PF_BIT 0x10 /* Poll/final bit */ |
76 | 76 | ||
77 | /* Some IrLAP field lengths */ | ||
78 | /* | ||
79 | * Only baud rate triplet is 4 bytes (PV can be 2 bytes). | ||
80 | * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes. | ||
81 | */ | ||
82 | #define IRLAP_NEGOCIATION_PARAMS_LEN 25 | ||
83 | #define IRLAP_DISCOVERY_INFO_LEN 32 | ||
84 | |||
85 | struct disc_frame { | ||
86 | __u8 caddr; /* Connection address */ | ||
87 | __u8 control; | ||
88 | } IRDA_PACK; | ||
89 | |||
77 | struct xid_frame { | 90 | struct xid_frame { |
78 | __u8 caddr; /* Connection address */ | 91 | __u8 caddr; /* Connection address */ |
79 | __u8 control; | 92 | __u8 control; |
@@ -95,11 +108,25 @@ struct test_frame { | |||
95 | struct ua_frame { | 108 | struct ua_frame { |
96 | __u8 caddr; | 109 | __u8 caddr; |
97 | __u8 control; | 110 | __u8 control; |
98 | |||
99 | __u32 saddr; /* Source device address */ | 111 | __u32 saddr; /* Source device address */ |
100 | __u32 daddr; /* Dest device address */ | 112 | __u32 daddr; /* Dest device address */ |
101 | } IRDA_PACK; | 113 | } IRDA_PACK; |
102 | 114 | ||
115 | struct dm_frame { | ||
116 | __u8 caddr; /* Connection address */ | ||
117 | __u8 control; | ||
118 | } IRDA_PACK; | ||
119 | |||
120 | struct rd_frame { | ||
121 | __u8 caddr; /* Connection address */ | ||
122 | __u8 control; | ||
123 | } IRDA_PACK; | ||
124 | |||
125 | struct rr_frame { | ||
126 | __u8 caddr; /* Connection address */ | ||
127 | __u8 control; | ||
128 | } IRDA_PACK; | ||
129 | |||
103 | struct i_frame { | 130 | struct i_frame { |
104 | __u8 caddr; | 131 | __u8 caddr; |
105 | __u8 control; | 132 | __u8 control; |
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index 11ecfa58a648..e212b9bc2503 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h | |||
@@ -48,7 +48,7 @@ | |||
48 | #define DEV_ADDR_ANY 0xffffffff | 48 | #define DEV_ADDR_ANY 0xffffffff |
49 | 49 | ||
50 | #define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ | 50 | #define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ |
51 | #define LMP_CONTROL_HEADER 4 | 51 | #define LMP_CONTROL_HEADER 4 /* LMP_HEADER + opcode + parameter */ |
52 | #define LMP_PID_HEADER 1 /* Used by Ultra */ | 52 | #define LMP_PID_HEADER 1 /* Used by Ultra */ |
53 | #define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER) | 53 | #define LMP_MAX_HEADER (LMP_CONTROL_HEADER+LAP_MAX_HEADER) |
54 | 54 | ||
diff --git a/include/net/netlabel.h b/include/net/netlabel.h index 6692430063fd..190bfdbbdba6 100644 --- a/include/net/netlabel.h +++ b/include/net/netlabel.h | |||
@@ -96,7 +96,7 @@ | |||
96 | struct netlbl_dom_map; | 96 | struct netlbl_dom_map; |
97 | 97 | ||
98 | /* Domain mapping operations */ | 98 | /* Domain mapping operations */ |
99 | int netlbl_domhsh_remove(const char *domain); | 99 | int netlbl_domhsh_remove(const char *domain, u32 audit_secid); |
100 | 100 | ||
101 | /* LSM security attributes */ | 101 | /* LSM security attributes */ |
102 | struct netlbl_lsm_cache { | 102 | struct netlbl_lsm_cache { |
diff --git a/include/net/netlink.h b/include/net/netlink.h index 4ab68a7a636a..ce5cba19c393 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -831,6 +831,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
831 | #define NLA_PUT_U32(skb, attrtype, value) \ | 831 | #define NLA_PUT_U32(skb, attrtype, value) \ |
832 | NLA_PUT_TYPE(skb, u32, attrtype, value) | 832 | NLA_PUT_TYPE(skb, u32, attrtype, value) |
833 | 833 | ||
834 | #define NLA_PUT_BE32(skb, attrtype, value) \ | ||
835 | NLA_PUT_TYPE(skb, __be32, attrtype, value) | ||
836 | |||
834 | #define NLA_PUT_U64(skb, attrtype, value) \ | 837 | #define NLA_PUT_U64(skb, attrtype, value) \ |
835 | NLA_PUT_TYPE(skb, u64, attrtype, value) | 838 | NLA_PUT_TYPE(skb, u64, attrtype, value) |
836 | 839 | ||
@@ -853,6 +856,15 @@ static inline u32 nla_get_u32(struct nlattr *nla) | |||
853 | } | 856 | } |
854 | 857 | ||
855 | /** | 858 | /** |
859 | * nla_get_be32 - return payload of __be32 attribute | ||
860 | * @nla: __be32 netlink attribute | ||
861 | */ | ||
862 | static inline __be32 nla_get_be32(struct nlattr *nla) | ||
863 | { | ||
864 | return *(__be32 *) nla_data(nla); | ||
865 | } | ||
866 | |||
867 | /** | ||
856 | * nla_get_u16 - return payload of u16 attribute | 868 | * nla_get_u16 - return payload of u16 attribute |
857 | * @nla: u16 netlink attribute | 869 | * @nla: u16 netlink attribute |
858 | */ | 870 | */ |
diff --git a/include/net/route.h b/include/net/route.h index 7f93ac0e0899..486e37aff06c 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -62,18 +62,18 @@ struct rtable | |||
62 | __u16 rt_type; | 62 | __u16 rt_type; |
63 | __u16 rt_multipath_alg; | 63 | __u16 rt_multipath_alg; |
64 | 64 | ||
65 | __u32 rt_dst; /* Path destination */ | 65 | __be32 rt_dst; /* Path destination */ |
66 | __u32 rt_src; /* Path source */ | 66 | __be32 rt_src; /* Path source */ |
67 | int rt_iif; | 67 | int rt_iif; |
68 | 68 | ||
69 | /* Info on neighbour */ | 69 | /* Info on neighbour */ |
70 | __u32 rt_gateway; | 70 | __be32 rt_gateway; |
71 | 71 | ||
72 | /* Cache lookup keys */ | 72 | /* Cache lookup keys */ |
73 | struct flowi fl; | 73 | struct flowi fl; |
74 | 74 | ||
75 | /* Miscellaneous cached information */ | 75 | /* Miscellaneous cached information */ |
76 | __u32 rt_spec_dst; /* RFC1122 specific destination */ | 76 | __be32 rt_spec_dst; /* RFC1122 specific destination */ |
77 | struct inet_peer *peer; /* long-living peer info */ | 77 | struct inet_peer *peer; /* long-living peer info */ |
78 | }; | 78 | }; |
79 | 79 | ||
@@ -109,18 +109,18 @@ extern struct ip_rt_acct *ip_rt_acct; | |||
109 | 109 | ||
110 | struct in_device; | 110 | struct in_device; |
111 | extern int ip_rt_init(void); | 111 | extern int ip_rt_init(void); |
112 | extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, | 112 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
113 | u32 src, struct net_device *dev); | 113 | __be32 src, struct net_device *dev); |
114 | extern void ip_rt_advice(struct rtable **rp, int advice); | 114 | extern void ip_rt_advice(struct rtable **rp, int advice); |
115 | extern void rt_cache_flush(int how); | 115 | extern void rt_cache_flush(int how); |
116 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); | 116 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); |
117 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); | 117 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); |
118 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 118 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
119 | extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin); | 119 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); |
120 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); | 120 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); |
121 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 121 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
122 | 122 | ||
123 | extern unsigned inet_addr_type(u32 addr); | 123 | extern unsigned inet_addr_type(__be32 addr); |
124 | extern void ip_rt_multicast_event(struct in_device *); | 124 | extern void ip_rt_multicast_event(struct in_device *); |
125 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); | 125 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); |
126 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 126 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
@@ -144,9 +144,9 @@ static inline char rt_tos2priority(u8 tos) | |||
144 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; | 144 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; |
145 | } | 145 | } |
146 | 146 | ||
147 | static inline int ip_route_connect(struct rtable **rp, u32 dst, | 147 | static inline int ip_route_connect(struct rtable **rp, __be32 dst, |
148 | u32 src, u32 tos, int oif, u8 protocol, | 148 | __be32 src, u32 tos, int oif, u8 protocol, |
149 | u16 sport, u16 dport, struct sock *sk) | 149 | __be16 sport, __be16 dport, struct sock *sk) |
150 | { | 150 | { |
151 | struct flowi fl = { .oif = oif, | 151 | struct flowi fl = { .oif = oif, |
152 | .nl_u = { .ip4_u = { .daddr = dst, | 152 | .nl_u = { .ip4_u = { .daddr = dst, |
@@ -172,7 +172,7 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, | |||
172 | } | 172 | } |
173 | 173 | ||
174 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 174 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
175 | u16 sport, u16 dport, struct sock *sk) | 175 | __be16 sport, __be16 dport, struct sock *sk) |
176 | { | 176 | { |
177 | if (sport != (*rp)->fl.fl_ip_sport || | 177 | if (sport != (*rp)->fl.fl_ip_sport || |
178 | dport != (*rp)->fl.fl_ip_dport) { | 178 | dport != (*rp)->fl.fl_ip_dport) { |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 11e0b1d6bd47..1e2a4ddec96e 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -437,8 +437,8 @@ static inline void xfrm_state_hold(struct xfrm_state *x) | |||
437 | 437 | ||
438 | static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | 438 | static __inline__ int addr_match(void *token1, void *token2, int prefixlen) |
439 | { | 439 | { |
440 | __u32 *a1 = token1; | 440 | __be32 *a1 = token1; |
441 | __u32 *a2 = token2; | 441 | __be32 *a2 = token2; |
442 | int pdw; | 442 | int pdw; |
443 | int pbi; | 443 | int pbi; |
444 | 444 | ||
@@ -450,7 +450,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
450 | return 0; | 450 | return 0; |
451 | 451 | ||
452 | if (pbi) { | 452 | if (pbi) { |
453 | __u32 mask; | 453 | __be32 mask; |
454 | 454 | ||
455 | mask = htonl((0xffffffff) << (32 - pbi)); | 455 | mask = htonl((0xffffffff) << (32 - pbi)); |
456 | 456 | ||
@@ -462,9 +462,9 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen) | |||
462 | } | 462 | } |
463 | 463 | ||
464 | static __inline__ | 464 | static __inline__ |
465 | u16 xfrm_flowi_sport(struct flowi *fl) | 465 | __be16 xfrm_flowi_sport(struct flowi *fl) |
466 | { | 466 | { |
467 | u16 port; | 467 | __be16 port; |
468 | switch(fl->proto) { | 468 | switch(fl->proto) { |
469 | case IPPROTO_TCP: | 469 | case IPPROTO_TCP: |
470 | case IPPROTO_UDP: | 470 | case IPPROTO_UDP: |
@@ -487,9 +487,9 @@ u16 xfrm_flowi_sport(struct flowi *fl) | |||
487 | } | 487 | } |
488 | 488 | ||
489 | static __inline__ | 489 | static __inline__ |
490 | u16 xfrm_flowi_dport(struct flowi *fl) | 490 | __be16 xfrm_flowi_dport(struct flowi *fl) |
491 | { | 491 | { |
492 | u16 port; | 492 | __be16 port; |
493 | switch(fl->proto) { | 493 | switch(fl->proto) { |
494 | case IPPROTO_TCP: | 494 | case IPPROTO_TCP: |
495 | case IPPROTO_UDP: | 495 | case IPPROTO_UDP: |
@@ -912,7 +912,7 @@ extern int xfrm_state_check_expire(struct xfrm_state *x); | |||
912 | extern void xfrm_state_insert(struct xfrm_state *x); | 912 | extern void xfrm_state_insert(struct xfrm_state *x); |
913 | extern int xfrm_state_add(struct xfrm_state *x); | 913 | extern int xfrm_state_add(struct xfrm_state *x); |
914 | extern int xfrm_state_update(struct xfrm_state *x); | 914 | extern int xfrm_state_update(struct xfrm_state *x); |
915 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); | 915 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); |
916 | extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); | 916 | extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); |
917 | #ifdef CONFIG_XFRM_SUB_POLICY | 917 | #ifdef CONFIG_XFRM_SUB_POLICY |
918 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | 918 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, |
@@ -935,8 +935,8 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s | |||
935 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 935 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
936 | extern int xfrm_state_delete(struct xfrm_state *x); | 936 | extern int xfrm_state_delete(struct xfrm_state *x); |
937 | extern void xfrm_state_flush(u8 proto); | 937 | extern void xfrm_state_flush(u8 proto); |
938 | extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); | 938 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); |
939 | extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); | 939 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
940 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 940 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
941 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); | 941 | extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); |
942 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 942 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
@@ -945,7 +945,7 @@ extern int xfrm4_rcv(struct sk_buff *skb); | |||
945 | extern int xfrm4_output(struct sk_buff *skb); | 945 | extern int xfrm4_output(struct sk_buff *skb); |
946 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); | 946 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); |
947 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); | 947 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); |
948 | extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); | 948 | extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); |
949 | extern int xfrm6_rcv(struct sk_buff **pskb); | 949 | extern int xfrm6_rcv(struct sk_buff **pskb); |
950 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | 950 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
951 | xfrm_address_t *saddr, u8 proto); | 951 | xfrm_address_t *saddr, u8 proto); |
@@ -989,7 +989,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | |||
989 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); | 989 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); |
990 | void xfrm_policy_flush(u8 type); | 990 | void xfrm_policy_flush(u8 type); |
991 | u32 xfrm_get_acqseq(void); | 991 | u32 xfrm_get_acqseq(void); |
992 | void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 992 | void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); |
993 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 993 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, |
994 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 994 | xfrm_address_t *daddr, xfrm_address_t *saddr, |
995 | int create, unsigned short family); | 995 | int create, unsigned short family); |
@@ -1004,7 +1004,7 @@ extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pi | |||
1004 | extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | 1004 | extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); |
1005 | 1005 | ||
1006 | extern void xfrm_input_init(void); | 1006 | extern void xfrm_input_init(void); |
1007 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); | 1007 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); |
1008 | 1008 | ||
1009 | extern void xfrm_probe_algs(void); | 1009 | extern void xfrm_probe_algs(void); |
1010 | extern int xfrm_count_auth_supported(void); | 1010 | extern int xfrm_count_auth_supported(void); |
diff --git a/net/802/tr.c b/net/802/tr.c index d7d8f40c4fed..829deb41ce81 100644 --- a/net/802/tr.c +++ b/net/802/tr.c | |||
@@ -164,7 +164,7 @@ static int tr_rebuild_header(struct sk_buff *skb) | |||
164 | */ | 164 | */ |
165 | 165 | ||
166 | if(trllc->ethertype != htons(ETH_P_IP)) { | 166 | if(trllc->ethertype != htons(ETH_P_IP)) { |
167 | printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n",(unsigned int)htons(trllc->ethertype)); | 167 | printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype)); |
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
170 | 170 | ||
@@ -186,7 +186,7 @@ static int tr_rebuild_header(struct sk_buff *skb) | |||
186 | * it via SNAP. | 186 | * it via SNAP. |
187 | */ | 187 | */ |
188 | 188 | ||
189 | unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev) | 189 | __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) |
190 | { | 190 | { |
191 | 191 | ||
192 | struct trh_hdr *trh=(struct trh_hdr *)skb->data; | 192 | struct trh_hdr *trh=(struct trh_hdr *)skb->data; |
@@ -229,15 +229,15 @@ unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
229 | */ | 229 | */ |
230 | 230 | ||
231 | if (trllc->dsap == EXTENDED_SAP && | 231 | if (trllc->dsap == EXTENDED_SAP && |
232 | (trllc->ethertype == ntohs(ETH_P_IP) || | 232 | (trllc->ethertype == htons(ETH_P_IP) || |
233 | trllc->ethertype == ntohs(ETH_P_IPV6) || | 233 | trllc->ethertype == htons(ETH_P_IPV6) || |
234 | trllc->ethertype == ntohs(ETH_P_ARP))) | 234 | trllc->ethertype == htons(ETH_P_ARP))) |
235 | { | 235 | { |
236 | skb_pull(skb, sizeof(struct trllc)); | 236 | skb_pull(skb, sizeof(struct trllc)); |
237 | return trllc->ethertype; | 237 | return trllc->ethertype; |
238 | } | 238 | } |
239 | 239 | ||
240 | return ntohs(ETH_P_TR_802_2); | 240 | return htons(ETH_P_TR_802_2); |
241 | } | 241 | } |
242 | 242 | ||
243 | /* | 243 | /* |
diff --git a/net/Kconfig b/net/Kconfig index 6528a935622c..a81aca43932f 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -231,7 +231,7 @@ config NET_TCPPROBE | |||
231 | TCP congestion avoidance modules. If you don't understand | 231 | TCP congestion avoidance modules. If you don't understand |
232 | what was just said, you don't need it: say N. | 232 | what was just said, you don't need it: say N. |
233 | 233 | ||
234 | Documentation on how to use the packet generator can be found | 234 | Documentation on how to use TCP connection probing can be found |
235 | at http://linux-net.osdl.org/index.php/TcpProbe | 235 | at http://linux-net.osdl.org/index.php/TcpProbe |
236 | 236 | ||
237 | To compile this code as a module, choose M here: the | 237 | To compile this code as a module, choose M here: the |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 96dc6bb52d14..708e2e0371af 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1002,7 +1002,7 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, | |||
1002 | return sum; | 1002 | return sum; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | static unsigned short atalk_checksum(const struct sk_buff *skb, int len) | 1005 | static __be16 atalk_checksum(const struct sk_buff *skb, int len) |
1006 | { | 1006 | { |
1007 | unsigned long sum; | 1007 | unsigned long sum; |
1008 | 1008 | ||
@@ -1010,7 +1010,7 @@ static unsigned short atalk_checksum(const struct sk_buff *skb, int len) | |||
1010 | sum = atalk_sum_skb(skb, 4, len-4, 0); | 1010 | sum = atalk_sum_skb(skb, 4, len-4, 0); |
1011 | 1011 | ||
1012 | /* Use 0xFFFF for 0. 0 itself means none */ | 1012 | /* Use 0xFFFF for 0. 0 itself means none */ |
1013 | return sum ? htons((unsigned short)sum) : 0xFFFF; | 1013 | return sum ? htons((unsigned short)sum) : htons(0xFFFF); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | static struct proto ddp_proto = { | 1016 | static struct proto ddp_proto = { |
@@ -1289,7 +1289,7 @@ static int handle_ip_over_ddp(struct sk_buff *skb) | |||
1289 | #endif | 1289 | #endif |
1290 | 1290 | ||
1291 | static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, | 1291 | static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, |
1292 | struct ddpehdr *ddp, struct ddpebits *ddphv, | 1292 | struct ddpehdr *ddp, __u16 len_hops, |
1293 | int origlen) | 1293 | int origlen) |
1294 | { | 1294 | { |
1295 | struct atalk_route *rt; | 1295 | struct atalk_route *rt; |
@@ -1317,10 +1317,12 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, | |||
1317 | 1317 | ||
1318 | /* Route the packet */ | 1318 | /* Route the packet */ |
1319 | rt = atrtr_find(&ta); | 1319 | rt = atrtr_find(&ta); |
1320 | if (!rt || ddphv->deh_hops == DDP_MAXHOPS) | 1320 | /* increment hops count */ |
1321 | len_hops += 1 << 10; | ||
1322 | if (!rt || !(len_hops & (15 << 10))) | ||
1321 | goto free_it; | 1323 | goto free_it; |
1324 | |||
1322 | /* FIXME: use skb->cb to be able to use shared skbs */ | 1325 | /* FIXME: use skb->cb to be able to use shared skbs */ |
1323 | ddphv->deh_hops++; | ||
1324 | 1326 | ||
1325 | /* | 1327 | /* |
1326 | * Route goes through another gateway, so set the target to the | 1328 | * Route goes through another gateway, so set the target to the |
@@ -1335,11 +1337,10 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev, | |||
1335 | /* Fix up skb->len field */ | 1337 | /* Fix up skb->len field */ |
1336 | skb_trim(skb, min_t(unsigned int, origlen, | 1338 | skb_trim(skb, min_t(unsigned int, origlen, |
1337 | (rt->dev->hard_header_len + | 1339 | (rt->dev->hard_header_len + |
1338 | ddp_dl->header_length + ddphv->deh_len))); | 1340 | ddp_dl->header_length + (len_hops & 1023)))); |
1339 | 1341 | ||
1340 | /* Mend the byte order */ | ||
1341 | /* FIXME: use skb->cb to be able to use shared skbs */ | 1342 | /* FIXME: use skb->cb to be able to use shared skbs */ |
1342 | *((__u16 *)ddp) = ntohs(*((__u16 *)ddphv)); | 1343 | ddp->deh_len_hops = htons(len_hops); |
1343 | 1344 | ||
1344 | /* | 1345 | /* |
1345 | * Send the buffer onwards | 1346 | * Send the buffer onwards |
@@ -1394,7 +1395,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1394 | struct atalk_iface *atif; | 1395 | struct atalk_iface *atif; |
1395 | struct sockaddr_at tosat; | 1396 | struct sockaddr_at tosat; |
1396 | int origlen; | 1397 | int origlen; |
1397 | struct ddpebits ddphv; | 1398 | __u16 len_hops; |
1398 | 1399 | ||
1399 | /* Don't mangle buffer if shared */ | 1400 | /* Don't mangle buffer if shared */ |
1400 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 1401 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) |
@@ -1406,16 +1407,11 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1406 | 1407 | ||
1407 | ddp = ddp_hdr(skb); | 1408 | ddp = ddp_hdr(skb); |
1408 | 1409 | ||
1409 | /* | 1410 | len_hops = ntohs(ddp->deh_len_hops); |
1410 | * Fix up the length field [Ok this is horrible but otherwise | ||
1411 | * I end up with unions of bit fields and messy bit field order | ||
1412 | * compiler/endian dependencies..] | ||
1413 | */ | ||
1414 | *((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp)); | ||
1415 | 1411 | ||
1416 | /* Trim buffer in case of stray trailing data */ | 1412 | /* Trim buffer in case of stray trailing data */ |
1417 | origlen = skb->len; | 1413 | origlen = skb->len; |
1418 | skb_trim(skb, min_t(unsigned int, skb->len, ddphv.deh_len)); | 1414 | skb_trim(skb, min_t(unsigned int, skb->len, len_hops & 1023)); |
1419 | 1415 | ||
1420 | /* | 1416 | /* |
1421 | * Size check to see if ddp->deh_len was crap | 1417 | * Size check to see if ddp->deh_len was crap |
@@ -1430,7 +1426,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1430 | * valid for net byte orders all over the networking code... | 1426 | * valid for net byte orders all over the networking code... |
1431 | */ | 1427 | */ |
1432 | if (ddp->deh_sum && | 1428 | if (ddp->deh_sum && |
1433 | atalk_checksum(skb, ddphv.deh_len) != ddp->deh_sum) | 1429 | atalk_checksum(skb, len_hops & 1023) != ddp->deh_sum) |
1434 | /* Not a valid AppleTalk frame - dustbin time */ | 1430 | /* Not a valid AppleTalk frame - dustbin time */ |
1435 | goto freeit; | 1431 | goto freeit; |
1436 | 1432 | ||
@@ -1444,7 +1440,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1444 | /* Not ours, so we route the packet via the correct | 1440 | /* Not ours, so we route the packet via the correct |
1445 | * AppleTalk iface | 1441 | * AppleTalk iface |
1446 | */ | 1442 | */ |
1447 | atalk_route_packet(skb, dev, ddp, &ddphv, origlen); | 1443 | atalk_route_packet(skb, dev, ddp, len_hops, origlen); |
1448 | goto out; | 1444 | goto out; |
1449 | } | 1445 | } |
1450 | 1446 | ||
@@ -1489,7 +1485,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1489 | /* Find our address */ | 1485 | /* Find our address */ |
1490 | struct atalk_addr *ap = atalk_find_dev_addr(dev); | 1486 | struct atalk_addr *ap = atalk_find_dev_addr(dev); |
1491 | 1487 | ||
1492 | if (!ap || skb->len < sizeof(struct ddpshdr)) | 1488 | if (!ap || skb->len < sizeof(__be16) || skb->len > 1023) |
1493 | goto freeit; | 1489 | goto freeit; |
1494 | 1490 | ||
1495 | /* Don't mangle buffer if shared */ | 1491 | /* Don't mangle buffer if shared */ |
@@ -1519,11 +1515,8 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1519 | /* | 1515 | /* |
1520 | * Not sure about this bit... | 1516 | * Not sure about this bit... |
1521 | */ | 1517 | */ |
1522 | ddp->deh_len = skb->len; | 1518 | /* Non routable, so force a drop if we slip up later */ |
1523 | ddp->deh_hops = DDP_MAXHOPS; /* Non routable, so force a drop | 1519 | ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10)); |
1524 | if we slip up later */ | ||
1525 | /* Mend the byte order */ | ||
1526 | *((__u16 *)ddp) = htons(*((__u16 *)ddp)); | ||
1527 | } | 1520 | } |
1528 | skb->h.raw = skb->data; | 1521 | skb->h.raw = skb->data; |
1529 | 1522 | ||
@@ -1622,16 +1615,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr | |||
1622 | SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); | 1615 | SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); |
1623 | 1616 | ||
1624 | ddp = (struct ddpehdr *)skb_put(skb, sizeof(struct ddpehdr)); | 1617 | ddp = (struct ddpehdr *)skb_put(skb, sizeof(struct ddpehdr)); |
1625 | ddp->deh_pad = 0; | 1618 | ddp->deh_len_hops = htons(len + sizeof(*ddp)); |
1626 | ddp->deh_hops = 0; | ||
1627 | ddp->deh_len = len + sizeof(*ddp); | ||
1628 | /* | ||
1629 | * Fix up the length field [Ok this is horrible but otherwise | ||
1630 | * I end up with unions of bit fields and messy bit field order | ||
1631 | * compiler/endian dependencies.. | ||
1632 | */ | ||
1633 | *((__u16 *)ddp) = ntohs(*((__u16 *)ddp)); | ||
1634 | |||
1635 | ddp->deh_dnet = usat->sat_addr.s_net; | 1619 | ddp->deh_dnet = usat->sat_addr.s_net; |
1636 | ddp->deh_snet = at->src_net; | 1620 | ddp->deh_snet = at->src_net; |
1637 | ddp->deh_dnode = usat->sat_addr.s_node; | 1621 | ddp->deh_dnode = usat->sat_addr.s_node; |
@@ -1712,8 +1696,8 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr | |||
1712 | struct sockaddr_at *sat = (struct sockaddr_at *)msg->msg_name; | 1696 | struct sockaddr_at *sat = (struct sockaddr_at *)msg->msg_name; |
1713 | struct ddpehdr *ddp; | 1697 | struct ddpehdr *ddp; |
1714 | int copied = 0; | 1698 | int copied = 0; |
1699 | int offset = 0; | ||
1715 | int err = 0; | 1700 | int err = 0; |
1716 | struct ddpebits ddphv; | ||
1717 | struct sk_buff *skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1701 | struct sk_buff *skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
1718 | flags & MSG_DONTWAIT, &err); | 1702 | flags & MSG_DONTWAIT, &err); |
1719 | if (!skb) | 1703 | if (!skb) |
@@ -1721,25 +1705,18 @@ static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr | |||
1721 | 1705 | ||
1722 | /* FIXME: use skb->cb to be able to use shared skbs */ | 1706 | /* FIXME: use skb->cb to be able to use shared skbs */ |
1723 | ddp = ddp_hdr(skb); | 1707 | ddp = ddp_hdr(skb); |
1724 | *((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp)); | 1708 | copied = ntohs(ddp->deh_len_hops) & 1023; |
1725 | 1709 | ||
1726 | if (sk->sk_type == SOCK_RAW) { | 1710 | if (sk->sk_type != SOCK_RAW) { |
1727 | copied = ddphv.deh_len; | 1711 | offset = sizeof(*ddp); |
1728 | if (copied > size) { | 1712 | copied -= offset; |
1729 | copied = size; | 1713 | } |
1730 | msg->msg_flags |= MSG_TRUNC; | ||
1731 | } | ||
1732 | 1714 | ||
1733 | err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); | 1715 | if (copied > size) { |
1734 | } else { | 1716 | copied = size; |
1735 | copied = ddphv.deh_len - sizeof(*ddp); | 1717 | msg->msg_flags |= MSG_TRUNC; |
1736 | if (copied > size) { | ||
1737 | copied = size; | ||
1738 | msg->msg_flags |= MSG_TRUNC; | ||
1739 | } | ||
1740 | err = skb_copy_datagram_iovec(skb, sizeof(*ddp), | ||
1741 | msg->msg_iov, copied); | ||
1742 | } | 1718 | } |
1719 | err = skb_copy_datagram_iovec(skb, offset, msg->msg_iov, copied); | ||
1743 | 1720 | ||
1744 | if (!err) { | 1721 | if (!err) { |
1745 | if (sat) { | 1722 | if (sat) { |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index b87c2a88bdce..0d2b994af511 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -560,7 +560,6 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
560 | struct atmmpc_ioc ioc_data; | 560 | struct atmmpc_ioc ioc_data; |
561 | in_cache_entry *in_entry; | 561 | in_cache_entry *in_entry; |
562 | uint32_t ipaddr; | 562 | uint32_t ipaddr; |
563 | unsigned char *ip; | ||
564 | 563 | ||
565 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); | 564 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); |
566 | if (bytes_left != 0) { | 565 | if (bytes_left != 0) { |
@@ -583,9 +582,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
583 | if (in_entry != NULL) mpc->in_ops->put(in_entry); | 582 | if (in_entry != NULL) mpc->in_ops->put(in_entry); |
584 | return -EINVAL; | 583 | return -EINVAL; |
585 | } | 584 | } |
586 | ip = (unsigned char*)&in_entry->ctrl_info.in_dst_ip; | ||
587 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n", | 585 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n", |
588 | mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); | 586 | mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip)); |
589 | in_entry->shortcut = vcc; | 587 | in_entry->shortcut = vcc; |
590 | mpc->in_ops->put(in_entry); | 588 | mpc->in_ops->put(in_entry); |
591 | } else { | 589 | } else { |
@@ -616,10 +614,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) | |||
616 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); | 614 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); |
617 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); | 615 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); |
618 | if (in_entry) { | 616 | if (in_entry) { |
619 | unsigned char *ip __attribute__ ((unused)) = | ||
620 | (unsigned char *)&in_entry->ctrl_info.in_dst_ip; | ||
621 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n", | 617 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n", |
622 | mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); | 618 | mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip)); |
623 | in_entry->shortcut = NULL; | 619 | in_entry->shortcut = NULL; |
624 | mpc->in_ops->put(in_entry); | 620 | mpc->in_ops->put(in_entry); |
625 | } | 621 | } |
@@ -1154,18 +1150,17 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
1154 | { | 1150 | { |
1155 | uint32_t dst_ip = msg->content.in_info.in_dst_ip; | 1151 | uint32_t dst_ip = msg->content.in_info.in_dst_ip; |
1156 | uint32_t mask = msg->ip_mask; | 1152 | uint32_t mask = msg->ip_mask; |
1157 | unsigned char *ip = (unsigned char *)&dst_ip; | ||
1158 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); | 1153 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); |
1159 | 1154 | ||
1160 | if(entry == NULL){ | 1155 | if(entry == NULL){ |
1161 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name); | 1156 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name); |
1162 | printk("ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]); | 1157 | printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); |
1163 | return; | 1158 | return; |
1164 | } | 1159 | } |
1165 | 1160 | ||
1166 | do { | 1161 | do { |
1167 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" , | 1162 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" , |
1168 | mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); | 1163 | mpc->dev->name, NIPQUAD(dst_ip)); |
1169 | write_lock_bh(&mpc->ingress_lock); | 1164 | write_lock_bh(&mpc->ingress_lock); |
1170 | mpc->in_ops->remove_entry(entry, mpc); | 1165 | mpc->in_ops->remove_entry(entry, mpc); |
1171 | write_unlock_bh(&mpc->ingress_lock); | 1166 | write_unlock_bh(&mpc->ingress_lock); |
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c index 781ed1b9329d..fbf13cdcf46e 100644 --- a/net/atm/mpoa_caches.c +++ b/net/atm/mpoa_caches.c | |||
@@ -87,7 +87,6 @@ static in_cache_entry *in_cache_get_by_vcc(struct atm_vcc *vcc, | |||
87 | static in_cache_entry *in_cache_add_entry(uint32_t dst_ip, | 87 | static in_cache_entry *in_cache_add_entry(uint32_t dst_ip, |
88 | struct mpoa_client *client) | 88 | struct mpoa_client *client) |
89 | { | 89 | { |
90 | unsigned char *ip __attribute__ ((unused)) = (unsigned char *)&dst_ip; | ||
91 | in_cache_entry* entry = kmalloc(sizeof(in_cache_entry), GFP_KERNEL); | 90 | in_cache_entry* entry = kmalloc(sizeof(in_cache_entry), GFP_KERNEL); |
92 | 91 | ||
93 | if (entry == NULL) { | 92 | if (entry == NULL) { |
@@ -95,7 +94,7 @@ static in_cache_entry *in_cache_add_entry(uint32_t dst_ip, | |||
95 | return NULL; | 94 | return NULL; |
96 | } | 95 | } |
97 | 96 | ||
98 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]); | 97 | dprintk("mpoa: mpoa_caches.c: adding an ingress entry, ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip)); |
99 | memset(entry,0,sizeof(in_cache_entry)); | 98 | memset(entry,0,sizeof(in_cache_entry)); |
100 | 99 | ||
101 | atomic_set(&entry->use, 1); | 100 | atomic_set(&entry->use, 1); |
@@ -152,10 +151,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) | |||
152 | 151 | ||
153 | if( entry->count > mpc->parameters.mpc_p1 && | 152 | if( entry->count > mpc->parameters.mpc_p1 && |
154 | entry->entry_state == INGRESS_INVALID){ | 153 | entry->entry_state == INGRESS_INVALID){ |
155 | unsigned char *ip __attribute__ ((unused)) = | 154 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, NIPQUAD(entry->ctrl_info.in_dst_ip)); |
156 | (unsigned char *)&entry->ctrl_info.in_dst_ip; | ||
157 | |||
158 | dprintk("mpoa: (%s) mpoa_caches.c: threshold exceeded for ip %u.%u.%u.%u, sending MPOA res req\n", mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); | ||
159 | entry->entry_state = INGRESS_RESOLVING; | 155 | entry->entry_state = INGRESS_RESOLVING; |
160 | msg.type = SND_MPOA_RES_RQST; | 156 | msg.type = SND_MPOA_RES_RQST; |
161 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); | 157 | memcpy(msg.MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN ); |
@@ -187,11 +183,9 @@ static void in_cache_remove_entry(in_cache_entry *entry, | |||
187 | { | 183 | { |
188 | struct atm_vcc *vcc; | 184 | struct atm_vcc *vcc; |
189 | struct k_message msg; | 185 | struct k_message msg; |
190 | unsigned char *ip; | ||
191 | 186 | ||
192 | vcc = entry->shortcut; | 187 | vcc = entry->shortcut; |
193 | ip = (unsigned char *)&entry->ctrl_info.in_dst_ip; | 188 | dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",NIPQUAD(entry->ctrl_info.in_dst_ip)); |
194 | dprintk("mpoa: mpoa_caches.c: removing an ingress entry, ip = %u.%u.%u.%u\n",ip[0], ip[1], ip[2], ip[3]); | ||
195 | 189 | ||
196 | if (entry->prev != NULL) | 190 | if (entry->prev != NULL) |
197 | entry->prev->next = entry->next; | 191 | entry->prev->next = entry->next; |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 788ea7a2b744..305a099b7477 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -276,7 +276,7 @@ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) | |||
276 | set_current_state(TASK_INTERRUPTIBLE); | 276 | set_current_state(TASK_INTERRUPTIBLE); |
277 | 277 | ||
278 | if (!timeo) { | 278 | if (!timeo) { |
279 | err = -EAGAIN; | 279 | err = -EINPROGRESS; |
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | 282 | ||
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index e620061fb50f..2312d050eeed 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <asm/unaligned.h> | 51 | #include <asm/unaligned.h> |
52 | 52 | ||
53 | #include <net/bluetooth/bluetooth.h> | 53 | #include <net/bluetooth/bluetooth.h> |
54 | #include <net/bluetooth/hci_core.h> | ||
54 | #include <net/bluetooth/l2cap.h> | 55 | #include <net/bluetooth/l2cap.h> |
55 | 56 | ||
56 | #include "bnep.h" | 57 | #include "bnep.h" |
@@ -515,6 +516,26 @@ static int bnep_session(void *arg) | |||
515 | return 0; | 516 | return 0; |
516 | } | 517 | } |
517 | 518 | ||
519 | static struct device *bnep_get_device(struct bnep_session *session) | ||
520 | { | ||
521 | bdaddr_t *src = &bt_sk(session->sock->sk)->src; | ||
522 | bdaddr_t *dst = &bt_sk(session->sock->sk)->dst; | ||
523 | struct hci_dev *hdev; | ||
524 | struct hci_conn *conn; | ||
525 | |||
526 | hdev = hci_get_route(dst, src); | ||
527 | if (!hdev) | ||
528 | return NULL; | ||
529 | |||
530 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); | ||
531 | if (!conn) | ||
532 | return NULL; | ||
533 | |||
534 | hci_dev_put(hdev); | ||
535 | |||
536 | return &conn->dev; | ||
537 | } | ||
538 | |||
518 | int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | 539 | int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) |
519 | { | 540 | { |
520 | struct net_device *dev; | 541 | struct net_device *dev; |
@@ -534,7 +555,6 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | |||
534 | if (!dev) | 555 | if (!dev) |
535 | return -ENOMEM; | 556 | return -ENOMEM; |
536 | 557 | ||
537 | |||
538 | down_write(&bnep_session_sem); | 558 | down_write(&bnep_session_sem); |
539 | 559 | ||
540 | ss = __bnep_get_session(dst); | 560 | ss = __bnep_get_session(dst); |
@@ -551,7 +571,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | |||
551 | memcpy(s->eh.h_source, &dst, ETH_ALEN); | 571 | memcpy(s->eh.h_source, &dst, ETH_ALEN); |
552 | memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN); | 572 | memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN); |
553 | 573 | ||
554 | s->dev = dev; | 574 | s->dev = dev; |
555 | s->sock = sock; | 575 | s->sock = sock; |
556 | s->role = req->role; | 576 | s->role = req->role; |
557 | s->state = BT_CONNECTED; | 577 | s->state = BT_CONNECTED; |
@@ -568,6 +588,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | |||
568 | bnep_set_default_proto_filter(s); | 588 | bnep_set_default_proto_filter(s); |
569 | #endif | 589 | #endif |
570 | 590 | ||
591 | SET_NETDEV_DEV(dev, bnep_get_device(s)); | ||
592 | |||
571 | err = register_netdev(dev); | 593 | err = register_netdev(dev); |
572 | if (err) { | 594 | if (err) { |
573 | goto failed; | 595 | goto failed; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 420ed4d7e57e..90e3a285a17e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -84,6 +84,20 @@ static void hci_acl_connect(struct hci_conn *conn) | |||
84 | hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp); | 84 | hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void hci_acl_connect_cancel(struct hci_conn *conn) | ||
88 | { | ||
89 | struct hci_cp_create_conn_cancel cp; | ||
90 | |||
91 | BT_DBG("%p", conn); | ||
92 | |||
93 | if (conn->hdev->hci_ver < 2) | ||
94 | return; | ||
95 | |||
96 | bacpy(&cp.bdaddr, &conn->dst); | ||
97 | hci_send_cmd(conn->hdev, OGF_LINK_CTL, | ||
98 | OCF_CREATE_CONN_CANCEL, sizeof(cp), &cp); | ||
99 | } | ||
100 | |||
87 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason) | 101 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason) |
88 | { | 102 | { |
89 | struct hci_cp_disconnect cp; | 103 | struct hci_cp_disconnect cp; |
@@ -94,7 +108,8 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason) | |||
94 | 108 | ||
95 | cp.handle = __cpu_to_le16(conn->handle); | 109 | cp.handle = __cpu_to_le16(conn->handle); |
96 | cp.reason = reason; | 110 | cp.reason = reason; |
97 | hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_DISCONNECT, sizeof(cp), &cp); | 111 | hci_send_cmd(conn->hdev, OGF_LINK_CTL, |
112 | OCF_DISCONNECT, sizeof(cp), &cp); | ||
98 | } | 113 | } |
99 | 114 | ||
100 | void hci_add_sco(struct hci_conn *conn, __u16 handle) | 115 | void hci_add_sco(struct hci_conn *conn, __u16 handle) |
@@ -124,12 +139,20 @@ static void hci_conn_timeout(unsigned long arg) | |||
124 | return; | 139 | return; |
125 | 140 | ||
126 | hci_dev_lock(hdev); | 141 | hci_dev_lock(hdev); |
127 | if (conn->state == BT_CONNECTED) | 142 | |
143 | switch (conn->state) { | ||
144 | case BT_CONNECT: | ||
145 | hci_acl_connect_cancel(conn); | ||
146 | break; | ||
147 | case BT_CONNECTED: | ||
128 | hci_acl_disconn(conn, 0x13); | 148 | hci_acl_disconn(conn, 0x13); |
129 | else | 149 | break; |
150 | default: | ||
130 | conn->state = BT_CLOSED; | 151 | conn->state = BT_CLOSED; |
152 | break; | ||
153 | } | ||
154 | |||
131 | hci_dev_unlock(hdev); | 155 | hci_dev_unlock(hdev); |
132 | return; | ||
133 | } | 156 | } |
134 | 157 | ||
135 | static void hci_conn_idle(unsigned long arg) | 158 | static void hci_conn_idle(unsigned long arg) |
@@ -179,6 +202,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
179 | if (hdev->notify) | 202 | if (hdev->notify) |
180 | hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); | 203 | hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); |
181 | 204 | ||
205 | hci_conn_add_sysfs(conn); | ||
206 | |||
182 | tasklet_enable(&hdev->tx_task); | 207 | tasklet_enable(&hdev->tx_task); |
183 | 208 | ||
184 | return conn; | 209 | return conn; |
@@ -211,6 +236,8 @@ int hci_conn_del(struct hci_conn *conn) | |||
211 | 236 | ||
212 | tasklet_disable(&hdev->tx_task); | 237 | tasklet_disable(&hdev->tx_task); |
213 | 238 | ||
239 | hci_conn_del_sysfs(conn); | ||
240 | |||
214 | hci_conn_hash_del(hdev, conn); | 241 | hci_conn_hash_del(hdev, conn); |
215 | if (hdev->notify) | 242 | if (hdev->notify) |
216 | hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); | 243 | hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); |
@@ -221,7 +248,9 @@ int hci_conn_del(struct hci_conn *conn) | |||
221 | 248 | ||
222 | hci_dev_put(hdev); | 249 | hci_dev_put(hdev); |
223 | 250 | ||
224 | kfree(conn); | 251 | /* will free via device release */ |
252 | put_device(&conn->dev); | ||
253 | |||
225 | return 0; | 254 | return 0; |
226 | } | 255 | } |
227 | 256 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 5ed474277903..338ae977a31b 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -206,6 +206,9 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | |||
206 | /* Read Local Supported Features */ | 206 | /* Read Local Supported Features */ |
207 | hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_LOCAL_FEATURES, 0, NULL); | 207 | hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_LOCAL_FEATURES, 0, NULL); |
208 | 208 | ||
209 | /* Read Local Version */ | ||
210 | hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_LOCAL_VERSION, 0, NULL); | ||
211 | |||
209 | /* Read Buffer Size (ACL mtu, max pkt, etc.) */ | 212 | /* Read Buffer Size (ACL mtu, max pkt, etc.) */ |
210 | hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_BUFFER_SIZE, 0, NULL); | 213 | hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_BUFFER_SIZE, 0, NULL); |
211 | 214 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 3896dabab11d..d43d0c890975 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -62,6 +62,7 @@ static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb | |||
62 | 62 | ||
63 | switch (ocf) { | 63 | switch (ocf) { |
64 | case OCF_INQUIRY_CANCEL: | 64 | case OCF_INQUIRY_CANCEL: |
65 | case OCF_EXIT_PERIODIC_INQ: | ||
65 | status = *((__u8 *) skb->data); | 66 | status = *((__u8 *) skb->data); |
66 | 67 | ||
67 | if (status) { | 68 | if (status) { |
@@ -297,6 +298,7 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb | |||
297 | /* Command Complete OGF INFO_PARAM */ | 298 | /* Command Complete OGF INFO_PARAM */ |
298 | static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) | 299 | static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) |
299 | { | 300 | { |
301 | struct hci_rp_read_loc_version *lv; | ||
300 | struct hci_rp_read_local_features *lf; | 302 | struct hci_rp_read_local_features *lf; |
301 | struct hci_rp_read_buffer_size *bs; | 303 | struct hci_rp_read_buffer_size *bs; |
302 | struct hci_rp_read_bd_addr *ba; | 304 | struct hci_rp_read_bd_addr *ba; |
@@ -304,6 +306,23 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s | |||
304 | BT_DBG("%s ocf 0x%x", hdev->name, ocf); | 306 | BT_DBG("%s ocf 0x%x", hdev->name, ocf); |
305 | 307 | ||
306 | switch (ocf) { | 308 | switch (ocf) { |
309 | case OCF_READ_LOCAL_VERSION: | ||
310 | lv = (struct hci_rp_read_loc_version *) skb->data; | ||
311 | |||
312 | if (lv->status) { | ||
313 | BT_DBG("%s READ_LOCAL_VERSION failed %d", hdev->name, lf->status); | ||
314 | break; | ||
315 | } | ||
316 | |||
317 | hdev->hci_ver = lv->hci_ver; | ||
318 | hdev->hci_rev = btohs(lv->hci_rev); | ||
319 | hdev->manufacturer = btohs(lv->manufacturer); | ||
320 | |||
321 | BT_DBG("%s: manufacturer %d hci_ver %d hci_rev %d", hdev->name, | ||
322 | hdev->manufacturer, hdev->hci_ver, hdev->hci_rev); | ||
323 | |||
324 | break; | ||
325 | |||
307 | case OCF_READ_LOCAL_FEATURES: | 326 | case OCF_READ_LOCAL_FEATURES: |
308 | lf = (struct hci_rp_read_local_features *) skb->data; | 327 | lf = (struct hci_rp_read_local_features *) skb->data; |
309 | 328 | ||
@@ -328,7 +347,8 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s | |||
328 | if (hdev->features[1] & LMP_HV3) | 347 | if (hdev->features[1] & LMP_HV3) |
329 | hdev->pkt_type |= (HCI_HV3); | 348 | hdev->pkt_type |= (HCI_HV3); |
330 | 349 | ||
331 | BT_DBG("%s: features 0x%x 0x%x 0x%x", hdev->name, lf->features[0], lf->features[1], lf->features[2]); | 350 | BT_DBG("%s: features 0x%x 0x%x 0x%x", hdev->name, |
351 | lf->features[0], lf->features[1], lf->features[2]); | ||
332 | 352 | ||
333 | break; | 353 | break; |
334 | 354 | ||
@@ -757,6 +777,10 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
757 | 777 | ||
758 | hci_send_cmd(hdev, OGF_LINK_CTL, | 778 | hci_send_cmd(hdev, OGF_LINK_CTL, |
759 | OCF_CHANGE_CONN_PTYPE, sizeof(cp), &cp); | 779 | OCF_CHANGE_CONN_PTYPE, sizeof(cp), &cp); |
780 | } else { | ||
781 | /* Update disconnect timer */ | ||
782 | hci_conn_hold(conn); | ||
783 | hci_conn_put(conn); | ||
760 | } | 784 | } |
761 | } else | 785 | } else |
762 | conn->state = BT_CLOSED; | 786 | conn->state = BT_CLOSED; |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 3987d167f04e..989b22d9042e 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -13,16 +13,32 @@ | |||
13 | #define BT_DBG(D...) | 13 | #define BT_DBG(D...) |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) | 16 | static inline char *typetostr(int type) |
17 | { | 17 | { |
18 | struct hci_dev *hdev = dev_get_drvdata(dev); | 18 | switch (type) { |
19 | return sprintf(buf, "%s\n", hdev->name); | 19 | case HCI_VIRTUAL: |
20 | return "VIRTUAL"; | ||
21 | case HCI_USB: | ||
22 | return "USB"; | ||
23 | case HCI_PCCARD: | ||
24 | return "PCCARD"; | ||
25 | case HCI_UART: | ||
26 | return "UART"; | ||
27 | case HCI_RS232: | ||
28 | return "RS232"; | ||
29 | case HCI_PCI: | ||
30 | return "PCI"; | ||
31 | case HCI_SDIO: | ||
32 | return "SDIO"; | ||
33 | default: | ||
34 | return "UNKNOWN"; | ||
35 | } | ||
20 | } | 36 | } |
21 | 37 | ||
22 | static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) | 38 | static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) |
23 | { | 39 | { |
24 | struct hci_dev *hdev = dev_get_drvdata(dev); | 40 | struct hci_dev *hdev = dev_get_drvdata(dev); |
25 | return sprintf(buf, "%d\n", hdev->type); | 41 | return sprintf(buf, "%s\n", typetostr(hdev->type)); |
26 | } | 42 | } |
27 | 43 | ||
28 | static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf) | 44 | static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -33,10 +49,22 @@ static ssize_t show_address(struct device *dev, struct device_attribute *attr, c | |||
33 | return sprintf(buf, "%s\n", batostr(&bdaddr)); | 49 | return sprintf(buf, "%s\n", batostr(&bdaddr)); |
34 | } | 50 | } |
35 | 51 | ||
36 | static ssize_t show_flags(struct device *dev, struct device_attribute *attr, char *buf) | 52 | static ssize_t show_manufacturer(struct device *dev, struct device_attribute *attr, char *buf) |
53 | { | ||
54 | struct hci_dev *hdev = dev_get_drvdata(dev); | ||
55 | return sprintf(buf, "%d\n", hdev->manufacturer); | ||
56 | } | ||
57 | |||
58 | static ssize_t show_hci_version(struct device *dev, struct device_attribute *attr, char *buf) | ||
37 | { | 59 | { |
38 | struct hci_dev *hdev = dev_get_drvdata(dev); | 60 | struct hci_dev *hdev = dev_get_drvdata(dev); |
39 | return sprintf(buf, "0x%lx\n", hdev->flags); | 61 | return sprintf(buf, "%d\n", hdev->hci_ver); |
62 | } | ||
63 | |||
64 | static ssize_t show_hci_revision(struct device *dev, struct device_attribute *attr, char *buf) | ||
65 | { | ||
66 | struct hci_dev *hdev = dev_get_drvdata(dev); | ||
67 | return sprintf(buf, "%d\n", hdev->hci_rev); | ||
40 | } | 68 | } |
41 | 69 | ||
42 | static ssize_t show_inquiry_cache(struct device *dev, struct device_attribute *attr, char *buf) | 70 | static ssize_t show_inquiry_cache(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -141,10 +169,11 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib | |||
141 | return count; | 169 | return count; |
142 | } | 170 | } |
143 | 171 | ||
144 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | ||
145 | static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); | 172 | static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); |
146 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); | 173 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); |
147 | static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL); | 174 | static DEVICE_ATTR(manufacturer, S_IRUGO, show_manufacturer, NULL); |
175 | static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL); | ||
176 | static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL); | ||
148 | static DEVICE_ATTR(inquiry_cache, S_IRUGO, show_inquiry_cache, NULL); | 177 | static DEVICE_ATTR(inquiry_cache, S_IRUGO, show_inquiry_cache, NULL); |
149 | 178 | ||
150 | static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR, | 179 | static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR, |
@@ -155,10 +184,11 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR, | |||
155 | show_sniff_min_interval, store_sniff_min_interval); | 184 | show_sniff_min_interval, store_sniff_min_interval); |
156 | 185 | ||
157 | static struct device_attribute *bt_attrs[] = { | 186 | static struct device_attribute *bt_attrs[] = { |
158 | &dev_attr_name, | ||
159 | &dev_attr_type, | 187 | &dev_attr_type, |
160 | &dev_attr_address, | 188 | &dev_attr_address, |
161 | &dev_attr_flags, | 189 | &dev_attr_manufacturer, |
190 | &dev_attr_hci_version, | ||
191 | &dev_attr_hci_revision, | ||
162 | &dev_attr_inquiry_cache, | 192 | &dev_attr_inquiry_cache, |
163 | &dev_attr_idle_timeout, | 193 | &dev_attr_idle_timeout, |
164 | &dev_attr_sniff_max_interval, | 194 | &dev_attr_sniff_max_interval, |
@@ -166,6 +196,32 @@ static struct device_attribute *bt_attrs[] = { | |||
166 | NULL | 196 | NULL |
167 | }; | 197 | }; |
168 | 198 | ||
199 | static ssize_t show_conn_type(struct device *dev, struct device_attribute *attr, char *buf) | ||
200 | { | ||
201 | struct hci_conn *conn = dev_get_drvdata(dev); | ||
202 | return sprintf(buf, "%s\n", conn->type == ACL_LINK ? "ACL" : "SCO"); | ||
203 | } | ||
204 | |||
205 | static ssize_t show_conn_address(struct device *dev, struct device_attribute *attr, char *buf) | ||
206 | { | ||
207 | struct hci_conn *conn = dev_get_drvdata(dev); | ||
208 | bdaddr_t bdaddr; | ||
209 | baswap(&bdaddr, &conn->dst); | ||
210 | return sprintf(buf, "%s\n", batostr(&bdaddr)); | ||
211 | } | ||
212 | |||
213 | #define CONN_ATTR(_name,_mode,_show,_store) \ | ||
214 | struct device_attribute conn_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
215 | |||
216 | static CONN_ATTR(type, S_IRUGO, show_conn_type, NULL); | ||
217 | static CONN_ATTR(address, S_IRUGO, show_conn_address, NULL); | ||
218 | |||
219 | static struct device_attribute *conn_attrs[] = { | ||
220 | &conn_attr_type, | ||
221 | &conn_attr_address, | ||
222 | NULL | ||
223 | }; | ||
224 | |||
169 | struct class *bt_class = NULL; | 225 | struct class *bt_class = NULL; |
170 | EXPORT_SYMBOL_GPL(bt_class); | 226 | EXPORT_SYMBOL_GPL(bt_class); |
171 | 227 | ||
@@ -177,8 +233,57 @@ static struct platform_device *bt_platform; | |||
177 | 233 | ||
178 | static void bt_release(struct device *dev) | 234 | static void bt_release(struct device *dev) |
179 | { | 235 | { |
180 | struct hci_dev *hdev = dev_get_drvdata(dev); | 236 | void *data = dev_get_drvdata(dev); |
181 | kfree(hdev); | 237 | kfree(data); |
238 | } | ||
239 | |||
240 | static void add_conn(void *data) | ||
241 | { | ||
242 | struct hci_conn *conn = data; | ||
243 | int i; | ||
244 | |||
245 | device_register(&conn->dev); | ||
246 | |||
247 | for (i = 0; conn_attrs[i]; i++) | ||
248 | device_create_file(&conn->dev, conn_attrs[i]); | ||
249 | } | ||
250 | |||
251 | void hci_conn_add_sysfs(struct hci_conn *conn) | ||
252 | { | ||
253 | struct hci_dev *hdev = conn->hdev; | ||
254 | bdaddr_t *ba = &conn->dst; | ||
255 | |||
256 | BT_DBG("conn %p", conn); | ||
257 | |||
258 | conn->dev.parent = &hdev->dev; | ||
259 | conn->dev.release = bt_release; | ||
260 | |||
261 | snprintf(conn->dev.bus_id, BUS_ID_SIZE, | ||
262 | "%s%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X", | ||
263 | conn->type == ACL_LINK ? "acl" : "sco", | ||
264 | ba->b[5], ba->b[4], ba->b[3], | ||
265 | ba->b[2], ba->b[1], ba->b[0]); | ||
266 | |||
267 | dev_set_drvdata(&conn->dev, conn); | ||
268 | |||
269 | INIT_WORK(&conn->work, add_conn, (void *) conn); | ||
270 | |||
271 | schedule_work(&conn->work); | ||
272 | } | ||
273 | |||
274 | static void del_conn(void *data) | ||
275 | { | ||
276 | struct hci_conn *conn = data; | ||
277 | device_del(&conn->dev); | ||
278 | } | ||
279 | |||
280 | void hci_conn_del_sysfs(struct hci_conn *conn) | ||
281 | { | ||
282 | BT_DBG("conn %p", conn); | ||
283 | |||
284 | INIT_WORK(&conn->work, del_conn, (void *) conn); | ||
285 | |||
286 | schedule_work(&conn->work); | ||
182 | } | 287 | } |
183 | 288 | ||
184 | int hci_register_sysfs(struct hci_dev *hdev) | 289 | int hci_register_sysfs(struct hci_dev *hdev) |
@@ -214,11 +319,9 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
214 | 319 | ||
215 | void hci_unregister_sysfs(struct hci_dev *hdev) | 320 | void hci_unregister_sysfs(struct hci_dev *hdev) |
216 | { | 321 | { |
217 | struct device *dev = &hdev->dev; | ||
218 | |||
219 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); | 322 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); |
220 | 323 | ||
221 | device_del(dev); | 324 | device_del(&hdev->dev); |
222 | } | 325 | } |
223 | 326 | ||
224 | int __init bt_sysfs_init(void) | 327 | int __init bt_sysfs_init(void) |
@@ -245,7 +348,7 @@ int __init bt_sysfs_init(void) | |||
245 | return 0; | 348 | return 0; |
246 | } | 349 | } |
247 | 350 | ||
248 | void __exit bt_sysfs_cleanup(void) | 351 | void bt_sysfs_cleanup(void) |
249 | { | 352 | { |
250 | class_destroy(bt_class); | 353 | class_destroy(bt_class); |
251 | 354 | ||
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index c6e3a2c27c6e..03b5dadb4951 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/input.h> | 40 | #include <linux/input.h> |
41 | 41 | ||
42 | #include <net/bluetooth/bluetooth.h> | 42 | #include <net/bluetooth/bluetooth.h> |
43 | #include <net/bluetooth/hci_core.h> | ||
43 | #include <net/bluetooth/l2cap.h> | 44 | #include <net/bluetooth/l2cap.h> |
44 | 45 | ||
45 | #include "hidp.h" | 46 | #include "hidp.h" |
@@ -528,6 +529,26 @@ static int hidp_session(void *arg) | |||
528 | return 0; | 529 | return 0; |
529 | } | 530 | } |
530 | 531 | ||
532 | static struct device *hidp_get_device(struct hidp_session *session) | ||
533 | { | ||
534 | bdaddr_t *src = &bt_sk(session->ctrl_sock->sk)->src; | ||
535 | bdaddr_t *dst = &bt_sk(session->ctrl_sock->sk)->dst; | ||
536 | struct hci_dev *hdev; | ||
537 | struct hci_conn *conn; | ||
538 | |||
539 | hdev = hci_get_route(dst, src); | ||
540 | if (!hdev) | ||
541 | return NULL; | ||
542 | |||
543 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); | ||
544 | if (!conn) | ||
545 | return NULL; | ||
546 | |||
547 | hci_dev_put(hdev); | ||
548 | |||
549 | return &conn->dev; | ||
550 | } | ||
551 | |||
531 | static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) | 552 | static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) |
532 | { | 553 | { |
533 | struct input_dev *input = session->input; | 554 | struct input_dev *input = session->input; |
@@ -566,6 +587,8 @@ static inline void hidp_setup_input(struct hidp_session *session, struct hidp_co | |||
566 | input->relbit[0] |= BIT(REL_WHEEL); | 587 | input->relbit[0] |= BIT(REL_WHEEL); |
567 | } | 588 | } |
568 | 589 | ||
590 | input->cdev.dev = hidp_get_device(session); | ||
591 | |||
569 | input->event = hidp_input_event; | 592 | input->event = hidp_input_event; |
570 | 593 | ||
571 | input_register_device(input); | 594 | input_register_device(input); |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 332dd8f436ea..468df3b953f6 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -644,7 +644,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst | |||
644 | addr.l2_family = AF_BLUETOOTH; | 644 | addr.l2_family = AF_BLUETOOTH; |
645 | addr.l2_psm = htobs(RFCOMM_PSM); | 645 | addr.l2_psm = htobs(RFCOMM_PSM); |
646 | *err = sock->ops->connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK); | 646 | *err = sock->ops->connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK); |
647 | if (*err == 0 || *err == -EAGAIN) | 647 | if (*err == 0 || *err == -EINPROGRESS) |
648 | return s; | 648 | return s; |
649 | 649 | ||
650 | rfcomm_session_del(s); | 650 | rfcomm_session_del(s); |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index bd8d671a0ba6..26f322737db0 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/skbuff.h> | 38 | #include <linux/skbuff.h> |
39 | 39 | ||
40 | #include <net/bluetooth/bluetooth.h> | 40 | #include <net/bluetooth/bluetooth.h> |
41 | #include <net/bluetooth/hci_core.h> | ||
41 | #include <net/bluetooth/rfcomm.h> | 42 | #include <net/bluetooth/rfcomm.h> |
42 | 43 | ||
43 | #ifndef CONFIG_BT_RFCOMM_DEBUG | 44 | #ifndef CONFIG_BT_RFCOMM_DEBUG |
@@ -161,6 +162,24 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id) | |||
161 | return dev; | 162 | return dev; |
162 | } | 163 | } |
163 | 164 | ||
165 | static struct device *rfcomm_get_device(struct rfcomm_dev *dev) | ||
166 | { | ||
167 | struct hci_dev *hdev; | ||
168 | struct hci_conn *conn; | ||
169 | |||
170 | hdev = hci_get_route(&dev->dst, &dev->src); | ||
171 | if (!hdev) | ||
172 | return NULL; | ||
173 | |||
174 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); | ||
175 | if (!conn) | ||
176 | return NULL; | ||
177 | |||
178 | hci_dev_put(hdev); | ||
179 | |||
180 | return &conn->dev; | ||
181 | } | ||
182 | |||
164 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | 183 | static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) |
165 | { | 184 | { |
166 | struct rfcomm_dev *dev; | 185 | struct rfcomm_dev *dev; |
@@ -244,7 +263,7 @@ out: | |||
244 | return err; | 263 | return err; |
245 | } | 264 | } |
246 | 265 | ||
247 | tty_register_device(rfcomm_tty_driver, dev->id, NULL); | 266 | tty_register_device(rfcomm_tty_driver, dev->id, rfcomm_get_device(dev)); |
248 | 267 | ||
249 | return dev->id; | 268 | return dev->id; |
250 | } | 269 | } |
diff --git a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c index d19fc4b328dc..0aa7b9910a86 100644 --- a/net/bridge/netfilter/ebt_arpreply.c +++ b/net/bridge/netfilter/ebt_arpreply.c | |||
@@ -20,7 +20,7 @@ static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr, | |||
20 | const void *data, unsigned int datalen) | 20 | const void *data, unsigned int datalen) |
21 | { | 21 | { |
22 | struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data; | 22 | struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data; |
23 | u32 _sip, *siptr, _dip, *diptr; | 23 | __be32 _sip, *siptr, _dip, *diptr; |
24 | struct arphdr _ah, *ap; | 24 | struct arphdr _ah, *ap; |
25 | unsigned char _sha[ETH_ALEN], *shp; | 25 | unsigned char _sha[ETH_ALEN], *shp; |
26 | struct sk_buff *skb = *pskb; | 26 | struct sk_buff *skb = *pskb; |
diff --git a/net/core/dev.c b/net/core/dev.c index 14de297d024d..4d891beab138 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1480,14 +1480,16 @@ gso: | |||
1480 | if (q->enqueue) { | 1480 | if (q->enqueue) { |
1481 | /* Grab device queue */ | 1481 | /* Grab device queue */ |
1482 | spin_lock(&dev->queue_lock); | 1482 | spin_lock(&dev->queue_lock); |
1483 | q = dev->qdisc; | ||
1484 | if (q->enqueue) { | ||
1485 | rc = q->enqueue(skb, q); | ||
1486 | qdisc_run(dev); | ||
1487 | spin_unlock(&dev->queue_lock); | ||
1483 | 1488 | ||
1484 | rc = q->enqueue(skb, q); | 1489 | rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc; |
1485 | 1490 | goto out; | |
1486 | qdisc_run(dev); | 1491 | } |
1487 | |||
1488 | spin_unlock(&dev->queue_lock); | 1492 | spin_unlock(&dev->queue_lock); |
1489 | rc = rc == NET_XMIT_BYPASS ? NET_XMIT_SUCCESS : rc; | ||
1490 | goto out; | ||
1491 | } | 1493 | } |
1492 | 1494 | ||
1493 | /* The device has no queue. Common case for software devices: | 1495 | /* The device has no queue. Common case for software devices: |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index e0ca04f38cef..87dc556fd9d6 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -806,13 +806,6 @@ int dev_ethtool(struct ifreq *ifr) | |||
806 | int rc; | 806 | int rc; |
807 | unsigned long old_features; | 807 | unsigned long old_features; |
808 | 808 | ||
809 | /* | ||
810 | * XXX: This can be pushed down into the ethtool_* handlers that | ||
811 | * need it. Keep existing behaviour for the moment. | ||
812 | */ | ||
813 | if (!capable(CAP_NET_ADMIN)) | ||
814 | return -EPERM; | ||
815 | |||
816 | if (!dev || !netif_device_present(dev)) | 809 | if (!dev || !netif_device_present(dev)) |
817 | return -ENODEV; | 810 | return -ENODEV; |
818 | 811 | ||
@@ -822,6 +815,27 @@ int dev_ethtool(struct ifreq *ifr) | |||
822 | if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) | 815 | if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd))) |
823 | return -EFAULT; | 816 | return -EFAULT; |
824 | 817 | ||
818 | /* Allow some commands to be done by anyone */ | ||
819 | switch(ethcmd) { | ||
820 | case ETHTOOL_GDRVINFO: | ||
821 | case ETHTOOL_GMSGLVL: | ||
822 | case ETHTOOL_GCOALESCE: | ||
823 | case ETHTOOL_GRINGPARAM: | ||
824 | case ETHTOOL_GPAUSEPARAM: | ||
825 | case ETHTOOL_GRXCSUM: | ||
826 | case ETHTOOL_GTXCSUM: | ||
827 | case ETHTOOL_GSG: | ||
828 | case ETHTOOL_GSTRINGS: | ||
829 | case ETHTOOL_GTSO: | ||
830 | case ETHTOOL_GPERMADDR: | ||
831 | case ETHTOOL_GUFO: | ||
832 | case ETHTOOL_GGSO: | ||
833 | break; | ||
834 | default: | ||
835 | if (!capable(CAP_NET_ADMIN)) | ||
836 | return -EPERM; | ||
837 | } | ||
838 | |||
825 | if(dev->ethtool_ops->begin) | 839 | if(dev->ethtool_ops->begin) |
826 | if ((rc = dev->ethtool_ops->begin(dev)) < 0) | 840 | if ((rc = dev->ethtool_ops->begin(dev)) < 0) |
827 | return rc; | 841 | return rc; |
@@ -947,6 +961,10 @@ int dev_ethtool(struct ifreq *ifr) | |||
947 | return rc; | 961 | return rc; |
948 | 962 | ||
949 | ioctl: | 963 | ioctl: |
964 | /* Keep existing behaviour for the moment. */ | ||
965 | if (!capable(CAP_NET_ADMIN)) | ||
966 | return -EPERM; | ||
967 | |||
950 | if (dev->do_ioctl) | 968 | if (dev->do_ioctl) |
951 | return dev->do_ioctl(dev, ifr, SIOCETHTOOL); | 969 | return dev->do_ioctl(dev, ifr, SIOCETHTOOL); |
952 | return -EOPNOTSUPP; | 970 | return -EOPNOTSUPP; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index b6c69e1463e8..8ce8c471d868 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1079,7 +1079,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl, | |||
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst, | 1081 | static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst, |
1082 | u16 protocol) | 1082 | __be16 protocol) |
1083 | { | 1083 | { |
1084 | struct hh_cache *hh; | 1084 | struct hh_cache *hh; |
1085 | struct net_device *dev = dst->dev; | 1085 | struct net_device *dev = dst->dev; |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 72145d4a2600..dd023fd28304 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -109,6 +109,8 @@ | |||
109 | * | 109 | * |
110 | * MPLS support by Steven Whitehouse <steve@chygwyn.com> | 110 | * MPLS support by Steven Whitehouse <steve@chygwyn.com> |
111 | * | 111 | * |
112 | * 802.1Q/Q-in-Q support by Francesco Fondelli (FF) <francesco.fondelli@gmail.com> | ||
113 | * | ||
112 | */ | 114 | */ |
113 | #include <linux/sys.h> | 115 | #include <linux/sys.h> |
114 | #include <linux/types.h> | 116 | #include <linux/types.h> |
@@ -137,6 +139,7 @@ | |||
137 | #include <linux/inetdevice.h> | 139 | #include <linux/inetdevice.h> |
138 | #include <linux/rtnetlink.h> | 140 | #include <linux/rtnetlink.h> |
139 | #include <linux/if_arp.h> | 141 | #include <linux/if_arp.h> |
142 | #include <linux/if_vlan.h> | ||
140 | #include <linux/in.h> | 143 | #include <linux/in.h> |
141 | #include <linux/ip.h> | 144 | #include <linux/ip.h> |
142 | #include <linux/ipv6.h> | 145 | #include <linux/ipv6.h> |
@@ -157,7 +160,7 @@ | |||
157 | #include <asm/div64.h> /* do_div */ | 160 | #include <asm/div64.h> /* do_div */ |
158 | #include <asm/timex.h> | 161 | #include <asm/timex.h> |
159 | 162 | ||
160 | #define VERSION "pktgen v2.67: Packet Generator for packet performance testing.\n" | 163 | #define VERSION "pktgen v2.68: Packet Generator for packet performance testing.\n" |
161 | 164 | ||
162 | /* #define PG_DEBUG(a) a */ | 165 | /* #define PG_DEBUG(a) a */ |
163 | #define PG_DEBUG(a) | 166 | #define PG_DEBUG(a) |
@@ -178,6 +181,8 @@ | |||
178 | #define F_TXSIZE_RND (1<<6) /* Transmit size is random */ | 181 | #define F_TXSIZE_RND (1<<6) /* Transmit size is random */ |
179 | #define F_IPV6 (1<<7) /* Interface in IPV6 Mode */ | 182 | #define F_IPV6 (1<<7) /* Interface in IPV6 Mode */ |
180 | #define F_MPLS_RND (1<<8) /* Random MPLS labels */ | 183 | #define F_MPLS_RND (1<<8) /* Random MPLS labels */ |
184 | #define F_VID_RND (1<<9) /* Random VLAN ID */ | ||
185 | #define F_SVID_RND (1<<10) /* Random SVLAN ID */ | ||
181 | 186 | ||
182 | /* Thread control flag bits */ | 187 | /* Thread control flag bits */ |
183 | #define T_TERMINATE (1<<0) | 188 | #define T_TERMINATE (1<<0) |
@@ -198,6 +203,9 @@ static struct proc_dir_entry *pg_proc_dir = NULL; | |||
198 | 203 | ||
199 | #define MAX_CFLOWS 65536 | 204 | #define MAX_CFLOWS 65536 |
200 | 205 | ||
206 | #define VLAN_TAG_SIZE(x) ((x)->vlan_id == 0xffff ? 0 : 4) | ||
207 | #define SVLAN_TAG_SIZE(x) ((x)->svlan_id == 0xffff ? 0 : 4) | ||
208 | |||
201 | struct flow_state { | 209 | struct flow_state { |
202 | __u32 cur_daddr; | 210 | __u32 cur_daddr; |
203 | int count; | 211 | int count; |
@@ -284,10 +292,23 @@ struct pktgen_dev { | |||
284 | __u16 udp_dst_min; /* inclusive, dest UDP port */ | 292 | __u16 udp_dst_min; /* inclusive, dest UDP port */ |
285 | __u16 udp_dst_max; /* exclusive, dest UDP port */ | 293 | __u16 udp_dst_max; /* exclusive, dest UDP port */ |
286 | 294 | ||
295 | /* DSCP + ECN */ | ||
296 | __u8 tos; /* six most significant bits of (former) IPv4 TOS are for dscp codepoint */ | ||
297 | __u8 traffic_class; /* ditto for the (former) Traffic Class in IPv6 (see RFC 3260, sec. 4) */ | ||
298 | |||
287 | /* MPLS */ | 299 | /* MPLS */ |
288 | unsigned nr_labels; /* Depth of stack, 0 = no MPLS */ | 300 | unsigned nr_labels; /* Depth of stack, 0 = no MPLS */ |
289 | __be32 labels[MAX_MPLS_LABELS]; | 301 | __be32 labels[MAX_MPLS_LABELS]; |
290 | 302 | ||
303 | /* VLAN/SVLAN (802.1Q/Q-in-Q) */ | ||
304 | __u8 vlan_p; | ||
305 | __u8 vlan_cfi; | ||
306 | __u16 vlan_id; /* 0xffff means no vlan tag */ | ||
307 | |||
308 | __u8 svlan_p; | ||
309 | __u8 svlan_cfi; | ||
310 | __u16 svlan_id; /* 0xffff means no svlan tag */ | ||
311 | |||
291 | __u32 src_mac_count; /* How many MACs to iterate through */ | 312 | __u32 src_mac_count; /* How many MACs to iterate through */ |
292 | __u32 dst_mac_count; /* How many MACs to iterate through */ | 313 | __u32 dst_mac_count; /* How many MACs to iterate through */ |
293 | 314 | ||
@@ -644,6 +665,24 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
644 | i == pkt_dev->nr_labels-1 ? "\n" : ", "); | 665 | i == pkt_dev->nr_labels-1 ? "\n" : ", "); |
645 | } | 666 | } |
646 | 667 | ||
668 | if (pkt_dev->vlan_id != 0xffff) { | ||
669 | seq_printf(seq, " vlan_id: %u vlan_p: %u vlan_cfi: %u\n", | ||
670 | pkt_dev->vlan_id, pkt_dev->vlan_p, pkt_dev->vlan_cfi); | ||
671 | } | ||
672 | |||
673 | if (pkt_dev->svlan_id != 0xffff) { | ||
674 | seq_printf(seq, " svlan_id: %u vlan_p: %u vlan_cfi: %u\n", | ||
675 | pkt_dev->svlan_id, pkt_dev->svlan_p, pkt_dev->svlan_cfi); | ||
676 | } | ||
677 | |||
678 | if (pkt_dev->tos) { | ||
679 | seq_printf(seq, " tos: 0x%02x\n", pkt_dev->tos); | ||
680 | } | ||
681 | |||
682 | if (pkt_dev->traffic_class) { | ||
683 | seq_printf(seq, " traffic_class: 0x%02x\n", pkt_dev->traffic_class); | ||
684 | } | ||
685 | |||
647 | seq_printf(seq, " Flags: "); | 686 | seq_printf(seq, " Flags: "); |
648 | 687 | ||
649 | if (pkt_dev->flags & F_IPV6) | 688 | if (pkt_dev->flags & F_IPV6) |
@@ -673,6 +712,12 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
673 | if (pkt_dev->flags & F_MACDST_RND) | 712 | if (pkt_dev->flags & F_MACDST_RND) |
674 | seq_printf(seq, "MACDST_RND "); | 713 | seq_printf(seq, "MACDST_RND "); |
675 | 714 | ||
715 | if (pkt_dev->flags & F_VID_RND) | ||
716 | seq_printf(seq, "VID_RND "); | ||
717 | |||
718 | if (pkt_dev->flags & F_SVID_RND) | ||
719 | seq_printf(seq, "SVID_RND "); | ||
720 | |||
676 | seq_puts(seq, "\n"); | 721 | seq_puts(seq, "\n"); |
677 | 722 | ||
678 | sa = pkt_dev->started_at; | 723 | sa = pkt_dev->started_at; |
@@ -715,12 +760,12 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
715 | } | 760 | } |
716 | 761 | ||
717 | 762 | ||
718 | static int hex32_arg(const char __user *user_buffer, __u32 *num) | 763 | static int hex32_arg(const char __user *user_buffer, unsigned long maxlen, __u32 *num) |
719 | { | 764 | { |
720 | int i = 0; | 765 | int i = 0; |
721 | *num = 0; | 766 | *num = 0; |
722 | 767 | ||
723 | for(; i < 8; i++) { | 768 | for(; i < maxlen; i++) { |
724 | char c; | 769 | char c; |
725 | *num <<= 4; | 770 | *num <<= 4; |
726 | if (get_user(c, &user_buffer[i])) | 771 | if (get_user(c, &user_buffer[i])) |
@@ -815,7 +860,7 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev) | |||
815 | pkt_dev->nr_labels = 0; | 860 | pkt_dev->nr_labels = 0; |
816 | do { | 861 | do { |
817 | __u32 tmp; | 862 | __u32 tmp; |
818 | len = hex32_arg(&buffer[i], &tmp); | 863 | len = hex32_arg(&buffer[i], 8, &tmp); |
819 | if (len <= 0) | 864 | if (len <= 0) |
820 | return len; | 865 | return len; |
821 | pkt_dev->labels[n] = htonl(tmp); | 866 | pkt_dev->labels[n] = htonl(tmp); |
@@ -1140,11 +1185,27 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1140 | else if (strcmp(f, "!MPLS_RND") == 0) | 1185 | else if (strcmp(f, "!MPLS_RND") == 0) |
1141 | pkt_dev->flags &= ~F_MPLS_RND; | 1186 | pkt_dev->flags &= ~F_MPLS_RND; |
1142 | 1187 | ||
1188 | else if (strcmp(f, "VID_RND") == 0) | ||
1189 | pkt_dev->flags |= F_VID_RND; | ||
1190 | |||
1191 | else if (strcmp(f, "!VID_RND") == 0) | ||
1192 | pkt_dev->flags &= ~F_VID_RND; | ||
1193 | |||
1194 | else if (strcmp(f, "SVID_RND") == 0) | ||
1195 | pkt_dev->flags |= F_SVID_RND; | ||
1196 | |||
1197 | else if (strcmp(f, "!SVID_RND") == 0) | ||
1198 | pkt_dev->flags &= ~F_SVID_RND; | ||
1199 | |||
1200 | else if (strcmp(f, "!IPV6") == 0) | ||
1201 | pkt_dev->flags &= ~F_IPV6; | ||
1202 | |||
1143 | else { | 1203 | else { |
1144 | sprintf(pg_result, | 1204 | sprintf(pg_result, |
1145 | "Flag -:%s:- unknown\nAvailable flags, (prepend ! to un-set flag):\n%s", | 1205 | "Flag -:%s:- unknown\nAvailable flags, (prepend ! to un-set flag):\n%s", |
1146 | f, | 1206 | f, |
1147 | "IPSRC_RND, IPDST_RND, TXSIZE_RND, UDPSRC_RND, UDPDST_RND, MACSRC_RND, MACDST_RND\n"); | 1207 | "IPSRC_RND, IPDST_RND, UDPSRC_RND, UDPDST_RND, " |
1208 | "MACSRC_RND, MACDST_RND, TXSIZE_RND, IPV6, MPLS_RND, VID_RND, SVID_RND\n"); | ||
1148 | return count; | 1209 | return count; |
1149 | } | 1210 | } |
1150 | sprintf(pg_result, "OK: flags=0x%x", pkt_dev->flags); | 1211 | sprintf(pg_result, "OK: flags=0x%x", pkt_dev->flags); |
@@ -1445,6 +1506,160 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1445 | offset += sprintf(pg_result + offset, | 1506 | offset += sprintf(pg_result + offset, |
1446 | "%08x%s", ntohl(pkt_dev->labels[n]), | 1507 | "%08x%s", ntohl(pkt_dev->labels[n]), |
1447 | n == pkt_dev->nr_labels-1 ? "" : ","); | 1508 | n == pkt_dev->nr_labels-1 ? "" : ","); |
1509 | |||
1510 | if (pkt_dev->nr_labels && pkt_dev->vlan_id != 0xffff) { | ||
1511 | pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */ | ||
1512 | pkt_dev->svlan_id = 0xffff; | ||
1513 | |||
1514 | if (debug) | ||
1515 | printk("pktgen: VLAN/SVLAN auto turned off\n"); | ||
1516 | } | ||
1517 | return count; | ||
1518 | } | ||
1519 | |||
1520 | if (!strcmp(name, "vlan_id")) { | ||
1521 | len = num_arg(&user_buffer[i], 4, &value); | ||
1522 | if (len < 0) { | ||
1523 | return len; | ||
1524 | } | ||
1525 | i += len; | ||
1526 | if (value <= 4095) { | ||
1527 | pkt_dev->vlan_id = value; /* turn on VLAN */ | ||
1528 | |||
1529 | if (debug) | ||
1530 | printk("pktgen: VLAN turned on\n"); | ||
1531 | |||
1532 | if (debug && pkt_dev->nr_labels) | ||
1533 | printk("pktgen: MPLS auto turned off\n"); | ||
1534 | |||
1535 | pkt_dev->nr_labels = 0; /* turn off MPLS */ | ||
1536 | sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id); | ||
1537 | } else { | ||
1538 | pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */ | ||
1539 | pkt_dev->svlan_id = 0xffff; | ||
1540 | |||
1541 | if (debug) | ||
1542 | printk("pktgen: VLAN/SVLAN turned off\n"); | ||
1543 | } | ||
1544 | return count; | ||
1545 | } | ||
1546 | |||
1547 | if (!strcmp(name, "vlan_p")) { | ||
1548 | len = num_arg(&user_buffer[i], 1, &value); | ||
1549 | if (len < 0) { | ||
1550 | return len; | ||
1551 | } | ||
1552 | i += len; | ||
1553 | if ((value <= 7) && (pkt_dev->vlan_id != 0xffff)) { | ||
1554 | pkt_dev->vlan_p = value; | ||
1555 | sprintf(pg_result, "OK: vlan_p=%u", pkt_dev->vlan_p); | ||
1556 | } else { | ||
1557 | sprintf(pg_result, "ERROR: vlan_p must be 0-7"); | ||
1558 | } | ||
1559 | return count; | ||
1560 | } | ||
1561 | |||
1562 | if (!strcmp(name, "vlan_cfi")) { | ||
1563 | len = num_arg(&user_buffer[i], 1, &value); | ||
1564 | if (len < 0) { | ||
1565 | return len; | ||
1566 | } | ||
1567 | i += len; | ||
1568 | if ((value <= 1) && (pkt_dev->vlan_id != 0xffff)) { | ||
1569 | pkt_dev->vlan_cfi = value; | ||
1570 | sprintf(pg_result, "OK: vlan_cfi=%u", pkt_dev->vlan_cfi); | ||
1571 | } else { | ||
1572 | sprintf(pg_result, "ERROR: vlan_cfi must be 0-1"); | ||
1573 | } | ||
1574 | return count; | ||
1575 | } | ||
1576 | |||
1577 | if (!strcmp(name, "svlan_id")) { | ||
1578 | len = num_arg(&user_buffer[i], 4, &value); | ||
1579 | if (len < 0) { | ||
1580 | return len; | ||
1581 | } | ||
1582 | i += len; | ||
1583 | if ((value <= 4095) && ((pkt_dev->vlan_id != 0xffff))) { | ||
1584 | pkt_dev->svlan_id = value; /* turn on SVLAN */ | ||
1585 | |||
1586 | if (debug) | ||
1587 | printk("pktgen: SVLAN turned on\n"); | ||
1588 | |||
1589 | if (debug && pkt_dev->nr_labels) | ||
1590 | printk("pktgen: MPLS auto turned off\n"); | ||
1591 | |||
1592 | pkt_dev->nr_labels = 0; /* turn off MPLS */ | ||
1593 | sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id); | ||
1594 | } else { | ||
1595 | pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */ | ||
1596 | pkt_dev->svlan_id = 0xffff; | ||
1597 | |||
1598 | if (debug) | ||
1599 | printk("pktgen: VLAN/SVLAN turned off\n"); | ||
1600 | } | ||
1601 | return count; | ||
1602 | } | ||
1603 | |||
1604 | if (!strcmp(name, "svlan_p")) { | ||
1605 | len = num_arg(&user_buffer[i], 1, &value); | ||
1606 | if (len < 0) { | ||
1607 | return len; | ||
1608 | } | ||
1609 | i += len; | ||
1610 | if ((value <= 7) && (pkt_dev->svlan_id != 0xffff)) { | ||
1611 | pkt_dev->svlan_p = value; | ||
1612 | sprintf(pg_result, "OK: svlan_p=%u", pkt_dev->svlan_p); | ||
1613 | } else { | ||
1614 | sprintf(pg_result, "ERROR: svlan_p must be 0-7"); | ||
1615 | } | ||
1616 | return count; | ||
1617 | } | ||
1618 | |||
1619 | if (!strcmp(name, "svlan_cfi")) { | ||
1620 | len = num_arg(&user_buffer[i], 1, &value); | ||
1621 | if (len < 0) { | ||
1622 | return len; | ||
1623 | } | ||
1624 | i += len; | ||
1625 | if ((value <= 1) && (pkt_dev->svlan_id != 0xffff)) { | ||
1626 | pkt_dev->svlan_cfi = value; | ||
1627 | sprintf(pg_result, "OK: svlan_cfi=%u", pkt_dev->svlan_cfi); | ||
1628 | } else { | ||
1629 | sprintf(pg_result, "ERROR: svlan_cfi must be 0-1"); | ||
1630 | } | ||
1631 | return count; | ||
1632 | } | ||
1633 | |||
1634 | if (!strcmp(name, "tos")) { | ||
1635 | __u32 tmp_value = 0; | ||
1636 | len = hex32_arg(&user_buffer[i], 2, &tmp_value); | ||
1637 | if (len < 0) { | ||
1638 | return len; | ||
1639 | } | ||
1640 | i += len; | ||
1641 | if (len == 2) { | ||
1642 | pkt_dev->tos = tmp_value; | ||
1643 | sprintf(pg_result, "OK: tos=0x%02x", pkt_dev->tos); | ||
1644 | } else { | ||
1645 | sprintf(pg_result, "ERROR: tos must be 00-ff"); | ||
1646 | } | ||
1647 | return count; | ||
1648 | } | ||
1649 | |||
1650 | if (!strcmp(name, "traffic_class")) { | ||
1651 | __u32 tmp_value = 0; | ||
1652 | len = hex32_arg(&user_buffer[i], 2, &tmp_value); | ||
1653 | if (len < 0) { | ||
1654 | return len; | ||
1655 | } | ||
1656 | i += len; | ||
1657 | if (len == 2) { | ||
1658 | pkt_dev->traffic_class = tmp_value; | ||
1659 | sprintf(pg_result, "OK: traffic_class=0x%02x", pkt_dev->traffic_class); | ||
1660 | } else { | ||
1661 | sprintf(pg_result, "ERROR: traffic_class must be 00-ff"); | ||
1662 | } | ||
1448 | return count; | 1663 | return count; |
1449 | } | 1664 | } |
1450 | 1665 | ||
@@ -1949,6 +2164,14 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev) | |||
1949 | htonl(0x000fffff)); | 2164 | htonl(0x000fffff)); |
1950 | } | 2165 | } |
1951 | 2166 | ||
2167 | if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) { | ||
2168 | pkt_dev->vlan_id = pktgen_random() % 4096; | ||
2169 | } | ||
2170 | |||
2171 | if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) { | ||
2172 | pkt_dev->svlan_id = pktgen_random() % 4096; | ||
2173 | } | ||
2174 | |||
1952 | if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) { | 2175 | if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) { |
1953 | if (pkt_dev->flags & F_UDPSRC_RND) | 2176 | if (pkt_dev->flags & F_UDPSRC_RND) |
1954 | pkt_dev->cur_udp_src = | 2177 | pkt_dev->cur_udp_src = |
@@ -2092,10 +2315,18 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2092 | struct pktgen_hdr *pgh = NULL; | 2315 | struct pktgen_hdr *pgh = NULL; |
2093 | __be16 protocol = __constant_htons(ETH_P_IP); | 2316 | __be16 protocol = __constant_htons(ETH_P_IP); |
2094 | __be32 *mpls; | 2317 | __be32 *mpls; |
2318 | __be16 *vlan_tci = NULL; /* Encapsulates priority and VLAN ID */ | ||
2319 | __be16 *vlan_encapsulated_proto = NULL; /* packet type ID field (or len) for VLAN tag */ | ||
2320 | __be16 *svlan_tci = NULL; /* Encapsulates priority and SVLAN ID */ | ||
2321 | __be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */ | ||
2322 | |||
2095 | 2323 | ||
2096 | if (pkt_dev->nr_labels) | 2324 | if (pkt_dev->nr_labels) |
2097 | protocol = __constant_htons(ETH_P_MPLS_UC); | 2325 | protocol = __constant_htons(ETH_P_MPLS_UC); |
2098 | 2326 | ||
2327 | if (pkt_dev->vlan_id != 0xffff) | ||
2328 | protocol = __constant_htons(ETH_P_8021Q); | ||
2329 | |||
2099 | /* Update any of the values, used when we're incrementing various | 2330 | /* Update any of the values, used when we're incrementing various |
2100 | * fields. | 2331 | * fields. |
2101 | */ | 2332 | */ |
@@ -2103,7 +2334,9 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2103 | 2334 | ||
2104 | datalen = (odev->hard_header_len + 16) & ~0xf; | 2335 | datalen = (odev->hard_header_len + 16) & ~0xf; |
2105 | skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen + | 2336 | skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + datalen + |
2106 | pkt_dev->nr_labels*sizeof(u32), GFP_ATOMIC); | 2337 | pkt_dev->nr_labels*sizeof(u32) + |
2338 | VLAN_TAG_SIZE(pkt_dev) + SVLAN_TAG_SIZE(pkt_dev), | ||
2339 | GFP_ATOMIC); | ||
2107 | if (!skb) { | 2340 | if (!skb) { |
2108 | sprintf(pkt_dev->result, "No memory"); | 2341 | sprintf(pkt_dev->result, "No memory"); |
2109 | return NULL; | 2342 | return NULL; |
@@ -2116,6 +2349,24 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2116 | mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); | 2349 | mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); |
2117 | if (pkt_dev->nr_labels) | 2350 | if (pkt_dev->nr_labels) |
2118 | mpls_push(mpls, pkt_dev); | 2351 | mpls_push(mpls, pkt_dev); |
2352 | |||
2353 | if (pkt_dev->vlan_id != 0xffff) { | ||
2354 | if(pkt_dev->svlan_id != 0xffff) { | ||
2355 | svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2356 | *svlan_tci = htons(pkt_dev->svlan_id); | ||
2357 | *svlan_tci |= pkt_dev->svlan_p << 5; | ||
2358 | *svlan_tci |= pkt_dev->svlan_cfi << 4; | ||
2359 | svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2360 | *svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q); | ||
2361 | } | ||
2362 | vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2363 | *vlan_tci = htons(pkt_dev->vlan_id); | ||
2364 | *vlan_tci |= pkt_dev->vlan_p << 5; | ||
2365 | *vlan_tci |= pkt_dev->vlan_cfi << 4; | ||
2366 | vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2367 | *vlan_encapsulated_proto = __constant_htons(ETH_P_IP); | ||
2368 | } | ||
2369 | |||
2119 | iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr)); | 2370 | iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr)); |
2120 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); | 2371 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); |
2121 | 2372 | ||
@@ -2124,7 +2375,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2124 | 2375 | ||
2125 | /* Eth + IPh + UDPh + mpls */ | 2376 | /* Eth + IPh + UDPh + mpls */ |
2126 | datalen = pkt_dev->cur_pkt_size - 14 - 20 - 8 - | 2377 | datalen = pkt_dev->cur_pkt_size - 14 - 20 - 8 - |
2127 | pkt_dev->nr_labels*sizeof(u32); | 2378 | pkt_dev->nr_labels*sizeof(u32) - VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev); |
2128 | if (datalen < sizeof(struct pktgen_hdr)) | 2379 | if (datalen < sizeof(struct pktgen_hdr)) |
2129 | datalen = sizeof(struct pktgen_hdr); | 2380 | datalen = sizeof(struct pktgen_hdr); |
2130 | 2381 | ||
@@ -2136,7 +2387,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2136 | iph->ihl = 5; | 2387 | iph->ihl = 5; |
2137 | iph->version = 4; | 2388 | iph->version = 4; |
2138 | iph->ttl = 32; | 2389 | iph->ttl = 32; |
2139 | iph->tos = 0; | 2390 | iph->tos = pkt_dev->tos; |
2140 | iph->protocol = IPPROTO_UDP; /* UDP */ | 2391 | iph->protocol = IPPROTO_UDP; /* UDP */ |
2141 | iph->saddr = pkt_dev->cur_saddr; | 2392 | iph->saddr = pkt_dev->cur_saddr; |
2142 | iph->daddr = pkt_dev->cur_daddr; | 2393 | iph->daddr = pkt_dev->cur_daddr; |
@@ -2146,7 +2397,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2146 | iph->check = 0; | 2397 | iph->check = 0; |
2147 | iph->check = ip_fast_csum((void *)iph, iph->ihl); | 2398 | iph->check = ip_fast_csum((void *)iph, iph->ihl); |
2148 | skb->protocol = protocol; | 2399 | skb->protocol = protocol; |
2149 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32); | 2400 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32) - |
2401 | VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev); | ||
2150 | skb->dev = odev; | 2402 | skb->dev = odev; |
2151 | skb->pkt_type = PACKET_HOST; | 2403 | skb->pkt_type = PACKET_HOST; |
2152 | skb->nh.iph = iph; | 2404 | skb->nh.iph = iph; |
@@ -2218,7 +2470,6 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2218 | pgh->tv_sec = htonl(timestamp.tv_sec); | 2470 | pgh->tv_sec = htonl(timestamp.tv_sec); |
2219 | pgh->tv_usec = htonl(timestamp.tv_usec); | 2471 | pgh->tv_usec = htonl(timestamp.tv_usec); |
2220 | } | 2472 | } |
2221 | pkt_dev->seq_num++; | ||
2222 | 2473 | ||
2223 | return skb; | 2474 | return skb; |
2224 | } | 2475 | } |
@@ -2402,17 +2653,26 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2402 | struct pktgen_hdr *pgh = NULL; | 2653 | struct pktgen_hdr *pgh = NULL; |
2403 | __be16 protocol = __constant_htons(ETH_P_IPV6); | 2654 | __be16 protocol = __constant_htons(ETH_P_IPV6); |
2404 | __be32 *mpls; | 2655 | __be32 *mpls; |
2656 | __be16 *vlan_tci = NULL; /* Encapsulates priority and VLAN ID */ | ||
2657 | __be16 *vlan_encapsulated_proto = NULL; /* packet type ID field (or len) for VLAN tag */ | ||
2658 | __be16 *svlan_tci = NULL; /* Encapsulates priority and SVLAN ID */ | ||
2659 | __be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */ | ||
2405 | 2660 | ||
2406 | if (pkt_dev->nr_labels) | 2661 | if (pkt_dev->nr_labels) |
2407 | protocol = __constant_htons(ETH_P_MPLS_UC); | 2662 | protocol = __constant_htons(ETH_P_MPLS_UC); |
2408 | 2663 | ||
2664 | if (pkt_dev->vlan_id != 0xffff) | ||
2665 | protocol = __constant_htons(ETH_P_8021Q); | ||
2666 | |||
2409 | /* Update any of the values, used when we're incrementing various | 2667 | /* Update any of the values, used when we're incrementing various |
2410 | * fields. | 2668 | * fields. |
2411 | */ | 2669 | */ |
2412 | mod_cur_headers(pkt_dev); | 2670 | mod_cur_headers(pkt_dev); |
2413 | 2671 | ||
2414 | skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16 + | 2672 | skb = alloc_skb(pkt_dev->cur_pkt_size + 64 + 16 + |
2415 | pkt_dev->nr_labels*sizeof(u32), GFP_ATOMIC); | 2673 | pkt_dev->nr_labels*sizeof(u32) + |
2674 | VLAN_TAG_SIZE(pkt_dev) + SVLAN_TAG_SIZE(pkt_dev), | ||
2675 | GFP_ATOMIC); | ||
2416 | if (!skb) { | 2676 | if (!skb) { |
2417 | sprintf(pkt_dev->result, "No memory"); | 2677 | sprintf(pkt_dev->result, "No memory"); |
2418 | return NULL; | 2678 | return NULL; |
@@ -2425,16 +2685,34 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2425 | mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); | 2685 | mpls = (__be32 *)skb_put(skb, pkt_dev->nr_labels*sizeof(__u32)); |
2426 | if (pkt_dev->nr_labels) | 2686 | if (pkt_dev->nr_labels) |
2427 | mpls_push(mpls, pkt_dev); | 2687 | mpls_push(mpls, pkt_dev); |
2688 | |||
2689 | if (pkt_dev->vlan_id != 0xffff) { | ||
2690 | if(pkt_dev->svlan_id != 0xffff) { | ||
2691 | svlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2692 | *svlan_tci = htons(pkt_dev->svlan_id); | ||
2693 | *svlan_tci |= pkt_dev->svlan_p << 5; | ||
2694 | *svlan_tci |= pkt_dev->svlan_cfi << 4; | ||
2695 | svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2696 | *svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q); | ||
2697 | } | ||
2698 | vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2699 | *vlan_tci = htons(pkt_dev->vlan_id); | ||
2700 | *vlan_tci |= pkt_dev->vlan_p << 5; | ||
2701 | *vlan_tci |= pkt_dev->vlan_cfi << 4; | ||
2702 | vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16)); | ||
2703 | *vlan_encapsulated_proto = __constant_htons(ETH_P_IPV6); | ||
2704 | } | ||
2705 | |||
2428 | iph = (struct ipv6hdr *)skb_put(skb, sizeof(struct ipv6hdr)); | 2706 | iph = (struct ipv6hdr *)skb_put(skb, sizeof(struct ipv6hdr)); |
2429 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); | 2707 | udph = (struct udphdr *)skb_put(skb, sizeof(struct udphdr)); |
2430 | 2708 | ||
2431 | memcpy(eth, pkt_dev->hh, 12); | 2709 | memcpy(eth, pkt_dev->hh, 12); |
2432 | *(u16 *) & eth[12] = __constant_htons(ETH_P_IPV6); | 2710 | *(u16 *) & eth[12] = protocol; |
2433 | 2711 | ||
2434 | /* Eth + IPh + UDPh + mpls */ | 2712 | /* Eth + IPh + UDPh + mpls */ |
2435 | datalen = pkt_dev->cur_pkt_size - 14 - | 2713 | datalen = pkt_dev->cur_pkt_size - 14 - |
2436 | sizeof(struct ipv6hdr) - sizeof(struct udphdr) - | 2714 | sizeof(struct ipv6hdr) - sizeof(struct udphdr) - |
2437 | pkt_dev->nr_labels*sizeof(u32); | 2715 | pkt_dev->nr_labels*sizeof(u32) - VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev); |
2438 | 2716 | ||
2439 | if (datalen < sizeof(struct pktgen_hdr)) { | 2717 | if (datalen < sizeof(struct pktgen_hdr)) { |
2440 | datalen = sizeof(struct pktgen_hdr); | 2718 | datalen = sizeof(struct pktgen_hdr); |
@@ -2450,6 +2728,11 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2450 | 2728 | ||
2451 | *(u32 *) iph = __constant_htonl(0x60000000); /* Version + flow */ | 2729 | *(u32 *) iph = __constant_htonl(0x60000000); /* Version + flow */ |
2452 | 2730 | ||
2731 | if (pkt_dev->traffic_class) { | ||
2732 | /* Version + traffic class + flow (0) */ | ||
2733 | *(u32 *)iph |= htonl(0x60000000 | (pkt_dev->traffic_class << 20)); | ||
2734 | } | ||
2735 | |||
2453 | iph->hop_limit = 32; | 2736 | iph->hop_limit = 32; |
2454 | 2737 | ||
2455 | iph->payload_len = htons(sizeof(struct udphdr) + datalen); | 2738 | iph->payload_len = htons(sizeof(struct udphdr) + datalen); |
@@ -2458,7 +2741,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2458 | ipv6_addr_copy(&iph->daddr, &pkt_dev->cur_in6_daddr); | 2741 | ipv6_addr_copy(&iph->daddr, &pkt_dev->cur_in6_daddr); |
2459 | ipv6_addr_copy(&iph->saddr, &pkt_dev->cur_in6_saddr); | 2742 | ipv6_addr_copy(&iph->saddr, &pkt_dev->cur_in6_saddr); |
2460 | 2743 | ||
2461 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32); | 2744 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32) - |
2745 | VLAN_TAG_SIZE(pkt_dev) - SVLAN_TAG_SIZE(pkt_dev); | ||
2462 | skb->protocol = protocol; | 2746 | skb->protocol = protocol; |
2463 | skb->dev = odev; | 2747 | skb->dev = odev; |
2464 | skb->pkt_type = PACKET_HOST; | 2748 | skb->pkt_type = PACKET_HOST; |
@@ -2531,7 +2815,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2531 | pgh->tv_sec = htonl(timestamp.tv_sec); | 2815 | pgh->tv_sec = htonl(timestamp.tv_sec); |
2532 | pgh->tv_usec = htonl(timestamp.tv_usec); | 2816 | pgh->tv_usec = htonl(timestamp.tv_usec); |
2533 | } | 2817 | } |
2534 | pkt_dev->seq_num++; | 2818 | /* pkt_dev->seq_num++; FF: you really mean this? */ |
2535 | 2819 | ||
2536 | return skb; | 2820 | return skb; |
2537 | } | 2821 | } |
@@ -3177,6 +3461,13 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3177 | pkt_dev->udp_dst_min = 9; | 3461 | pkt_dev->udp_dst_min = 9; |
3178 | pkt_dev->udp_dst_max = 9; | 3462 | pkt_dev->udp_dst_max = 9; |
3179 | 3463 | ||
3464 | pkt_dev->vlan_p = 0; | ||
3465 | pkt_dev->vlan_cfi = 0; | ||
3466 | pkt_dev->vlan_id = 0xffff; | ||
3467 | pkt_dev->svlan_p = 0; | ||
3468 | pkt_dev->svlan_cfi = 0; | ||
3469 | pkt_dev->svlan_id = 0xffff; | ||
3470 | |||
3180 | strncpy(pkt_dev->ifname, ifname, IFNAMSIZ); | 3471 | strncpy(pkt_dev->ifname, ifname, IFNAMSIZ); |
3181 | 3472 | ||
3182 | if (!pktgen_setup_dev(pkt_dev)) { | 3473 | if (!pktgen_setup_dev(pkt_dev)) { |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index d8e25e08cb7e..221e4038216b 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -562,7 +562,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
562 | 562 | ||
563 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); | 563 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); |
564 | if (err < 0) | 564 | if (err < 0) |
565 | goto errout; | 565 | return err; |
566 | 566 | ||
567 | ifm = nlmsg_data(nlh); | 567 | ifm = nlmsg_data(nlh); |
568 | if (ifm->ifi_index >= 0) { | 568 | if (ifm->ifi_index >= 0) { |
diff --git a/net/core/utils.c b/net/core/utils.c index 2682490777de..94c5d761c830 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Authors: | 4 | * Authors: |
5 | * net_random Alan Cox | 5 | * net_random Alan Cox |
6 | * net_ratelimit Andy Kleen | 6 | * net_ratelimit Andi Kleen |
7 | * in{4,6}_pton YOSHIFUJI Hideaki, Copyright (C)2006 USAGI/WIDE Project | 7 | * in{4,6}_pton YOSHIFUJI Hideaki, Copyright (C)2006 USAGI/WIDE Project |
8 | * | 8 | * |
9 | * Created by Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> | 9 | * Created by Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 66be29b6f508..bf692c1c116f 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -50,7 +50,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
50 | struct dccp_sock *dp = dccp_sk(sk); | 50 | struct dccp_sock *dp = dccp_sk(sk); |
51 | const struct sockaddr_in *usin = (struct sockaddr_in *)uaddr; | 51 | const struct sockaddr_in *usin = (struct sockaddr_in *)uaddr; |
52 | struct rtable *rt; | 52 | struct rtable *rt; |
53 | u32 daddr, nexthop; | 53 | __be32 daddr, nexthop; |
54 | int tmp; | 54 | int tmp; |
55 | int err; | 55 | int err; |
56 | 56 | ||
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 43863933f27f..4bd78c8cfb26 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -223,7 +223,7 @@ static int eth_header_parse(struct sk_buff *skb, unsigned char *haddr) | |||
223 | */ | 223 | */ |
224 | int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) | 224 | int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) |
225 | { | 225 | { |
226 | unsigned short type = hh->hh_type; | 226 | __be16 type = hh->hh_type; |
227 | struct ethhdr *eth; | 227 | struct ethhdr *eth; |
228 | struct net_device *dev = neigh->dev; | 228 | struct net_device *dev = neigh->dev; |
229 | 229 | ||
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index fdd89e37b9aa..edcf0932ac6d 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -996,7 +996,7 @@ static int inet_sk_reselect_saddr(struct sock *sk) | |||
996 | struct rtable *rt; | 996 | struct rtable *rt; |
997 | __u32 old_saddr = inet->saddr; | 997 | __u32 old_saddr = inet->saddr; |
998 | __u32 new_saddr; | 998 | __u32 new_saddr; |
999 | __u32 daddr = inet->daddr; | 999 | __be32 daddr = inet->daddr; |
1000 | 1000 | ||
1001 | if (inet->opt && inet->opt->srr) | 1001 | if (inet->opt && inet->opt->srr) |
1002 | daddr = inet->opt->faddr; | 1002 | daddr = inet->opt->faddr; |
@@ -1043,7 +1043,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1043 | { | 1043 | { |
1044 | struct inet_sock *inet = inet_sk(sk); | 1044 | struct inet_sock *inet = inet_sk(sk); |
1045 | struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); | 1045 | struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); |
1046 | u32 daddr; | 1046 | __be32 daddr; |
1047 | int err; | 1047 | int err; |
1048 | 1048 | ||
1049 | /* Route is OK, nothing to do. */ | 1049 | /* Route is OK, nothing to do. */ |
@@ -1342,10 +1342,10 @@ static int __init inet_init(void) | |||
1342 | rc = 0; | 1342 | rc = 0; |
1343 | out: | 1343 | out: |
1344 | return rc; | 1344 | return rc; |
1345 | out_unregister_tcp_proto: | ||
1346 | proto_unregister(&tcp_prot); | ||
1347 | out_unregister_udp_proto: | 1345 | out_unregister_udp_proto: |
1348 | proto_unregister(&udp_prot); | 1346 | proto_unregister(&udp_prot); |
1347 | out_unregister_tcp_proto: | ||
1348 | proto_unregister(&tcp_prot); | ||
1349 | goto out; | 1349 | goto out; |
1350 | } | 1350 | } |
1351 | 1351 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index c8a3723bc001..cfe5c8474286 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -234,7 +234,7 @@ static u32 arp_hash(const void *pkey, const struct net_device *dev) | |||
234 | 234 | ||
235 | static int arp_constructor(struct neighbour *neigh) | 235 | static int arp_constructor(struct neighbour *neigh) |
236 | { | 236 | { |
237 | u32 addr = *(u32*)neigh->primary_key; | 237 | __be32 addr = *(__be32*)neigh->primary_key; |
238 | struct net_device *dev = neigh->dev; | 238 | struct net_device *dev = neigh->dev; |
239 | struct in_device *in_dev; | 239 | struct in_device *in_dev; |
240 | struct neigh_parms *parms; | 240 | struct neigh_parms *parms; |
@@ -330,10 +330,10 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb) | |||
330 | 330 | ||
331 | static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | 331 | static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) |
332 | { | 332 | { |
333 | u32 saddr = 0; | 333 | __be32 saddr = 0; |
334 | u8 *dst_ha = NULL; | 334 | u8 *dst_ha = NULL; |
335 | struct net_device *dev = neigh->dev; | 335 | struct net_device *dev = neigh->dev; |
336 | u32 target = *(u32*)neigh->primary_key; | 336 | __be32 target = *(__be32*)neigh->primary_key; |
337 | int probes = atomic_read(&neigh->probes); | 337 | int probes = atomic_read(&neigh->probes); |
338 | struct in_device *in_dev = in_dev_get(dev); | 338 | struct in_device *in_dev = in_dev_get(dev); |
339 | 339 | ||
@@ -385,7 +385,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
385 | } | 385 | } |
386 | 386 | ||
387 | static int arp_ignore(struct in_device *in_dev, struct net_device *dev, | 387 | static int arp_ignore(struct in_device *in_dev, struct net_device *dev, |
388 | u32 sip, u32 tip) | 388 | __be32 sip, __be32 tip) |
389 | { | 389 | { |
390 | int scope; | 390 | int scope; |
391 | 391 | ||
@@ -420,7 +420,7 @@ static int arp_ignore(struct in_device *in_dev, struct net_device *dev, | |||
420 | return !inet_confirm_addr(dev, sip, tip, scope); | 420 | return !inet_confirm_addr(dev, sip, tip, scope); |
421 | } | 421 | } |
422 | 422 | ||
423 | static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev) | 423 | static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) |
424 | { | 424 | { |
425 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, | 425 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, |
426 | .saddr = tip } } }; | 426 | .saddr = tip } } }; |
@@ -449,7 +449,7 @@ static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev) | |||
449 | * is allowed to use this function, it is scheduled to be removed. --ANK | 449 | * is allowed to use this function, it is scheduled to be removed. --ANK |
450 | */ | 450 | */ |
451 | 451 | ||
452 | static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, struct net_device * dev) | 452 | static int arp_set_predefined(int addr_hint, unsigned char * haddr, __be32 paddr, struct net_device * dev) |
453 | { | 453 | { |
454 | switch (addr_hint) { | 454 | switch (addr_hint) { |
455 | case RTN_LOCAL: | 455 | case RTN_LOCAL: |
@@ -470,7 +470,7 @@ static int arp_set_predefined(int addr_hint, unsigned char * haddr, u32 paddr, s | |||
470 | int arp_find(unsigned char *haddr, struct sk_buff *skb) | 470 | int arp_find(unsigned char *haddr, struct sk_buff *skb) |
471 | { | 471 | { |
472 | struct net_device *dev = skb->dev; | 472 | struct net_device *dev = skb->dev; |
473 | u32 paddr; | 473 | __be32 paddr; |
474 | struct neighbour *n; | 474 | struct neighbour *n; |
475 | 475 | ||
476 | if (!skb->dst) { | 476 | if (!skb->dst) { |
@@ -511,7 +511,7 @@ int arp_bind_neighbour(struct dst_entry *dst) | |||
511 | if (dev == NULL) | 511 | if (dev == NULL) |
512 | return -EINVAL; | 512 | return -EINVAL; |
513 | if (n == NULL) { | 513 | if (n == NULL) { |
514 | u32 nexthop = ((struct rtable*)dst)->rt_gateway; | 514 | __be32 nexthop = ((struct rtable*)dst)->rt_gateway; |
515 | if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)) | 515 | if (dev->flags&(IFF_LOOPBACK|IFF_POINTOPOINT)) |
516 | nexthop = 0; | 516 | nexthop = 0; |
517 | n = __neigh_lookup_errno( | 517 | n = __neigh_lookup_errno( |
@@ -560,8 +560,8 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, struct rtable *rt) | |||
560 | * Create an arp packet. If (dest_hw == NULL), we create a broadcast | 560 | * Create an arp packet. If (dest_hw == NULL), we create a broadcast |
561 | * message. | 561 | * message. |
562 | */ | 562 | */ |
563 | struct sk_buff *arp_create(int type, int ptype, u32 dest_ip, | 563 | struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, |
564 | struct net_device *dev, u32 src_ip, | 564 | struct net_device *dev, __be32 src_ip, |
565 | unsigned char *dest_hw, unsigned char *src_hw, | 565 | unsigned char *dest_hw, unsigned char *src_hw, |
566 | unsigned char *target_hw) | 566 | unsigned char *target_hw) |
567 | { | 567 | { |
@@ -675,8 +675,8 @@ void arp_xmit(struct sk_buff *skb) | |||
675 | /* | 675 | /* |
676 | * Create and send an arp packet. | 676 | * Create and send an arp packet. |
677 | */ | 677 | */ |
678 | void arp_send(int type, int ptype, u32 dest_ip, | 678 | void arp_send(int type, int ptype, __be32 dest_ip, |
679 | struct net_device *dev, u32 src_ip, | 679 | struct net_device *dev, __be32 src_ip, |
680 | unsigned char *dest_hw, unsigned char *src_hw, | 680 | unsigned char *dest_hw, unsigned char *src_hw, |
681 | unsigned char *target_hw) | 681 | unsigned char *target_hw) |
682 | { | 682 | { |
@@ -710,7 +710,7 @@ static int arp_process(struct sk_buff *skb) | |||
710 | unsigned char *arp_ptr; | 710 | unsigned char *arp_ptr; |
711 | struct rtable *rt; | 711 | struct rtable *rt; |
712 | unsigned char *sha, *tha; | 712 | unsigned char *sha, *tha; |
713 | u32 sip, tip; | 713 | __be32 sip, tip; |
714 | u16 dev_type = dev->type; | 714 | u16 dev_type = dev->type; |
715 | int addr_type; | 715 | int addr_type; |
716 | struct neighbour *n; | 716 | struct neighbour *n; |
@@ -969,13 +969,13 @@ out_of_mem: | |||
969 | 969 | ||
970 | static int arp_req_set(struct arpreq *r, struct net_device * dev) | 970 | static int arp_req_set(struct arpreq *r, struct net_device * dev) |
971 | { | 971 | { |
972 | u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; | 972 | __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; |
973 | struct neighbour *neigh; | 973 | struct neighbour *neigh; |
974 | int err; | 974 | int err; |
975 | 975 | ||
976 | if (r->arp_flags&ATF_PUBL) { | 976 | if (r->arp_flags&ATF_PUBL) { |
977 | u32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr; | 977 | __be32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr; |
978 | if (mask && mask != 0xFFFFFFFF) | 978 | if (mask && mask != htonl(0xFFFFFFFF)) |
979 | return -EINVAL; | 979 | return -EINVAL; |
980 | if (!dev && (r->arp_flags & ATF_COM)) { | 980 | if (!dev && (r->arp_flags & ATF_COM)) { |
981 | dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data); | 981 | dev = dev_getbyhwaddr(r->arp_ha.sa_family, r->arp_ha.sa_data); |
@@ -1063,7 +1063,7 @@ static unsigned arp_state_to_flags(struct neighbour *neigh) | |||
1063 | 1063 | ||
1064 | static int arp_req_get(struct arpreq *r, struct net_device *dev) | 1064 | static int arp_req_get(struct arpreq *r, struct net_device *dev) |
1065 | { | 1065 | { |
1066 | u32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; | 1066 | __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr; |
1067 | struct neighbour *neigh; | 1067 | struct neighbour *neigh; |
1068 | int err = -ENXIO; | 1068 | int err = -ENXIO; |
1069 | 1069 | ||
@@ -1084,13 +1084,13 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev) | |||
1084 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) | 1084 | static int arp_req_delete(struct arpreq *r, struct net_device * dev) |
1085 | { | 1085 | { |
1086 | int err; | 1086 | int err; |
1087 | u32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; | 1087 | __be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr; |
1088 | struct neighbour *neigh; | 1088 | struct neighbour *neigh; |
1089 | 1089 | ||
1090 | if (r->arp_flags & ATF_PUBL) { | 1090 | if (r->arp_flags & ATF_PUBL) { |
1091 | u32 mask = | 1091 | __be32 mask = |
1092 | ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; | 1092 | ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; |
1093 | if (mask == 0xFFFFFFFF) | 1093 | if (mask == htonl(0xFFFFFFFF)) |
1094 | return pneigh_delete(&arp_tbl, &ip, dev); | 1094 | return pneigh_delete(&arp_tbl, &ip, dev); |
1095 | if (mask == 0) { | 1095 | if (mask == 0) { |
1096 | if (dev == NULL) { | 1096 | if (dev == NULL) { |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index e6ce0b3ba62a..c4e469ff842d 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -474,6 +474,7 @@ doi_add_failure_rlock: | |||
474 | /** | 474 | /** |
475 | * cipso_v4_doi_remove - Remove an existing DOI from the CIPSO protocol engine | 475 | * cipso_v4_doi_remove - Remove an existing DOI from the CIPSO protocol engine |
476 | * @doi: the DOI value | 476 | * @doi: the DOI value |
477 | * @audit_secid: the LSM secid to use in the audit message | ||
477 | * @callback: the DOI cleanup/free callback | 478 | * @callback: the DOI cleanup/free callback |
478 | * | 479 | * |
479 | * Description: | 480 | * Description: |
@@ -483,7 +484,9 @@ doi_add_failure_rlock: | |||
483 | * success and negative values on failure. | 484 | * success and negative values on failure. |
484 | * | 485 | * |
485 | */ | 486 | */ |
486 | int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)) | 487 | int cipso_v4_doi_remove(u32 doi, |
488 | u32 audit_secid, | ||
489 | void (*callback) (struct rcu_head * head)) | ||
487 | { | 490 | { |
488 | struct cipso_v4_doi *doi_def; | 491 | struct cipso_v4_doi *doi_def; |
489 | struct cipso_v4_domhsh_entry *dom_iter; | 492 | struct cipso_v4_domhsh_entry *dom_iter; |
@@ -502,7 +505,8 @@ int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)) | |||
502 | spin_unlock(&cipso_v4_doi_list_lock); | 505 | spin_unlock(&cipso_v4_doi_list_lock); |
503 | list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list) | 506 | list_for_each_entry_rcu(dom_iter, &doi_def->dom_list, list) |
504 | if (dom_iter->valid) | 507 | if (dom_iter->valid) |
505 | netlbl_domhsh_remove(dom_iter->domain); | 508 | netlbl_domhsh_remove(dom_iter->domain, |
509 | audit_secid); | ||
506 | cipso_v4_cache_invalidate(); | 510 | cipso_v4_cache_invalidate(); |
507 | rcu_read_unlock(); | 511 | rcu_read_unlock(); |
508 | 512 | ||
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index ec5da4fbd9f4..7b068a891953 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -25,7 +25,7 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
25 | struct inet_sock *inet = inet_sk(sk); | 25 | struct inet_sock *inet = inet_sk(sk); |
26 | struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; | 26 | struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; |
27 | struct rtable *rt; | 27 | struct rtable *rt; |
28 | u32 saddr; | 28 | __be32 saddr; |
29 | int oif; | 29 | int oif; |
30 | int err; | 30 | int err; |
31 | 31 | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 8e8d1f17d77a..7602c79a389b 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -224,7 +224,7 @@ static void inetdev_destroy(struct in_device *in_dev) | |||
224 | call_rcu(&in_dev->rcu_head, in_dev_rcu_put); | 224 | call_rcu(&in_dev->rcu_head, in_dev_rcu_put); |
225 | } | 225 | } |
226 | 226 | ||
227 | int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b) | 227 | int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b) |
228 | { | 228 | { |
229 | rcu_read_lock(); | 229 | rcu_read_lock(); |
230 | for_primary_ifa(in_dev) { | 230 | for_primary_ifa(in_dev) { |
@@ -429,8 +429,8 @@ struct in_device *inetdev_by_index(int ifindex) | |||
429 | 429 | ||
430 | /* Called only from RTNL semaphored context. No locks. */ | 430 | /* Called only from RTNL semaphored context. No locks. */ |
431 | 431 | ||
432 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, | 432 | struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, |
433 | u32 mask) | 433 | __be32 mask) |
434 | { | 434 | { |
435 | ASSERT_RTNL(); | 435 | ASSERT_RTNL(); |
436 | 436 | ||
@@ -467,7 +467,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
467 | for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; | 467 | for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; |
468 | ifap = &ifa->ifa_next) { | 468 | ifap = &ifa->ifa_next) { |
469 | if (tb[IFA_LOCAL] && | 469 | if (tb[IFA_LOCAL] && |
470 | ifa->ifa_local != nla_get_u32(tb[IFA_LOCAL])) | 470 | ifa->ifa_local != nla_get_be32(tb[IFA_LOCAL])) |
471 | continue; | 471 | continue; |
472 | 472 | ||
473 | if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label)) | 473 | if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label)) |
@@ -475,7 +475,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
475 | 475 | ||
476 | if (tb[IFA_ADDRESS] && | 476 | if (tb[IFA_ADDRESS] && |
477 | (ifm->ifa_prefixlen != ifa->ifa_prefixlen || | 477 | (ifm->ifa_prefixlen != ifa->ifa_prefixlen || |
478 | !inet_ifa_match(nla_get_u32(tb[IFA_ADDRESS]), ifa))) | 478 | !inet_ifa_match(nla_get_be32(tb[IFA_ADDRESS]), ifa))) |
479 | continue; | 479 | continue; |
480 | 480 | ||
481 | __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).pid); | 481 | __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).pid); |
@@ -540,14 +540,14 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) | |||
540 | ifa->ifa_scope = ifm->ifa_scope; | 540 | ifa->ifa_scope = ifm->ifa_scope; |
541 | ifa->ifa_dev = in_dev; | 541 | ifa->ifa_dev = in_dev; |
542 | 542 | ||
543 | ifa->ifa_local = nla_get_u32(tb[IFA_LOCAL]); | 543 | ifa->ifa_local = nla_get_be32(tb[IFA_LOCAL]); |
544 | ifa->ifa_address = nla_get_u32(tb[IFA_ADDRESS]); | 544 | ifa->ifa_address = nla_get_be32(tb[IFA_ADDRESS]); |
545 | 545 | ||
546 | if (tb[IFA_BROADCAST]) | 546 | if (tb[IFA_BROADCAST]) |
547 | ifa->ifa_broadcast = nla_get_u32(tb[IFA_BROADCAST]); | 547 | ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]); |
548 | 548 | ||
549 | if (tb[IFA_ANYCAST]) | 549 | if (tb[IFA_ANYCAST]) |
550 | ifa->ifa_anycast = nla_get_u32(tb[IFA_ANYCAST]); | 550 | ifa->ifa_anycast = nla_get_be32(tb[IFA_ANYCAST]); |
551 | 551 | ||
552 | if (tb[IFA_LABEL]) | 552 | if (tb[IFA_LABEL]) |
553 | nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); | 553 | nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); |
@@ -805,7 +805,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) | |||
805 | break; | 805 | break; |
806 | ret = 0; | 806 | ret = 0; |
807 | if (ifa->ifa_mask != sin->sin_addr.s_addr) { | 807 | if (ifa->ifa_mask != sin->sin_addr.s_addr) { |
808 | u32 old_mask = ifa->ifa_mask; | 808 | __be32 old_mask = ifa->ifa_mask; |
809 | inet_del_ifa(in_dev, ifap, 0); | 809 | inet_del_ifa(in_dev, ifap, 0); |
810 | ifa->ifa_mask = sin->sin_addr.s_addr; | 810 | ifa->ifa_mask = sin->sin_addr.s_addr; |
811 | ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask); | 811 | ifa->ifa_prefixlen = inet_mask_len(ifa->ifa_mask); |
@@ -876,9 +876,9 @@ out: | |||
876 | return done; | 876 | return done; |
877 | } | 877 | } |
878 | 878 | ||
879 | u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope) | 879 | __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope) |
880 | { | 880 | { |
881 | u32 addr = 0; | 881 | __be32 addr = 0; |
882 | struct in_device *in_dev; | 882 | struct in_device *in_dev; |
883 | 883 | ||
884 | rcu_read_lock(); | 884 | rcu_read_lock(); |
@@ -927,11 +927,11 @@ out: | |||
927 | return addr; | 927 | return addr; |
928 | } | 928 | } |
929 | 929 | ||
930 | static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst, | 930 | static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst, |
931 | u32 local, int scope) | 931 | __be32 local, int scope) |
932 | { | 932 | { |
933 | int same = 0; | 933 | int same = 0; |
934 | u32 addr = 0; | 934 | __be32 addr = 0; |
935 | 935 | ||
936 | for_ifa(in_dev) { | 936 | for_ifa(in_dev) { |
937 | if (!addr && | 937 | if (!addr && |
@@ -971,9 +971,9 @@ static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst, | |||
971 | * - local: address, 0=autoselect the local address | 971 | * - local: address, 0=autoselect the local address |
972 | * - scope: maximum allowed scope value for the local address | 972 | * - scope: maximum allowed scope value for the local address |
973 | */ | 973 | */ |
974 | u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope) | 974 | __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope) |
975 | { | 975 | { |
976 | u32 addr = 0; | 976 | __be32 addr = 0; |
977 | struct in_device *in_dev; | 977 | struct in_device *in_dev; |
978 | 978 | ||
979 | if (dev) { | 979 | if (dev) { |
@@ -1138,16 +1138,16 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, | |||
1138 | ifm->ifa_index = ifa->ifa_dev->dev->ifindex; | 1138 | ifm->ifa_index = ifa->ifa_dev->dev->ifindex; |
1139 | 1139 | ||
1140 | if (ifa->ifa_address) | 1140 | if (ifa->ifa_address) |
1141 | NLA_PUT_U32(skb, IFA_ADDRESS, ifa->ifa_address); | 1141 | NLA_PUT_BE32(skb, IFA_ADDRESS, ifa->ifa_address); |
1142 | 1142 | ||
1143 | if (ifa->ifa_local) | 1143 | if (ifa->ifa_local) |
1144 | NLA_PUT_U32(skb, IFA_LOCAL, ifa->ifa_local); | 1144 | NLA_PUT_BE32(skb, IFA_LOCAL, ifa->ifa_local); |
1145 | 1145 | ||
1146 | if (ifa->ifa_broadcast) | 1146 | if (ifa->ifa_broadcast) |
1147 | NLA_PUT_U32(skb, IFA_BROADCAST, ifa->ifa_broadcast); | 1147 | NLA_PUT_BE32(skb, IFA_BROADCAST, ifa->ifa_broadcast); |
1148 | 1148 | ||
1149 | if (ifa->ifa_anycast) | 1149 | if (ifa->ifa_anycast) |
1150 | NLA_PUT_U32(skb, IFA_ANYCAST, ifa->ifa_anycast); | 1150 | NLA_PUT_BE32(skb, IFA_ANYCAST, ifa->ifa_anycast); |
1151 | 1151 | ||
1152 | if (ifa->ifa_label[0]) | 1152 | if (ifa->ifa_label[0]) |
1153 | NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); | 1153 | NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index cfb527c060e4..9c399a70dd5d 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -122,7 +122,7 @@ static void fib_flush(void) | |||
122 | * Find the first device with a given source address. | 122 | * Find the first device with a given source address. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | struct net_device * ip_dev_find(u32 addr) | 125 | struct net_device * ip_dev_find(__be32 addr) |
126 | { | 126 | { |
127 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; | 127 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; |
128 | struct fib_result res; | 128 | struct fib_result res; |
@@ -146,7 +146,7 @@ out: | |||
146 | return dev; | 146 | return dev; |
147 | } | 147 | } |
148 | 148 | ||
149 | unsigned inet_addr_type(u32 addr) | 149 | unsigned inet_addr_type(__be32 addr) |
150 | { | 150 | { |
151 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; | 151 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; |
152 | struct fib_result res; | 152 | struct fib_result res; |
@@ -180,8 +180,8 @@ unsigned inet_addr_type(u32 addr) | |||
180 | - check, that packet arrived from expected physical interface. | 180 | - check, that packet arrived from expected physical interface. |
181 | */ | 181 | */ |
182 | 182 | ||
183 | int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, | 183 | int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
184 | struct net_device *dev, u32 *spec_dst, u32 *itag) | 184 | struct net_device *dev, __be32 *spec_dst, u32 *itag) |
185 | { | 185 | { |
186 | struct in_device *in_dev; | 186 | struct in_device *in_dev; |
187 | struct flowi fl = { .nl_u = { .ip4_u = | 187 | struct flowi fl = { .nl_u = { .ip4_u = |
@@ -253,7 +253,7 @@ e_inval: | |||
253 | 253 | ||
254 | #ifndef CONFIG_IP_NOSIOCRT | 254 | #ifndef CONFIG_IP_NOSIOCRT |
255 | 255 | ||
256 | static inline u32 sk_extract_addr(struct sockaddr *addr) | 256 | static inline __be32 sk_extract_addr(struct sockaddr *addr) |
257 | { | 257 | { |
258 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; | 258 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; |
259 | } | 259 | } |
@@ -273,7 +273,7 @@ static int put_rtax(struct nlattr *mx, int len, int type, u32 value) | |||
273 | static int rtentry_to_fib_config(int cmd, struct rtentry *rt, | 273 | static int rtentry_to_fib_config(int cmd, struct rtentry *rt, |
274 | struct fib_config *cfg) | 274 | struct fib_config *cfg) |
275 | { | 275 | { |
276 | u32 addr; | 276 | __be32 addr; |
277 | int plen; | 277 | int plen; |
278 | 278 | ||
279 | memset(cfg, 0, sizeof(*cfg)); | 279 | memset(cfg, 0, sizeof(*cfg)); |
@@ -292,7 +292,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, | |||
292 | plen = 32; | 292 | plen = 32; |
293 | addr = sk_extract_addr(&rt->rt_dst); | 293 | addr = sk_extract_addr(&rt->rt_dst); |
294 | if (!(rt->rt_flags & RTF_HOST)) { | 294 | if (!(rt->rt_flags & RTF_HOST)) { |
295 | u32 mask = sk_extract_addr(&rt->rt_genmask); | 295 | __be32 mask = sk_extract_addr(&rt->rt_genmask); |
296 | 296 | ||
297 | if (rt->rt_genmask.sa_family != AF_INET) { | 297 | if (rt->rt_genmask.sa_family != AF_INET) { |
298 | if (mask || rt->rt_genmask.sa_family) | 298 | if (mask || rt->rt_genmask.sa_family) |
@@ -499,22 +499,22 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
499 | nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { | 499 | nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { |
500 | switch (attr->nla_type) { | 500 | switch (attr->nla_type) { |
501 | case RTA_DST: | 501 | case RTA_DST: |
502 | cfg->fc_dst = nla_get_u32(attr); | 502 | cfg->fc_dst = nla_get_be32(attr); |
503 | break; | 503 | break; |
504 | case RTA_SRC: | 504 | case RTA_SRC: |
505 | cfg->fc_src = nla_get_u32(attr); | 505 | cfg->fc_src = nla_get_be32(attr); |
506 | break; | 506 | break; |
507 | case RTA_OIF: | 507 | case RTA_OIF: |
508 | cfg->fc_oif = nla_get_u32(attr); | 508 | cfg->fc_oif = nla_get_u32(attr); |
509 | break; | 509 | break; |
510 | case RTA_GATEWAY: | 510 | case RTA_GATEWAY: |
511 | cfg->fc_gw = nla_get_u32(attr); | 511 | cfg->fc_gw = nla_get_be32(attr); |
512 | break; | 512 | break; |
513 | case RTA_PRIORITY: | 513 | case RTA_PRIORITY: |
514 | cfg->fc_priority = nla_get_u32(attr); | 514 | cfg->fc_priority = nla_get_u32(attr); |
515 | break; | 515 | break; |
516 | case RTA_PREFSRC: | 516 | case RTA_PREFSRC: |
517 | cfg->fc_prefsrc = nla_get_u32(attr); | 517 | cfg->fc_prefsrc = nla_get_be32(attr); |
518 | break; | 518 | break; |
519 | case RTA_METRICS: | 519 | case RTA_METRICS: |
520 | cfg->fc_mx = nla_data(attr); | 520 | cfg->fc_mx = nla_data(attr); |
@@ -627,8 +627,7 @@ out: | |||
627 | only when netlink is already locked. | 627 | only when netlink is already locked. |
628 | */ | 628 | */ |
629 | 629 | ||
630 | static void fib_magic(int cmd, int type, u32 dst, int dst_len, | 630 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) |
631 | struct in_ifaddr *ifa) | ||
632 | { | 631 | { |
633 | struct fib_table *tb; | 632 | struct fib_table *tb; |
634 | struct fib_config cfg = { | 633 | struct fib_config cfg = { |
@@ -667,9 +666,9 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) | |||
667 | struct in_device *in_dev = ifa->ifa_dev; | 666 | struct in_device *in_dev = ifa->ifa_dev; |
668 | struct net_device *dev = in_dev->dev; | 667 | struct net_device *dev = in_dev->dev; |
669 | struct in_ifaddr *prim = ifa; | 668 | struct in_ifaddr *prim = ifa; |
670 | u32 mask = ifa->ifa_mask; | 669 | __be32 mask = ifa->ifa_mask; |
671 | u32 addr = ifa->ifa_local; | 670 | __be32 addr = ifa->ifa_local; |
672 | u32 prefix = ifa->ifa_address&mask; | 671 | __be32 prefix = ifa->ifa_address&mask; |
673 | 672 | ||
674 | if (ifa->ifa_flags&IFA_F_SECONDARY) { | 673 | if (ifa->ifa_flags&IFA_F_SECONDARY) { |
675 | prim = inet_ifa_byprefix(in_dev, prefix, mask); | 674 | prim = inet_ifa_byprefix(in_dev, prefix, mask); |
@@ -685,7 +684,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) | |||
685 | return; | 684 | return; |
686 | 685 | ||
687 | /* Add broadcast address, if it is explicitly assigned. */ | 686 | /* Add broadcast address, if it is explicitly assigned. */ |
688 | if (ifa->ifa_broadcast && ifa->ifa_broadcast != 0xFFFFFFFF) | 687 | if (ifa->ifa_broadcast && ifa->ifa_broadcast != htonl(0xFFFFFFFF)) |
689 | fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim); | 688 | fib_magic(RTM_NEWROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim); |
690 | 689 | ||
691 | if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) && | 690 | if (!ZERONET(prefix) && !(ifa->ifa_flags&IFA_F_SECONDARY) && |
@@ -707,8 +706,8 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) | |||
707 | struct net_device *dev = in_dev->dev; | 706 | struct net_device *dev = in_dev->dev; |
708 | struct in_ifaddr *ifa1; | 707 | struct in_ifaddr *ifa1; |
709 | struct in_ifaddr *prim = ifa; | 708 | struct in_ifaddr *prim = ifa; |
710 | u32 brd = ifa->ifa_address|~ifa->ifa_mask; | 709 | __be32 brd = ifa->ifa_address|~ifa->ifa_mask; |
711 | u32 any = ifa->ifa_address&ifa->ifa_mask; | 710 | __be32 any = ifa->ifa_address&ifa->ifa_mask; |
712 | #define LOCAL_OK 1 | 711 | #define LOCAL_OK 1 |
713 | #define BRD_OK 2 | 712 | #define BRD_OK 2 |
714 | #define BRD0_OK 4 | 713 | #define BRD0_OK 4 |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 88133b383dc5..107bb6cbb0b3 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -51,7 +51,7 @@ static kmem_cache_t *fn_alias_kmem __read_mostly; | |||
51 | struct fib_node { | 51 | struct fib_node { |
52 | struct hlist_node fn_hash; | 52 | struct hlist_node fn_hash; |
53 | struct list_head fn_alias; | 53 | struct list_head fn_alias; |
54 | u32 fn_key; | 54 | __be32 fn_key; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | struct fn_zone { | 57 | struct fn_zone { |
@@ -64,7 +64,7 @@ struct fn_zone { | |||
64 | #define FZ_HASHMASK(fz) ((fz)->fz_hashmask) | 64 | #define FZ_HASHMASK(fz) ((fz)->fz_hashmask) |
65 | 65 | ||
66 | int fz_order; /* Zone order */ | 66 | int fz_order; /* Zone order */ |
67 | u32 fz_mask; | 67 | __be32 fz_mask; |
68 | #define FZ_MASK(fz) ((fz)->fz_mask) | 68 | #define FZ_MASK(fz) ((fz)->fz_mask) |
69 | }; | 69 | }; |
70 | 70 | ||
@@ -77,7 +77,7 @@ struct fn_hash { | |||
77 | struct fn_zone *fn_zone_list; | 77 | struct fn_zone *fn_zone_list; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static inline u32 fn_hash(u32 key, struct fn_zone *fz) | 80 | static inline u32 fn_hash(__be32 key, struct fn_zone *fz) |
81 | { | 81 | { |
82 | u32 h = ntohl(key)>>(32 - fz->fz_order); | 82 | u32 h = ntohl(key)>>(32 - fz->fz_order); |
83 | h ^= (h>>20); | 83 | h ^= (h>>20); |
@@ -87,7 +87,7 @@ static inline u32 fn_hash(u32 key, struct fn_zone *fz) | |||
87 | return h; | 87 | return h; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline u32 fz_key(u32 dst, struct fn_zone *fz) | 90 | static inline __be32 fz_key(__be32 dst, struct fn_zone *fz) |
91 | { | 91 | { |
92 | return dst & FZ_MASK(fz); | 92 | return dst & FZ_MASK(fz); |
93 | } | 93 | } |
@@ -254,7 +254,7 @@ fn_hash_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result | |||
254 | struct hlist_head *head; | 254 | struct hlist_head *head; |
255 | struct hlist_node *node; | 255 | struct hlist_node *node; |
256 | struct fib_node *f; | 256 | struct fib_node *f; |
257 | u32 k = fz_key(flp->fl4_dst, fz); | 257 | __be32 k = fz_key(flp->fl4_dst, fz); |
258 | 258 | ||
259 | head = &fz->fz_hash[fn_hash(k, fz)]; | 259 | head = &fz->fz_hash[fn_hash(k, fz)]; |
260 | hlist_for_each_entry(f, node, head, fn_hash) { | 260 | hlist_for_each_entry(f, node, head, fn_hash) { |
@@ -365,7 +365,7 @@ static inline void fib_insert_node(struct fn_zone *fz, struct fib_node *f) | |||
365 | } | 365 | } |
366 | 366 | ||
367 | /* Return the node in FZ matching KEY. */ | 367 | /* Return the node in FZ matching KEY. */ |
368 | static struct fib_node *fib_find_node(struct fn_zone *fz, u32 key) | 368 | static struct fib_node *fib_find_node(struct fn_zone *fz, __be32 key) |
369 | { | 369 | { |
370 | struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)]; | 370 | struct hlist_head *head = &fz->fz_hash[fn_hash(key, fz)]; |
371 | struct hlist_node *node; | 371 | struct hlist_node *node; |
@@ -387,7 +387,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg) | |||
387 | struct fn_zone *fz; | 387 | struct fn_zone *fz; |
388 | struct fib_info *fi; | 388 | struct fib_info *fi; |
389 | u8 tos = cfg->fc_tos; | 389 | u8 tos = cfg->fc_tos; |
390 | u32 key; | 390 | __be32 key; |
391 | int err; | 391 | int err; |
392 | 392 | ||
393 | if (cfg->fc_dst_len > 32) | 393 | if (cfg->fc_dst_len > 32) |
@@ -541,7 +541,7 @@ static int fn_hash_delete(struct fib_table *tb, struct fib_config *cfg) | |||
541 | struct fib_node *f; | 541 | struct fib_node *f; |
542 | struct fib_alias *fa, *fa_to_delete; | 542 | struct fib_alias *fa, *fa_to_delete; |
543 | struct fn_zone *fz; | 543 | struct fn_zone *fz; |
544 | u32 key; | 544 | __be32 key; |
545 | 545 | ||
546 | if (cfg->fc_dst_len > 32) | 546 | if (cfg->fc_dst_len > 32) |
547 | return -EINVAL; | 547 | return -EINVAL; |
@@ -966,7 +966,7 @@ static void fib_seq_stop(struct seq_file *seq, void *v) | |||
966 | read_unlock(&fib_hash_lock); | 966 | read_unlock(&fib_hash_lock); |
967 | } | 967 | } |
968 | 968 | ||
969 | static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) | 969 | static unsigned fib_flag_trans(int type, __be32 mask, struct fib_info *fi) |
970 | { | 970 | { |
971 | static const unsigned type2flags[RTN_MAX + 1] = { | 971 | static const unsigned type2flags[RTN_MAX + 1] = { |
972 | [7] = RTF_REJECT, [8] = RTF_REJECT, | 972 | [7] = RTF_REJECT, [8] = RTF_REJECT, |
@@ -975,7 +975,7 @@ static unsigned fib_flag_trans(int type, u32 mask, struct fib_info *fi) | |||
975 | 975 | ||
976 | if (fi && fi->fib_nh->nh_gw) | 976 | if (fi && fi->fib_nh->nh_gw) |
977 | flags |= RTF_GATEWAY; | 977 | flags |= RTF_GATEWAY; |
978 | if (mask == 0xFFFFFFFF) | 978 | if (mask == htonl(0xFFFFFFFF)) |
979 | flags |= RTF_HOST; | 979 | flags |= RTF_HOST; |
980 | flags |= RTF_UP; | 980 | flags |= RTF_UP; |
981 | return flags; | 981 | return flags; |
@@ -991,7 +991,7 @@ static int fib_seq_show(struct seq_file *seq, void *v) | |||
991 | { | 991 | { |
992 | struct fib_iter_state *iter; | 992 | struct fib_iter_state *iter; |
993 | char bf[128]; | 993 | char bf[128]; |
994 | u32 prefix, mask; | 994 | __be32 prefix, mask; |
995 | unsigned flags; | 995 | unsigned flags; |
996 | struct fib_node *f; | 996 | struct fib_node *f; |
997 | struct fib_alias *fa; | 997 | struct fib_alias *fa; |
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index fd6f7769f8ab..0e8b70bad4e1 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
@@ -20,16 +20,16 @@ struct fib_alias { | |||
20 | /* Exported by fib_semantics.c */ | 20 | /* Exported by fib_semantics.c */ |
21 | extern int fib_semantic_match(struct list_head *head, | 21 | extern int fib_semantic_match(struct list_head *head, |
22 | const struct flowi *flp, | 22 | const struct flowi *flp, |
23 | struct fib_result *res, __u32 zone, __u32 mask, | 23 | struct fib_result *res, __be32 zone, __be32 mask, |
24 | int prefixlen); | 24 | int prefixlen); |
25 | extern void fib_release_info(struct fib_info *); | 25 | extern void fib_release_info(struct fib_info *); |
26 | extern struct fib_info *fib_create_info(struct fib_config *cfg); | 26 | extern struct fib_info *fib_create_info(struct fib_config *cfg); |
27 | extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi); | 27 | extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi); |
28 | extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | 28 | extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, |
29 | u32 tb_id, u8 type, u8 scope, u32 dst, | 29 | u32 tb_id, u8 type, u8 scope, __be32 dst, |
30 | int dst_len, u8 tos, struct fib_info *fi, | 30 | int dst_len, u8 tos, struct fib_info *fi, |
31 | unsigned int); | 31 | unsigned int); |
32 | extern void rtmsg_fib(int event, u32 key, struct fib_alias *fa, | 32 | extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, |
33 | int dst_len, u32 tb_id, struct nl_info *info); | 33 | int dst_len, u32 tb_id, struct nl_info *info); |
34 | extern struct fib_alias *fib_find_alias(struct list_head *fah, | 34 | extern struct fib_alias *fib_find_alias(struct list_head *fah, |
35 | u8 tos, u32 prio); | 35 | u8 tos, u32 prio); |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 52b2adae4f22..0852b9cd065a 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -40,10 +40,10 @@ struct fib4_rule | |||
40 | u8 dst_len; | 40 | u8 dst_len; |
41 | u8 src_len; | 41 | u8 src_len; |
42 | u8 tos; | 42 | u8 tos; |
43 | u32 src; | 43 | __be32 src; |
44 | u32 srcmask; | 44 | __be32 srcmask; |
45 | u32 dst; | 45 | __be32 dst; |
46 | u32 dstmask; | 46 | __be32 dstmask; |
47 | #ifdef CONFIG_IP_ROUTE_FWMARK | 47 | #ifdef CONFIG_IP_ROUTE_FWMARK |
48 | u32 fwmark; | 48 | u32 fwmark; |
49 | u32 fwmask; | 49 | u32 fwmask; |
@@ -150,8 +150,8 @@ void fib_select_default(const struct flowi *flp, struct fib_result *res) | |||
150 | static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | 150 | static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) |
151 | { | 151 | { |
152 | struct fib4_rule *r = (struct fib4_rule *) rule; | 152 | struct fib4_rule *r = (struct fib4_rule *) rule; |
153 | u32 daddr = fl->fl4_dst; | 153 | __be32 daddr = fl->fl4_dst; |
154 | u32 saddr = fl->fl4_src; | 154 | __be32 saddr = fl->fl4_src; |
155 | 155 | ||
156 | if (((saddr ^ r->src) & r->srcmask) || | 156 | if (((saddr ^ r->src) & r->srcmask) || |
157 | ((daddr ^ r->dst) & r->dstmask)) | 157 | ((daddr ^ r->dst) & r->dstmask)) |
@@ -215,10 +215,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
215 | } | 215 | } |
216 | 216 | ||
217 | if (tb[FRA_SRC]) | 217 | if (tb[FRA_SRC]) |
218 | rule4->src = nla_get_u32(tb[FRA_SRC]); | 218 | rule4->src = nla_get_be32(tb[FRA_SRC]); |
219 | 219 | ||
220 | if (tb[FRA_DST]) | 220 | if (tb[FRA_DST]) |
221 | rule4->dst = nla_get_u32(tb[FRA_DST]); | 221 | rule4->dst = nla_get_be32(tb[FRA_DST]); |
222 | 222 | ||
223 | #ifdef CONFIG_IP_ROUTE_FWMARK | 223 | #ifdef CONFIG_IP_ROUTE_FWMARK |
224 | if (tb[FRA_FWMARK]) { | 224 | if (tb[FRA_FWMARK]) { |
@@ -277,10 +277,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, | |||
277 | return 0; | 277 | return 0; |
278 | #endif | 278 | #endif |
279 | 279 | ||
280 | if (tb[FRA_SRC] && (rule4->src != nla_get_u32(tb[FRA_SRC]))) | 280 | if (tb[FRA_SRC] && (rule4->src != nla_get_be32(tb[FRA_SRC]))) |
281 | return 0; | 281 | return 0; |
282 | 282 | ||
283 | if (tb[FRA_DST] && (rule4->dst != nla_get_u32(tb[FRA_DST]))) | 283 | if (tb[FRA_DST] && (rule4->dst != nla_get_be32(tb[FRA_DST]))) |
284 | return 0; | 284 | return 0; |
285 | 285 | ||
286 | return 1; | 286 | return 1; |
@@ -305,10 +305,10 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb, | |||
305 | #endif | 305 | #endif |
306 | 306 | ||
307 | if (rule4->dst_len) | 307 | if (rule4->dst_len) |
308 | NLA_PUT_U32(skb, FRA_DST, rule4->dst); | 308 | NLA_PUT_BE32(skb, FRA_DST, rule4->dst); |
309 | 309 | ||
310 | if (rule4->src_len) | 310 | if (rule4->src_len) |
311 | NLA_PUT_U32(skb, FRA_SRC, rule4->src); | 311 | NLA_PUT_BE32(skb, FRA_SRC, rule4->src); |
312 | 312 | ||
313 | #ifdef CONFIG_NET_CLS_ROUTE | 313 | #ifdef CONFIG_NET_CLS_ROUTE |
314 | if (rule4->tclassid) | 314 | if (rule4->tclassid) |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 2ead09543f68..884d176e0082 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -203,7 +203,7 @@ static inline unsigned int fib_info_hashfn(const struct fib_info *fi) | |||
203 | unsigned int val = fi->fib_nhs; | 203 | unsigned int val = fi->fib_nhs; |
204 | 204 | ||
205 | val ^= fi->fib_protocol; | 205 | val ^= fi->fib_protocol; |
206 | val ^= fi->fib_prefsrc; | 206 | val ^= (__force u32)fi->fib_prefsrc; |
207 | val ^= fi->fib_priority; | 207 | val ^= fi->fib_priority; |
208 | 208 | ||
209 | return (val ^ (val >> 7) ^ (val >> 12)) & mask; | 209 | return (val ^ (val >> 7) ^ (val >> 12)) & mask; |
@@ -248,7 +248,7 @@ static inline unsigned int fib_devindex_hashfn(unsigned int val) | |||
248 | Used only by redirect accept routine. | 248 | Used only by redirect accept routine. |
249 | */ | 249 | */ |
250 | 250 | ||
251 | int ip_fib_check_default(u32 gw, struct net_device *dev) | 251 | int ip_fib_check_default(__be32 gw, struct net_device *dev) |
252 | { | 252 | { |
253 | struct hlist_head *head; | 253 | struct hlist_head *head; |
254 | struct hlist_node *node; | 254 | struct hlist_node *node; |
@@ -273,7 +273,7 @@ int ip_fib_check_default(u32 gw, struct net_device *dev) | |||
273 | return -1; | 273 | return -1; |
274 | } | 274 | } |
275 | 275 | ||
276 | void rtmsg_fib(int event, u32 key, struct fib_alias *fa, | 276 | void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, |
277 | int dst_len, u32 tb_id, struct nl_info *info) | 277 | int dst_len, u32 tb_id, struct nl_info *info) |
278 | { | 278 | { |
279 | struct sk_buff *skb; | 279 | struct sk_buff *skb; |
@@ -374,7 +374,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, | |||
374 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); | 374 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); |
375 | 375 | ||
376 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); | 376 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); |
377 | nh->nh_gw = nla ? nla_get_u32(nla) : 0; | 377 | nh->nh_gw = nla ? nla_get_be32(nla) : 0; |
378 | #ifdef CONFIG_NET_CLS_ROUTE | 378 | #ifdef CONFIG_NET_CLS_ROUTE |
379 | nla = nla_find(attrs, attrlen, RTA_FLOW); | 379 | nla = nla_find(attrs, attrlen, RTA_FLOW); |
380 | nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; | 380 | nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; |
@@ -427,7 +427,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) | |||
427 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); | 427 | struct nlattr *nla, *attrs = rtnh_attrs(rtnh); |
428 | 428 | ||
429 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); | 429 | nla = nla_find(attrs, attrlen, RTA_GATEWAY); |
430 | if (nla && nla_get_u32(nla) != nh->nh_gw) | 430 | if (nla && nla_get_be32(nla) != nh->nh_gw) |
431 | return 1; | 431 | return 1; |
432 | #ifdef CONFIG_NET_CLS_ROUTE | 432 | #ifdef CONFIG_NET_CLS_ROUTE |
433 | nla = nla_find(attrs, attrlen, RTA_FLOW); | 433 | nla = nla_find(attrs, attrlen, RTA_FLOW); |
@@ -568,11 +568,11 @@ out: | |||
568 | return 0; | 568 | return 0; |
569 | } | 569 | } |
570 | 570 | ||
571 | static inline unsigned int fib_laddr_hashfn(u32 val) | 571 | static inline unsigned int fib_laddr_hashfn(__be32 val) |
572 | { | 572 | { |
573 | unsigned int mask = (fib_hash_size - 1); | 573 | unsigned int mask = (fib_hash_size - 1); |
574 | 574 | ||
575 | return (val ^ (val >> 7) ^ (val >> 14)) & mask; | 575 | return ((__force u32)val ^ ((__force u32)val >> 7) ^ ((__force u32)val >> 14)) & mask; |
576 | } | 576 | } |
577 | 577 | ||
578 | static struct hlist_head *fib_hash_alloc(int bytes) | 578 | static struct hlist_head *fib_hash_alloc(int bytes) |
@@ -847,7 +847,7 @@ failure: | |||
847 | 847 | ||
848 | /* Note! fib_semantic_match intentionally uses RCU list functions. */ | 848 | /* Note! fib_semantic_match intentionally uses RCU list functions. */ |
849 | int fib_semantic_match(struct list_head *head, const struct flowi *flp, | 849 | int fib_semantic_match(struct list_head *head, const struct flowi *flp, |
850 | struct fib_result *res, __u32 zone, __u32 mask, | 850 | struct fib_result *res, __be32 zone, __be32 mask, |
851 | int prefixlen) | 851 | int prefixlen) |
852 | { | 852 | { |
853 | struct fib_alias *fa; | 853 | struct fib_alias *fa; |
@@ -914,8 +914,7 @@ out_fill_res: | |||
914 | res->fi = fa->fa_info; | 914 | res->fi = fa->fa_info; |
915 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 915 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
916 | res->netmask = mask; | 916 | res->netmask = mask; |
917 | res->network = zone & | 917 | res->network = zone & inet_make_mask(prefixlen); |
918 | (0xFFFFFFFF >> (32 - prefixlen)); | ||
919 | #endif | 918 | #endif |
920 | atomic_inc(&res->fi->fib_clntref); | 919 | atomic_inc(&res->fi->fib_clntref); |
921 | return 0; | 920 | return 0; |
@@ -923,13 +922,13 @@ out_fill_res: | |||
923 | 922 | ||
924 | /* Find appropriate source address to this destination */ | 923 | /* Find appropriate source address to this destination */ |
925 | 924 | ||
926 | u32 __fib_res_prefsrc(struct fib_result *res) | 925 | __be32 __fib_res_prefsrc(struct fib_result *res) |
927 | { | 926 | { |
928 | return inet_select_addr(FIB_RES_DEV(*res), FIB_RES_GW(*res), res->scope); | 927 | return inet_select_addr(FIB_RES_DEV(*res), FIB_RES_GW(*res), res->scope); |
929 | } | 928 | } |
930 | 929 | ||
931 | int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | 930 | int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, |
932 | u32 tb_id, u8 type, u8 scope, u32 dst, int dst_len, u8 tos, | 931 | u32 tb_id, u8 type, u8 scope, __be32 dst, int dst_len, u8 tos, |
933 | struct fib_info *fi, unsigned int flags) | 932 | struct fib_info *fi, unsigned int flags) |
934 | { | 933 | { |
935 | struct nlmsghdr *nlh; | 934 | struct nlmsghdr *nlh; |
@@ -952,7 +951,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
952 | rtm->rtm_protocol = fi->fib_protocol; | 951 | rtm->rtm_protocol = fi->fib_protocol; |
953 | 952 | ||
954 | if (rtm->rtm_dst_len) | 953 | if (rtm->rtm_dst_len) |
955 | NLA_PUT_U32(skb, RTA_DST, dst); | 954 | NLA_PUT_BE32(skb, RTA_DST, dst); |
956 | 955 | ||
957 | if (fi->fib_priority) | 956 | if (fi->fib_priority) |
958 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); | 957 | NLA_PUT_U32(skb, RTA_PRIORITY, fi->fib_priority); |
@@ -961,11 +960,11 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
961 | goto nla_put_failure; | 960 | goto nla_put_failure; |
962 | 961 | ||
963 | if (fi->fib_prefsrc) | 962 | if (fi->fib_prefsrc) |
964 | NLA_PUT_U32(skb, RTA_PREFSRC, fi->fib_prefsrc); | 963 | NLA_PUT_BE32(skb, RTA_PREFSRC, fi->fib_prefsrc); |
965 | 964 | ||
966 | if (fi->fib_nhs == 1) { | 965 | if (fi->fib_nhs == 1) { |
967 | if (fi->fib_nh->nh_gw) | 966 | if (fi->fib_nh->nh_gw) |
968 | NLA_PUT_U32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); | 967 | NLA_PUT_BE32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw); |
969 | 968 | ||
970 | if (fi->fib_nh->nh_oif) | 969 | if (fi->fib_nh->nh_oif) |
971 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); | 970 | NLA_PUT_U32(skb, RTA_OIF, fi->fib_nh->nh_oif); |
@@ -993,7 +992,7 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
993 | rtnh->rtnh_ifindex = nh->nh_oif; | 992 | rtnh->rtnh_ifindex = nh->nh_oif; |
994 | 993 | ||
995 | if (nh->nh_gw) | 994 | if (nh->nh_gw) |
996 | NLA_PUT_U32(skb, RTA_GATEWAY, nh->nh_gw); | 995 | NLA_PUT_BE32(skb, RTA_GATEWAY, nh->nh_gw); |
997 | #ifdef CONFIG_NET_CLS_ROUTE | 996 | #ifdef CONFIG_NET_CLS_ROUTE |
998 | if (nh->nh_tclassid) | 997 | if (nh->nh_tclassid) |
999 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); | 998 | NLA_PUT_U32(skb, RTA_FLOW, nh->nh_tclassid); |
@@ -1018,7 +1017,7 @@ nla_put_failure: | |||
1018 | - device went down -> we must shutdown all nexthops going via it. | 1017 | - device went down -> we must shutdown all nexthops going via it. |
1019 | */ | 1018 | */ |
1020 | 1019 | ||
1021 | int fib_sync_down(u32 local, struct net_device *dev, int force) | 1020 | int fib_sync_down(__be32 local, struct net_device *dev, int force) |
1022 | { | 1021 | { |
1023 | int ret = 0; | 1022 | int ret = 0; |
1024 | int scope = RT_SCOPE_NOWHERE; | 1023 | int scope = RT_SCOPE_NOWHERE; |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 9c3ff6ba6e21..d17990ec724f 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1834,7 +1834,7 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah, struct fi | |||
1834 | int i, s_i; | 1834 | int i, s_i; |
1835 | struct fib_alias *fa; | 1835 | struct fib_alias *fa; |
1836 | 1836 | ||
1837 | u32 xkey = htonl(key); | 1837 | __be32 xkey = htonl(key); |
1838 | 1838 | ||
1839 | s_i = cb->args[4]; | 1839 | s_i = cb->args[4]; |
1840 | i = 0; | 1840 | i = 0; |
@@ -2281,7 +2281,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2281 | 2281 | ||
2282 | if (IS_TNODE(n)) { | 2282 | if (IS_TNODE(n)) { |
2283 | struct tnode *tn = (struct tnode *) n; | 2283 | struct tnode *tn = (struct tnode *) n; |
2284 | t_key prf = ntohl(MASK_PFX(tn->key, tn->pos)); | 2284 | __be32 prf = htonl(MASK_PFX(tn->key, tn->pos)); |
2285 | 2285 | ||
2286 | if (!NODE_PARENT(n)) { | 2286 | if (!NODE_PARENT(n)) { |
2287 | if (iter->trie == trie_local) | 2287 | if (iter->trie == trie_local) |
@@ -2297,7 +2297,7 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2297 | } else { | 2297 | } else { |
2298 | struct leaf *l = (struct leaf *) n; | 2298 | struct leaf *l = (struct leaf *) n; |
2299 | int i; | 2299 | int i; |
2300 | u32 val = ntohl(l->key); | 2300 | __be32 val = htonl(l->key); |
2301 | 2301 | ||
2302 | seq_indent(seq, iter->depth); | 2302 | seq_indent(seq, iter->depth); |
2303 | seq_printf(seq, " |-- %d.%d.%d.%d\n", NIPQUAD(val)); | 2303 | seq_printf(seq, " |-- %d.%d.%d.%d\n", NIPQUAD(val)); |
@@ -2360,7 +2360,7 @@ static struct file_operations fib_trie_fops = { | |||
2360 | .release = seq_release_private, | 2360 | .release = seq_release_private, |
2361 | }; | 2361 | }; |
2362 | 2362 | ||
2363 | static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi) | 2363 | static unsigned fib_flag_trans(int type, __be32 mask, const struct fib_info *fi) |
2364 | { | 2364 | { |
2365 | static unsigned type2flags[RTN_MAX + 1] = { | 2365 | static unsigned type2flags[RTN_MAX + 1] = { |
2366 | [7] = RTF_REJECT, [8] = RTF_REJECT, | 2366 | [7] = RTF_REJECT, [8] = RTF_REJECT, |
@@ -2369,7 +2369,7 @@ static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi) | |||
2369 | 2369 | ||
2370 | if (fi && fi->fib_nh->nh_gw) | 2370 | if (fi && fi->fib_nh->nh_gw) |
2371 | flags |= RTF_GATEWAY; | 2371 | flags |= RTF_GATEWAY; |
2372 | if (mask == 0xFFFFFFFF) | 2372 | if (mask == htonl(0xFFFFFFFF)) |
2373 | flags |= RTF_HOST; | 2373 | flags |= RTF_HOST; |
2374 | flags |= RTF_UP; | 2374 | flags |= RTF_UP; |
2375 | return flags; | 2375 | return flags; |
@@ -2403,7 +2403,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v) | |||
2403 | for (i=32; i>=0; i--) { | 2403 | for (i=32; i>=0; i--) { |
2404 | struct leaf_info *li = find_leaf_info(l, i); | 2404 | struct leaf_info *li = find_leaf_info(l, i); |
2405 | struct fib_alias *fa; | 2405 | struct fib_alias *fa; |
2406 | u32 mask, prefix; | 2406 | __be32 mask, prefix; |
2407 | 2407 | ||
2408 | if (!li) | 2408 | if (!li) |
2409 | continue; | 2409 | continue; |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index c2ad07e48ab4..b39a37a47545 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -104,7 +104,7 @@ struct icmp_bxm { | |||
104 | 104 | ||
105 | struct { | 105 | struct { |
106 | struct icmphdr icmph; | 106 | struct icmphdr icmph; |
107 | __u32 times[3]; | 107 | __be32 times[3]; |
108 | } data; | 108 | } data; |
109 | int head_len; | 109 | int head_len; |
110 | struct ip_options replyopts; | 110 | struct ip_options replyopts; |
@@ -381,7 +381,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) | |||
381 | struct inet_sock *inet = inet_sk(sk); | 381 | struct inet_sock *inet = inet_sk(sk); |
382 | struct ipcm_cookie ipc; | 382 | struct ipcm_cookie ipc; |
383 | struct rtable *rt = (struct rtable *)skb->dst; | 383 | struct rtable *rt = (struct rtable *)skb->dst; |
384 | u32 daddr; | 384 | __be32 daddr; |
385 | 385 | ||
386 | if (ip_options_echo(&icmp_param->replyopts, skb)) | 386 | if (ip_options_echo(&icmp_param->replyopts, skb)) |
387 | return; | 387 | return; |
@@ -430,14 +430,14 @@ out_unlock: | |||
430 | * MUST reply to only the first fragment. | 430 | * MUST reply to only the first fragment. |
431 | */ | 431 | */ |
432 | 432 | ||
433 | void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info) | 433 | void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) |
434 | { | 434 | { |
435 | struct iphdr *iph; | 435 | struct iphdr *iph; |
436 | int room; | 436 | int room; |
437 | struct icmp_bxm icmp_param; | 437 | struct icmp_bxm icmp_param; |
438 | struct rtable *rt = (struct rtable *)skb_in->dst; | 438 | struct rtable *rt = (struct rtable *)skb_in->dst; |
439 | struct ipcm_cookie ipc; | 439 | struct ipcm_cookie ipc; |
440 | u32 saddr; | 440 | __be32 saddr; |
441 | u8 tos; | 441 | u8 tos; |
442 | 442 | ||
443 | if (!rt) | 443 | if (!rt) |
@@ -895,7 +895,7 @@ static void icmp_address_reply(struct sk_buff *skb) | |||
895 | if (in_dev->ifa_list && | 895 | if (in_dev->ifa_list && |
896 | IN_DEV_LOG_MARTIANS(in_dev) && | 896 | IN_DEV_LOG_MARTIANS(in_dev) && |
897 | IN_DEV_FORWARD(in_dev)) { | 897 | IN_DEV_FORWARD(in_dev)) { |
898 | u32 _mask, *mp; | 898 | __be32 _mask, *mp; |
899 | 899 | ||
900 | mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); | 900 | mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); |
901 | BUG_ON(mp == NULL); | 901 | BUG_ON(mp == NULL); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 58be8227b0cb..6eee71647b7c 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -138,14 +138,14 @@ | |||
138 | time_before(jiffies, (in_dev)->mr_v2_seen))) | 138 | time_before(jiffies, (in_dev)->mr_v2_seen))) |
139 | 139 | ||
140 | static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im); | 140 | static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im); |
141 | static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr); | 141 | static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr); |
142 | static void igmpv3_clear_delrec(struct in_device *in_dev); | 142 | static void igmpv3_clear_delrec(struct in_device *in_dev); |
143 | static int sf_setstate(struct ip_mc_list *pmc); | 143 | static int sf_setstate(struct ip_mc_list *pmc); |
144 | static void sf_markstate(struct ip_mc_list *pmc); | 144 | static void sf_markstate(struct ip_mc_list *pmc); |
145 | #endif | 145 | #endif |
146 | static void ip_mc_clear_src(struct ip_mc_list *pmc); | 146 | static void ip_mc_clear_src(struct ip_mc_list *pmc); |
147 | static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode, | 147 | static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
148 | int sfcount, __u32 *psfsrc, int delta); | 148 | int sfcount, __be32 *psfsrc, int delta); |
149 | 149 | ||
150 | static void ip_ma_put(struct ip_mc_list *im) | 150 | static void ip_ma_put(struct ip_mc_list *im) |
151 | { | 151 | { |
@@ -426,7 +426,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
426 | first = 1; | 426 | first = 1; |
427 | psf_prev = NULL; | 427 | psf_prev = NULL; |
428 | for (psf=*psf_list; psf; psf=psf_next) { | 428 | for (psf=*psf_list; psf; psf=psf_next) { |
429 | u32 *psrc; | 429 | __be32 *psrc; |
430 | 430 | ||
431 | psf_next = psf->sf_next; | 431 | psf_next = psf->sf_next; |
432 | 432 | ||
@@ -439,7 +439,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
439 | if (isquery) | 439 | if (isquery) |
440 | psf->sf_gsresp = 0; | 440 | psf->sf_gsresp = 0; |
441 | 441 | ||
442 | if (AVAILABLE(skb) < sizeof(u32) + | 442 | if (AVAILABLE(skb) < sizeof(__be32) + |
443 | first*sizeof(struct igmpv3_grec)) { | 443 | first*sizeof(struct igmpv3_grec)) { |
444 | if (truncate && !first) | 444 | if (truncate && !first) |
445 | break; /* truncate these */ | 445 | break; /* truncate these */ |
@@ -455,7 +455,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
455 | skb = add_grhead(skb, pmc, type, &pgr); | 455 | skb = add_grhead(skb, pmc, type, &pgr); |
456 | first = 0; | 456 | first = 0; |
457 | } | 457 | } |
458 | psrc = (u32 *)skb_put(skb, sizeof(u32)); | 458 | psrc = (__be32 *)skb_put(skb, sizeof(__be32)); |
459 | *psrc = psf->sf_inaddr; | 459 | *psrc = psf->sf_inaddr; |
460 | scount++; stotal++; | 460 | scount++; stotal++; |
461 | if ((type == IGMPV3_ALLOW_NEW_SOURCES || | 461 | if ((type == IGMPV3_ALLOW_NEW_SOURCES || |
@@ -630,8 +630,8 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, | |||
630 | struct igmphdr *ih; | 630 | struct igmphdr *ih; |
631 | struct rtable *rt; | 631 | struct rtable *rt; |
632 | struct net_device *dev = in_dev->dev; | 632 | struct net_device *dev = in_dev->dev; |
633 | u32 group = pmc ? pmc->multiaddr : 0; | 633 | __be32 group = pmc ? pmc->multiaddr : 0; |
634 | u32 dst; | 634 | __be32 dst; |
635 | 635 | ||
636 | if (type == IGMPV3_HOST_MEMBERSHIP_REPORT) | 636 | if (type == IGMPV3_HOST_MEMBERSHIP_REPORT) |
637 | return igmpv3_send_report(in_dev, pmc); | 637 | return igmpv3_send_report(in_dev, pmc); |
@@ -748,7 +748,7 @@ static void igmp_timer_expire(unsigned long data) | |||
748 | } | 748 | } |
749 | 749 | ||
750 | /* mark EXCLUDE-mode sources */ | 750 | /* mark EXCLUDE-mode sources */ |
751 | static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | 751 | static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) |
752 | { | 752 | { |
753 | struct ip_sf_list *psf; | 753 | struct ip_sf_list *psf; |
754 | int i, scount; | 754 | int i, scount; |
@@ -775,7 +775,7 @@ static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | |||
775 | return 1; | 775 | return 1; |
776 | } | 776 | } |
777 | 777 | ||
778 | static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | 778 | static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) |
779 | { | 779 | { |
780 | struct ip_sf_list *psf; | 780 | struct ip_sf_list *psf; |
781 | int i, scount; | 781 | int i, scount; |
@@ -803,7 +803,7 @@ static int igmp_marksources(struct ip_mc_list *pmc, int nsrcs, __u32 *srcs) | |||
803 | return 1; | 803 | return 1; |
804 | } | 804 | } |
805 | 805 | ||
806 | static void igmp_heard_report(struct in_device *in_dev, u32 group) | 806 | static void igmp_heard_report(struct in_device *in_dev, __be32 group) |
807 | { | 807 | { |
808 | struct ip_mc_list *im; | 808 | struct ip_mc_list *im; |
809 | 809 | ||
@@ -828,7 +828,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
828 | struct igmphdr *ih = skb->h.igmph; | 828 | struct igmphdr *ih = skb->h.igmph; |
829 | struct igmpv3_query *ih3 = (struct igmpv3_query *)ih; | 829 | struct igmpv3_query *ih3 = (struct igmpv3_query *)ih; |
830 | struct ip_mc_list *im; | 830 | struct ip_mc_list *im; |
831 | u32 group = ih->group; | 831 | __be32 group = ih->group; |
832 | int max_delay; | 832 | int max_delay; |
833 | int mark = 0; | 833 | int mark = 0; |
834 | 834 | ||
@@ -862,7 +862,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
862 | ih3 = (struct igmpv3_query *) skb->h.raw; | 862 | ih3 = (struct igmpv3_query *) skb->h.raw; |
863 | if (ih3->nsrcs) { | 863 | if (ih3->nsrcs) { |
864 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) | 864 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) |
865 | + ntohs(ih3->nsrcs)*sizeof(__u32))) | 865 | + ntohs(ih3->nsrcs)*sizeof(__be32))) |
866 | return; | 866 | return; |
867 | ih3 = (struct igmpv3_query *) skb->h.raw; | 867 | ih3 = (struct igmpv3_query *) skb->h.raw; |
868 | } | 868 | } |
@@ -985,7 +985,7 @@ drop: | |||
985 | * Add a filter to a device | 985 | * Add a filter to a device |
986 | */ | 986 | */ |
987 | 987 | ||
988 | static void ip_mc_filter_add(struct in_device *in_dev, u32 addr) | 988 | static void ip_mc_filter_add(struct in_device *in_dev, __be32 addr) |
989 | { | 989 | { |
990 | char buf[MAX_ADDR_LEN]; | 990 | char buf[MAX_ADDR_LEN]; |
991 | struct net_device *dev = in_dev->dev; | 991 | struct net_device *dev = in_dev->dev; |
@@ -1005,7 +1005,7 @@ static void ip_mc_filter_add(struct in_device *in_dev, u32 addr) | |||
1005 | * Remove a filter from a device | 1005 | * Remove a filter from a device |
1006 | */ | 1006 | */ |
1007 | 1007 | ||
1008 | static void ip_mc_filter_del(struct in_device *in_dev, u32 addr) | 1008 | static void ip_mc_filter_del(struct in_device *in_dev, __be32 addr) |
1009 | { | 1009 | { |
1010 | char buf[MAX_ADDR_LEN]; | 1010 | char buf[MAX_ADDR_LEN]; |
1011 | struct net_device *dev = in_dev->dev; | 1011 | struct net_device *dev = in_dev->dev; |
@@ -1055,7 +1055,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) | |||
1055 | spin_unlock_bh(&in_dev->mc_tomb_lock); | 1055 | spin_unlock_bh(&in_dev->mc_tomb_lock); |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr) | 1058 | static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr) |
1059 | { | 1059 | { |
1060 | struct ip_mc_list *pmc, *pmc_prev; | 1060 | struct ip_mc_list *pmc, *pmc_prev; |
1061 | struct ip_sf_list *psf, *psf_next; | 1061 | struct ip_sf_list *psf, *psf_next; |
@@ -1193,7 +1193,7 @@ static void igmp_group_added(struct ip_mc_list *im) | |||
1193 | * A socket has joined a multicast group on device dev. | 1193 | * A socket has joined a multicast group on device dev. |
1194 | */ | 1194 | */ |
1195 | 1195 | ||
1196 | void ip_mc_inc_group(struct in_device *in_dev, u32 addr) | 1196 | void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) |
1197 | { | 1197 | { |
1198 | struct ip_mc_list *im; | 1198 | struct ip_mc_list *im; |
1199 | 1199 | ||
@@ -1252,7 +1252,7 @@ out: | |||
1252 | * A socket has left a multicast group on device dev | 1252 | * A socket has left a multicast group on device dev |
1253 | */ | 1253 | */ |
1254 | 1254 | ||
1255 | void ip_mc_dec_group(struct in_device *in_dev, u32 addr) | 1255 | void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) |
1256 | { | 1256 | { |
1257 | struct ip_mc_list *i, **ip; | 1257 | struct ip_mc_list *i, **ip; |
1258 | 1258 | ||
@@ -1402,7 +1402,7 @@ int sysctl_igmp_max_msf __read_mostly = IP_MAX_MSF; | |||
1402 | 1402 | ||
1403 | 1403 | ||
1404 | static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, | 1404 | static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, |
1405 | __u32 *psfsrc) | 1405 | __be32 *psfsrc) |
1406 | { | 1406 | { |
1407 | struct ip_sf_list *psf, *psf_prev; | 1407 | struct ip_sf_list *psf, *psf_prev; |
1408 | int rv = 0; | 1408 | int rv = 0; |
@@ -1450,8 +1450,8 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, | |||
1450 | #define igmp_ifc_event(x) do { } while (0) | 1450 | #define igmp_ifc_event(x) do { } while (0) |
1451 | #endif | 1451 | #endif |
1452 | 1452 | ||
1453 | static int ip_mc_del_src(struct in_device *in_dev, __u32 *pmca, int sfmode, | 1453 | static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
1454 | int sfcount, __u32 *psfsrc, int delta) | 1454 | int sfcount, __be32 *psfsrc, int delta) |
1455 | { | 1455 | { |
1456 | struct ip_mc_list *pmc; | 1456 | struct ip_mc_list *pmc; |
1457 | int changerec = 0; | 1457 | int changerec = 0; |
@@ -1517,7 +1517,7 @@ out_unlock: | |||
1517 | * Add multicast single-source filter to the interface list | 1517 | * Add multicast single-source filter to the interface list |
1518 | */ | 1518 | */ |
1519 | static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, | 1519 | static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, |
1520 | __u32 *psfsrc, int delta) | 1520 | __be32 *psfsrc, int delta) |
1521 | { | 1521 | { |
1522 | struct ip_sf_list *psf, *psf_prev; | 1522 | struct ip_sf_list *psf, *psf_prev; |
1523 | 1523 | ||
@@ -1623,8 +1623,8 @@ static int sf_setstate(struct ip_mc_list *pmc) | |||
1623 | /* | 1623 | /* |
1624 | * Add multicast source filter list to the interface list | 1624 | * Add multicast source filter list to the interface list |
1625 | */ | 1625 | */ |
1626 | static int ip_mc_add_src(struct in_device *in_dev, __u32 *pmca, int sfmode, | 1626 | static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
1627 | int sfcount, __u32 *psfsrc, int delta) | 1627 | int sfcount, __be32 *psfsrc, int delta) |
1628 | { | 1628 | { |
1629 | struct ip_mc_list *pmc; | 1629 | struct ip_mc_list *pmc; |
1630 | int isexclude; | 1630 | int isexclude; |
@@ -1717,7 +1717,7 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc) | |||
1717 | int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) | 1717 | int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) |
1718 | { | 1718 | { |
1719 | int err; | 1719 | int err; |
1720 | u32 addr = imr->imr_multiaddr.s_addr; | 1720 | __be32 addr = imr->imr_multiaddr.s_addr; |
1721 | struct ip_mc_socklist *iml=NULL, *i; | 1721 | struct ip_mc_socklist *iml=NULL, *i; |
1722 | struct in_device *in_dev; | 1722 | struct in_device *in_dev; |
1723 | struct inet_sock *inet = inet_sk(sk); | 1723 | struct inet_sock *inet = inet_sk(sk); |
@@ -1791,7 +1791,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) | |||
1791 | struct inet_sock *inet = inet_sk(sk); | 1791 | struct inet_sock *inet = inet_sk(sk); |
1792 | struct ip_mc_socklist *iml, **imlp; | 1792 | struct ip_mc_socklist *iml, **imlp; |
1793 | struct in_device *in_dev; | 1793 | struct in_device *in_dev; |
1794 | u32 group = imr->imr_multiaddr.s_addr; | 1794 | __be32 group = imr->imr_multiaddr.s_addr; |
1795 | u32 ifindex; | 1795 | u32 ifindex; |
1796 | int ret = -EADDRNOTAVAIL; | 1796 | int ret = -EADDRNOTAVAIL; |
1797 | 1797 | ||
@@ -1829,7 +1829,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1829 | { | 1829 | { |
1830 | int err; | 1830 | int err; |
1831 | struct ip_mreqn imr; | 1831 | struct ip_mreqn imr; |
1832 | u32 addr = mreqs->imr_multiaddr; | 1832 | __be32 addr = mreqs->imr_multiaddr; |
1833 | struct ip_mc_socklist *pmc; | 1833 | struct ip_mc_socklist *pmc; |
1834 | struct in_device *in_dev = NULL; | 1834 | struct in_device *in_dev = NULL; |
1835 | struct inet_sock *inet = inet_sk(sk); | 1835 | struct inet_sock *inet = inet_sk(sk); |
@@ -1883,7 +1883,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1883 | rv = !0; | 1883 | rv = !0; |
1884 | for (i=0; i<psl->sl_count; i++) { | 1884 | for (i=0; i<psl->sl_count; i++) { |
1885 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, | 1885 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, |
1886 | sizeof(__u32)); | 1886 | sizeof(__be32)); |
1887 | if (rv == 0) | 1887 | if (rv == 0) |
1888 | break; | 1888 | break; |
1889 | } | 1889 | } |
@@ -1935,7 +1935,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1935 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ | 1935 | rv = 1; /* > 0 for insert logic below if sl_count is 0 */ |
1936 | for (i=0; i<psl->sl_count; i++) { | 1936 | for (i=0; i<psl->sl_count; i++) { |
1937 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, | 1937 | rv = memcmp(&psl->sl_addr[i], &mreqs->imr_sourceaddr, |
1938 | sizeof(__u32)); | 1938 | sizeof(__be32)); |
1939 | if (rv == 0) | 1939 | if (rv == 0) |
1940 | break; | 1940 | break; |
1941 | } | 1941 | } |
@@ -1960,7 +1960,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex) | |||
1960 | { | 1960 | { |
1961 | int err = 0; | 1961 | int err = 0; |
1962 | struct ip_mreqn imr; | 1962 | struct ip_mreqn imr; |
1963 | u32 addr = msf->imsf_multiaddr; | 1963 | __be32 addr = msf->imsf_multiaddr; |
1964 | struct ip_mc_socklist *pmc; | 1964 | struct ip_mc_socklist *pmc; |
1965 | struct in_device *in_dev; | 1965 | struct in_device *in_dev; |
1966 | struct inet_sock *inet = inet_sk(sk); | 1966 | struct inet_sock *inet = inet_sk(sk); |
@@ -2044,7 +2044,7 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, | |||
2044 | { | 2044 | { |
2045 | int err, len, count, copycount; | 2045 | int err, len, count, copycount; |
2046 | struct ip_mreqn imr; | 2046 | struct ip_mreqn imr; |
2047 | u32 addr = msf->imsf_multiaddr; | 2047 | __be32 addr = msf->imsf_multiaddr; |
2048 | struct ip_mc_socklist *pmc; | 2048 | struct ip_mc_socklist *pmc; |
2049 | struct in_device *in_dev; | 2049 | struct in_device *in_dev; |
2050 | struct inet_sock *inet = inet_sk(sk); | 2050 | struct inet_sock *inet = inet_sk(sk); |
@@ -2103,7 +2103,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | |||
2103 | { | 2103 | { |
2104 | int err, i, count, copycount; | 2104 | int err, i, count, copycount; |
2105 | struct sockaddr_in *psin; | 2105 | struct sockaddr_in *psin; |
2106 | u32 addr; | 2106 | __be32 addr; |
2107 | struct ip_mc_socklist *pmc; | 2107 | struct ip_mc_socklist *pmc; |
2108 | struct inet_sock *inet = inet_sk(sk); | 2108 | struct inet_sock *inet = inet_sk(sk); |
2109 | struct ip_sf_socklist *psl; | 2109 | struct ip_sf_socklist *psl; |
@@ -2156,7 +2156,7 @@ done: | |||
2156 | /* | 2156 | /* |
2157 | * check if a multicast source filter allows delivery for a given <src,dst,intf> | 2157 | * check if a multicast source filter allows delivery for a given <src,dst,intf> |
2158 | */ | 2158 | */ |
2159 | int ip_mc_sf_allow(struct sock *sk, u32 loc_addr, u32 rmt_addr, int dif) | 2159 | int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif) |
2160 | { | 2160 | { |
2161 | struct inet_sock *inet = inet_sk(sk); | 2161 | struct inet_sock *inet = inet_sk(sk); |
2162 | struct ip_mc_socklist *pmc; | 2162 | struct ip_mc_socklist *pmc; |
@@ -2216,7 +2216,7 @@ void ip_mc_drop_socket(struct sock *sk) | |||
2216 | rtnl_unlock(); | 2216 | rtnl_unlock(); |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | int ip_check_mc(struct in_device *in_dev, u32 mc_addr, u32 src_addr, u16 proto) | 2219 | int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto) |
2220 | { | 2220 | { |
2221 | struct ip_mc_list *im; | 2221 | struct ip_mc_list *im; |
2222 | struct ip_sf_list *psf; | 2222 | struct ip_sf_list *psf; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 07204391d083..96bbe2a0aa1b 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -39,7 +39,7 @@ int sysctl_local_port_range[2] = { 1024, 4999 }; | |||
39 | int inet_csk_bind_conflict(const struct sock *sk, | 39 | int inet_csk_bind_conflict(const struct sock *sk, |
40 | const struct inet_bind_bucket *tb) | 40 | const struct inet_bind_bucket *tb) |
41 | { | 41 | { |
42 | const u32 sk_rcv_saddr = inet_rcv_saddr(sk); | 42 | const __be32 sk_rcv_saddr = inet_rcv_saddr(sk); |
43 | struct sock *sk2; | 43 | struct sock *sk2; |
44 | struct hlist_node *node; | 44 | struct hlist_node *node; |
45 | int reuse = sk->sk_reuse; | 45 | int reuse = sk->sk_reuse; |
@@ -52,7 +52,7 @@ int inet_csk_bind_conflict(const struct sock *sk, | |||
52 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { | 52 | sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { |
53 | if (!reuse || !sk2->sk_reuse || | 53 | if (!reuse || !sk2->sk_reuse || |
54 | sk2->sk_state == TCP_LISTEN) { | 54 | sk2->sk_state == TCP_LISTEN) { |
55 | const u32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | 55 | const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); |
56 | if (!sk2_rcv_saddr || !sk_rcv_saddr || | 56 | if (!sk2_rcv_saddr || !sk_rcv_saddr || |
57 | sk2_rcv_saddr == sk_rcv_saddr) | 57 | sk2_rcv_saddr == sk_rcv_saddr) |
58 | break; | 58 | break; |
@@ -342,10 +342,10 @@ struct dst_entry* inet_csk_route_req(struct sock *sk, | |||
342 | 342 | ||
343 | EXPORT_SYMBOL_GPL(inet_csk_route_req); | 343 | EXPORT_SYMBOL_GPL(inet_csk_route_req); |
344 | 344 | ||
345 | static inline u32 inet_synq_hash(const u32 raddr, const u16 rport, | 345 | static inline u32 inet_synq_hash(const __be32 raddr, const __be16 rport, |
346 | const u32 rnd, const u16 synq_hsize) | 346 | const u32 rnd, const u16 synq_hsize) |
347 | { | 347 | { |
348 | return jhash_2words(raddr, (u32)rport, rnd) & (synq_hsize - 1); | 348 | return jhash_2words((__force u32)raddr, (__force u32)rport, rnd) & (synq_hsize - 1); |
349 | } | 349 | } |
350 | 350 | ||
351 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 351 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -356,8 +356,8 @@ static inline u32 inet_synq_hash(const u32 raddr, const u16 rport, | |||
356 | 356 | ||
357 | struct request_sock *inet_csk_search_req(const struct sock *sk, | 357 | struct request_sock *inet_csk_search_req(const struct sock *sk, |
358 | struct request_sock ***prevp, | 358 | struct request_sock ***prevp, |
359 | const __u16 rport, const __u32 raddr, | 359 | const __be16 rport, const __be32 raddr, |
360 | const __u32 laddr) | 360 | const __be32 laddr) |
361 | { | 361 | { |
362 | const struct inet_connection_sock *icsk = inet_csk(sk); | 362 | const struct inet_connection_sock *icsk = inet_csk(sk); |
363 | struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; | 363 | struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 492858e6faf0..77761ac4f7bb 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -36,8 +36,8 @@ | |||
36 | static const struct inet_diag_handler **inet_diag_table; | 36 | static const struct inet_diag_handler **inet_diag_table; |
37 | 37 | ||
38 | struct inet_diag_entry { | 38 | struct inet_diag_entry { |
39 | u32 *saddr; | 39 | __be32 *saddr; |
40 | u32 *daddr; | 40 | __be32 *daddr; |
41 | u16 sport; | 41 | u16 sport; |
42 | u16 dport; | 42 | u16 dport; |
43 | u16 family; | 43 | u16 family; |
@@ -294,7 +294,7 @@ out: | |||
294 | return err; | 294 | return err; |
295 | } | 295 | } |
296 | 296 | ||
297 | static int bitstring_match(const u32 *a1, const u32 *a2, int bits) | 297 | static int bitstring_match(const __be32 *a1, const __be32 *a2, int bits) |
298 | { | 298 | { |
299 | int words = bits >> 5; | 299 | int words = bits >> 5; |
300 | 300 | ||
@@ -305,8 +305,8 @@ static int bitstring_match(const u32 *a1, const u32 *a2, int bits) | |||
305 | return 0; | 305 | return 0; |
306 | } | 306 | } |
307 | if (bits) { | 307 | if (bits) { |
308 | __u32 w1, w2; | 308 | __be32 w1, w2; |
309 | __u32 mask; | 309 | __be32 mask; |
310 | 310 | ||
311 | w1 = a1[words]; | 311 | w1 = a1[words]; |
312 | w2 = a2[words]; | 312 | w2 = a2[words]; |
@@ -352,7 +352,7 @@ static int inet_diag_bc_run(const void *bc, int len, | |||
352 | case INET_DIAG_BC_S_COND: | 352 | case INET_DIAG_BC_S_COND: |
353 | case INET_DIAG_BC_D_COND: { | 353 | case INET_DIAG_BC_D_COND: { |
354 | struct inet_diag_hostcond *cond; | 354 | struct inet_diag_hostcond *cond; |
355 | u32 *addr; | 355 | __be32 *addr; |
356 | 356 | ||
357 | cond = (struct inet_diag_hostcond *)(op + 1); | 357 | cond = (struct inet_diag_hostcond *)(op + 1); |
358 | if (cond->port != -1 && | 358 | if (cond->port != -1 && |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index fb296c9a7f3f..244c4f445c7d 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -125,7 +125,7 @@ EXPORT_SYMBOL(inet_listen_wlock); | |||
125 | * wildcarded during the search since they can never be otherwise. | 125 | * wildcarded during the search since they can never be otherwise. |
126 | */ | 126 | */ |
127 | static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, | 127 | static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, |
128 | const u32 daddr, | 128 | const __be32 daddr, |
129 | const unsigned short hnum, | 129 | const unsigned short hnum, |
130 | const int dif) | 130 | const int dif) |
131 | { | 131 | { |
@@ -137,7 +137,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, | |||
137 | const struct inet_sock *inet = inet_sk(sk); | 137 | const struct inet_sock *inet = inet_sk(sk); |
138 | 138 | ||
139 | if (inet->num == hnum && !ipv6_only_sock(sk)) { | 139 | if (inet->num == hnum && !ipv6_only_sock(sk)) { |
140 | const __u32 rcv_saddr = inet->rcv_saddr; | 140 | const __be32 rcv_saddr = inet->rcv_saddr; |
141 | int score = sk->sk_family == PF_INET ? 1 : 0; | 141 | int score = sk->sk_family == PF_INET ? 1 : 0; |
142 | 142 | ||
143 | if (rcv_saddr) { | 143 | if (rcv_saddr) { |
@@ -163,7 +163,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, | |||
163 | 163 | ||
164 | /* Optimize the common listener case. */ | 164 | /* Optimize the common listener case. */ |
165 | struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, | 165 | struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, |
166 | const u32 daddr, const unsigned short hnum, | 166 | const __be32 daddr, const unsigned short hnum, |
167 | const int dif) | 167 | const int dif) |
168 | { | 168 | { |
169 | struct sock *sk = NULL; | 169 | struct sock *sk = NULL; |
@@ -197,11 +197,11 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, | |||
197 | { | 197 | { |
198 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 198 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
199 | struct inet_sock *inet = inet_sk(sk); | 199 | struct inet_sock *inet = inet_sk(sk); |
200 | u32 daddr = inet->rcv_saddr; | 200 | __be32 daddr = inet->rcv_saddr; |
201 | u32 saddr = inet->daddr; | 201 | __be32 saddr = inet->daddr; |
202 | int dif = sk->sk_bound_dev_if; | 202 | int dif = sk->sk_bound_dev_if; |
203 | INET_ADDR_COOKIE(acookie, saddr, daddr) | 203 | INET_ADDR_COOKIE(acookie, saddr, daddr) |
204 | const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); | 204 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
205 | unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); | 205 | unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); |
206 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 206 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
207 | struct sock *sk2; | 207 | struct sock *sk2; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index a675602ef295..2b1a54b59c48 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -163,7 +163,7 @@ static void unlink_from_unused(struct inet_peer *p) | |||
163 | for (u = peer_root; u != peer_avl_empty; ) { \ | 163 | for (u = peer_root; u != peer_avl_empty; ) { \ |
164 | if (daddr == u->v4daddr) \ | 164 | if (daddr == u->v4daddr) \ |
165 | break; \ | 165 | break; \ |
166 | if (daddr < u->v4daddr) \ | 166 | if ((__force __u32)daddr < (__force __u32)u->v4daddr) \ |
167 | v = &u->avl_left; \ | 167 | v = &u->avl_left; \ |
168 | else \ | 168 | else \ |
169 | v = &u->avl_right; \ | 169 | v = &u->avl_right; \ |
@@ -368,7 +368,7 @@ static int cleanup_once(unsigned long ttl) | |||
368 | } | 368 | } |
369 | 369 | ||
370 | /* Called with or without local BH being disabled. */ | 370 | /* Called with or without local BH being disabled. */ |
371 | struct inet_peer *inet_getpeer(__u32 daddr, int create) | 371 | struct inet_peer *inet_getpeer(__be32 daddr, int create) |
372 | { | 372 | { |
373 | struct inet_peer *p, *n; | 373 | struct inet_peer *p, *n; |
374 | struct inet_peer **stack[PEER_MAXDEPTH], ***stackptr; | 374 | struct inet_peer **stack[PEER_MAXDEPTH], ***stackptr; |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 165d72859ddf..74046efdf875 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -77,9 +77,9 @@ struct ipq { | |||
77 | struct hlist_node list; | 77 | struct hlist_node list; |
78 | struct list_head lru_list; /* lru list member */ | 78 | struct list_head lru_list; /* lru list member */ |
79 | u32 user; | 79 | u32 user; |
80 | u32 saddr; | 80 | __be32 saddr; |
81 | u32 daddr; | 81 | __be32 daddr; |
82 | u16 id; | 82 | __be16 id; |
83 | u8 protocol; | 83 | u8 protocol; |
84 | u8 last_in; | 84 | u8 last_in; |
85 | #define COMPLETE 4 | 85 | #define COMPLETE 4 |
@@ -123,9 +123,10 @@ static __inline__ void ipq_unlink(struct ipq *ipq) | |||
123 | write_unlock(&ipfrag_lock); | 123 | write_unlock(&ipfrag_lock); |
124 | } | 124 | } |
125 | 125 | ||
126 | static unsigned int ipqhashfn(u16 id, u32 saddr, u32 daddr, u8 prot) | 126 | static unsigned int ipqhashfn(__be16 id, __be32 saddr, __be32 daddr, u8 prot) |
127 | { | 127 | { |
128 | return jhash_3words((u32)id << 16 | prot, saddr, daddr, | 128 | return jhash_3words((__force u32)id << 16 | prot, |
129 | (__force u32)saddr, (__force u32)daddr, | ||
129 | ipfrag_hash_rnd) & (IPQ_HASHSZ - 1); | 130 | ipfrag_hash_rnd) & (IPQ_HASHSZ - 1); |
130 | } | 131 | } |
131 | 132 | ||
@@ -387,8 +388,8 @@ out_nomem: | |||
387 | static inline struct ipq *ip_find(struct iphdr *iph, u32 user) | 388 | static inline struct ipq *ip_find(struct iphdr *iph, u32 user) |
388 | { | 389 | { |
389 | __be16 id = iph->id; | 390 | __be16 id = iph->id; |
390 | __u32 saddr = iph->saddr; | 391 | __be32 saddr = iph->saddr; |
391 | __u32 daddr = iph->daddr; | 392 | __be32 daddr = iph->daddr; |
392 | __u8 protocol = iph->protocol; | 393 | __u8 protocol = iph->protocol; |
393 | unsigned int hash; | 394 | unsigned int hash; |
394 | struct ipq *qp; | 395 | struct ipq *qp; |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index e7437c091326..8dabbfc31267 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -38,7 +38,7 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | void ip_options_build(struct sk_buff * skb, struct ip_options * opt, | 40 | void ip_options_build(struct sk_buff * skb, struct ip_options * opt, |
41 | u32 daddr, struct rtable *rt, int is_frag) | 41 | __be32 daddr, struct rtable *rt, int is_frag) |
42 | { | 42 | { |
43 | unsigned char * iph = skb->nh.raw; | 43 | unsigned char * iph = skb->nh.raw; |
44 | 44 | ||
@@ -57,7 +57,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, | |||
57 | ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); | 57 | ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, rt); |
58 | if (opt->ts_needtime) { | 58 | if (opt->ts_needtime) { |
59 | struct timeval tv; | 59 | struct timeval tv; |
60 | __u32 midtime; | 60 | __be32 midtime; |
61 | do_gettimeofday(&tv); | 61 | do_gettimeofday(&tv); |
62 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); | 62 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); |
63 | memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); | 63 | memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); |
@@ -91,7 +91,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
91 | unsigned char *sptr, *dptr; | 91 | unsigned char *sptr, *dptr; |
92 | int soffset, doffset; | 92 | int soffset, doffset; |
93 | int optlen; | 93 | int optlen; |
94 | u32 daddr; | 94 | __be32 daddr; |
95 | 95 | ||
96 | memset(dopt, 0, sizeof(struct ip_options)); | 96 | memset(dopt, 0, sizeof(struct ip_options)); |
97 | 97 | ||
@@ -148,7 +148,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
148 | dopt->ts_needtime = 0; | 148 | dopt->ts_needtime = 0; |
149 | 149 | ||
150 | if (soffset + 8 <= optlen) { | 150 | if (soffset + 8 <= optlen) { |
151 | __u32 addr; | 151 | __be32 addr; |
152 | 152 | ||
153 | memcpy(&addr, sptr+soffset-1, 4); | 153 | memcpy(&addr, sptr+soffset-1, 4); |
154 | if (inet_addr_type(addr) != RTN_LOCAL) { | 154 | if (inet_addr_type(addr) != RTN_LOCAL) { |
@@ -165,7 +165,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
165 | } | 165 | } |
166 | if (sopt->srr) { | 166 | if (sopt->srr) { |
167 | unsigned char * start = sptr+sopt->srr; | 167 | unsigned char * start = sptr+sopt->srr; |
168 | u32 faddr; | 168 | __be32 faddr; |
169 | 169 | ||
170 | optlen = start[1]; | 170 | optlen = start[1]; |
171 | soffset = start[2]; | 171 | soffset = start[2]; |
@@ -362,7 +362,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
362 | goto error; | 362 | goto error; |
363 | } | 363 | } |
364 | if (optptr[2] <= optlen) { | 364 | if (optptr[2] <= optlen) { |
365 | __u32 * timeptr = NULL; | 365 | __be32 *timeptr = NULL; |
366 | if (optptr[2]+3 > optptr[1]) { | 366 | if (optptr[2]+3 > optptr[1]) { |
367 | pp_ptr = optptr + 2; | 367 | pp_ptr = optptr + 2; |
368 | goto error; | 368 | goto error; |
@@ -371,7 +371,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
371 | case IPOPT_TS_TSONLY: | 371 | case IPOPT_TS_TSONLY: |
372 | opt->ts = optptr - iph; | 372 | opt->ts = optptr - iph; |
373 | if (skb) | 373 | if (skb) |
374 | timeptr = (__u32*)&optptr[optptr[2]-1]; | 374 | timeptr = (__be32*)&optptr[optptr[2]-1]; |
375 | opt->ts_needtime = 1; | 375 | opt->ts_needtime = 1; |
376 | optptr[2] += 4; | 376 | optptr[2] += 4; |
377 | break; | 377 | break; |
@@ -383,7 +383,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
383 | opt->ts = optptr - iph; | 383 | opt->ts = optptr - iph; |
384 | if (skb) { | 384 | if (skb) { |
385 | memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); | 385 | memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4); |
386 | timeptr = (__u32*)&optptr[optptr[2]+3]; | 386 | timeptr = (__be32*)&optptr[optptr[2]+3]; |
387 | } | 387 | } |
388 | opt->ts_needaddr = 1; | 388 | opt->ts_needaddr = 1; |
389 | opt->ts_needtime = 1; | 389 | opt->ts_needtime = 1; |
@@ -396,12 +396,12 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
396 | } | 396 | } |
397 | opt->ts = optptr - iph; | 397 | opt->ts = optptr - iph; |
398 | { | 398 | { |
399 | u32 addr; | 399 | __be32 addr; |
400 | memcpy(&addr, &optptr[optptr[2]-1], 4); | 400 | memcpy(&addr, &optptr[optptr[2]-1], 4); |
401 | if (inet_addr_type(addr) == RTN_UNICAST) | 401 | if (inet_addr_type(addr) == RTN_UNICAST) |
402 | break; | 402 | break; |
403 | if (skb) | 403 | if (skb) |
404 | timeptr = (__u32*)&optptr[optptr[2]+3]; | 404 | timeptr = (__be32*)&optptr[optptr[2]+3]; |
405 | } | 405 | } |
406 | opt->ts_needtime = 1; | 406 | opt->ts_needtime = 1; |
407 | optptr[2] += 8; | 407 | optptr[2] += 8; |
@@ -415,10 +415,10 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) | |||
415 | } | 415 | } |
416 | if (timeptr) { | 416 | if (timeptr) { |
417 | struct timeval tv; | 417 | struct timeval tv; |
418 | __u32 midtime; | 418 | __be32 midtime; |
419 | do_gettimeofday(&tv); | 419 | do_gettimeofday(&tv); |
420 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); | 420 | midtime = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000); |
421 | memcpy(timeptr, &midtime, sizeof(__u32)); | 421 | memcpy(timeptr, &midtime, sizeof(__be32)); |
422 | opt->is_changed = 1; | 422 | opt->is_changed = 1; |
423 | } | 423 | } |
424 | } else { | 424 | } else { |
@@ -607,7 +607,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
607 | { | 607 | { |
608 | struct ip_options *opt = &(IPCB(skb)->opt); | 608 | struct ip_options *opt = &(IPCB(skb)->opt); |
609 | int srrspace, srrptr; | 609 | int srrspace, srrptr; |
610 | u32 nexthop; | 610 | __be32 nexthop; |
611 | struct iphdr *iph = skb->nh.iph; | 611 | struct iphdr *iph = skb->nh.iph; |
612 | unsigned char * optptr = skb->nh.raw + opt->srr; | 612 | unsigned char * optptr = skb->nh.raw + opt->srr; |
613 | struct rtable *rt = (struct rtable*)skb->dst; | 613 | struct rtable *rt = (struct rtable*)skb->dst; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 97aee76fb746..fc195a44fc2e 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -118,7 +118,7 @@ static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) | |||
118 | * | 118 | * |
119 | */ | 119 | */ |
120 | int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 120 | int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, |
121 | u32 saddr, u32 daddr, struct ip_options *opt) | 121 | __be32 saddr, __be32 daddr, struct ip_options *opt) |
122 | { | 122 | { |
123 | struct inet_sock *inet = inet_sk(sk); | 123 | struct inet_sock *inet = inet_sk(sk); |
124 | struct rtable *rt = (struct rtable *)skb->dst; | 124 | struct rtable *rt = (struct rtable *)skb->dst; |
@@ -306,7 +306,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
306 | /* Make sure we can route this packet. */ | 306 | /* Make sure we can route this packet. */ |
307 | rt = (struct rtable *)__sk_dst_check(sk, 0); | 307 | rt = (struct rtable *)__sk_dst_check(sk, 0); |
308 | if (rt == NULL) { | 308 | if (rt == NULL) { |
309 | u32 daddr; | 309 | __be32 daddr; |
310 | 310 | ||
311 | /* Use correct destination address if we have options. */ | 311 | /* Use correct destination address if we have options. */ |
312 | daddr = inet->daddr; | 312 | daddr = inet->daddr; |
@@ -1340,7 +1340,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1340 | char data[40]; | 1340 | char data[40]; |
1341 | } replyopts; | 1341 | } replyopts; |
1342 | struct ipcm_cookie ipc; | 1342 | struct ipcm_cookie ipc; |
1343 | u32 daddr; | 1343 | __be32 daddr; |
1344 | struct rtable *rt = (struct rtable*)skb->dst; | 1344 | struct rtable *rt = (struct rtable*)skb->dst; |
1345 | 1345 | ||
1346 | if (ip_options_echo(&replyopts.opt, skb)) | 1346 | if (ip_options_echo(&replyopts.opt, skb)) |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 2d05c4133d3e..4b132953bcc2 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -254,7 +254,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s | |||
254 | } | 254 | } |
255 | 255 | ||
256 | void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | 256 | void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, |
257 | u16 port, u32 info, u8 *payload) | 257 | __be16 port, u32 info, u8 *payload) |
258 | { | 258 | { |
259 | struct inet_sock *inet = inet_sk(sk); | 259 | struct inet_sock *inet = inet_sk(sk); |
260 | struct sock_exterr_skb *serr; | 260 | struct sock_exterr_skb *serr; |
@@ -283,7 +283,7 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | |||
283 | kfree_skb(skb); | 283 | kfree_skb(skb); |
284 | } | 284 | } |
285 | 285 | ||
286 | void ip_local_error(struct sock *sk, int err, u32 daddr, u16 port, u32 info) | 286 | void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 info) |
287 | { | 287 | { |
288 | struct inet_sock *inet = inet_sk(sk); | 288 | struct inet_sock *inet = inet_sk(sk); |
289 | struct sock_exterr_skb *serr; | 289 | struct sock_exterr_skb *serr; |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 17342430a843..2017d36024d4 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -183,7 +183,7 @@ out_ok: | |||
183 | 183 | ||
184 | static void ipcomp4_err(struct sk_buff *skb, u32 info) | 184 | static void ipcomp4_err(struct sk_buff *skb, u32 info) |
185 | { | 185 | { |
186 | u32 spi; | 186 | __be32 spi; |
187 | struct iphdr *iph = (struct iphdr *)skb->data; | 187 | struct iphdr *iph = (struct iphdr *)skb->data; |
188 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); | 188 | struct ip_comp_hdr *ipch = (struct ip_comp_hdr *)(skb->data+(iph->ihl<<2)); |
189 | struct xfrm_state *x; | 189 | struct xfrm_state *x; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index ba49588da242..97cfa97c8abb 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -462,7 +462,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||
465 | static struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp) | 465 | static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp) |
466 | { | 466 | { |
467 | int line=MFC_HASH(mcastgrp,origin); | 467 | int line=MFC_HASH(mcastgrp,origin); |
468 | struct mfc_cache *c; | 468 | struct mfc_cache *c; |
@@ -1097,7 +1097,7 @@ static struct notifier_block ip_mr_notifier={ | |||
1097 | * important for multicast video. | 1097 | * important for multicast video. |
1098 | */ | 1098 | */ |
1099 | 1099 | ||
1100 | static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr) | 1100 | static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) |
1101 | { | 1101 | { |
1102 | struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); | 1102 | struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); |
1103 | 1103 | ||
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c index 87b83813cf2c..8832eb517d52 100644 --- a/net/ipv4/ipvs/ip_vs_conn.c +++ b/net/ipv4/ipvs/ip_vs_conn.c | |||
@@ -115,9 +115,9 @@ static inline void ct_write_unlock_bh(unsigned key) | |||
115 | /* | 115 | /* |
116 | * Returns hash value for IPVS connection entry | 116 | * Returns hash value for IPVS connection entry |
117 | */ | 117 | */ |
118 | static unsigned int ip_vs_conn_hashkey(unsigned proto, __u32 addr, __u16 port) | 118 | static unsigned int ip_vs_conn_hashkey(unsigned proto, __be32 addr, __be16 port) |
119 | { | 119 | { |
120 | return jhash_3words(addr, port, proto, ip_vs_conn_rnd) | 120 | return jhash_3words((__force u32)addr, (__force u32)port, proto, ip_vs_conn_rnd) |
121 | & IP_VS_CONN_TAB_MASK; | 121 | & IP_VS_CONN_TAB_MASK; |
122 | } | 122 | } |
123 | 123 | ||
@@ -188,7 +188,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp) | |||
188 | * d_addr, d_port: pkt dest address (load balancer) | 188 | * d_addr, d_port: pkt dest address (load balancer) |
189 | */ | 189 | */ |
190 | static inline struct ip_vs_conn *__ip_vs_conn_in_get | 190 | static inline struct ip_vs_conn *__ip_vs_conn_in_get |
191 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 191 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
192 | { | 192 | { |
193 | unsigned hash; | 193 | unsigned hash; |
194 | struct ip_vs_conn *cp; | 194 | struct ip_vs_conn *cp; |
@@ -215,7 +215,7 @@ static inline struct ip_vs_conn *__ip_vs_conn_in_get | |||
215 | } | 215 | } |
216 | 216 | ||
217 | struct ip_vs_conn *ip_vs_conn_in_get | 217 | struct ip_vs_conn *ip_vs_conn_in_get |
218 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 218 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
219 | { | 219 | { |
220 | struct ip_vs_conn *cp; | 220 | struct ip_vs_conn *cp; |
221 | 221 | ||
@@ -234,7 +234,7 @@ struct ip_vs_conn *ip_vs_conn_in_get | |||
234 | 234 | ||
235 | /* Get reference to connection template */ | 235 | /* Get reference to connection template */ |
236 | struct ip_vs_conn *ip_vs_ct_in_get | 236 | struct ip_vs_conn *ip_vs_ct_in_get |
237 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 237 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
238 | { | 238 | { |
239 | unsigned hash; | 239 | unsigned hash; |
240 | struct ip_vs_conn *cp; | 240 | struct ip_vs_conn *cp; |
@@ -274,7 +274,7 @@ struct ip_vs_conn *ip_vs_ct_in_get | |||
274 | * d_addr, d_port: pkt dest address (foreign host) | 274 | * d_addr, d_port: pkt dest address (foreign host) |
275 | */ | 275 | */ |
276 | struct ip_vs_conn *ip_vs_conn_out_get | 276 | struct ip_vs_conn *ip_vs_conn_out_get |
277 | (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port) | 277 | (int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port) |
278 | { | 278 | { |
279 | unsigned hash; | 279 | unsigned hash; |
280 | struct ip_vs_conn *cp, *ret=NULL; | 280 | struct ip_vs_conn *cp, *ret=NULL; |
@@ -324,7 +324,7 @@ void ip_vs_conn_put(struct ip_vs_conn *cp) | |||
324 | /* | 324 | /* |
325 | * Fill a no_client_port connection with a client port number | 325 | * Fill a no_client_port connection with a client port number |
326 | */ | 326 | */ |
327 | void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport) | 327 | void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport) |
328 | { | 328 | { |
329 | if (ip_vs_conn_unhash(cp)) { | 329 | if (ip_vs_conn_unhash(cp)) { |
330 | spin_lock(&cp->lock); | 330 | spin_lock(&cp->lock); |
@@ -508,10 +508,10 @@ int ip_vs_check_template(struct ip_vs_conn *ct) | |||
508 | /* | 508 | /* |
509 | * Invalidate the connection template | 509 | * Invalidate the connection template |
510 | */ | 510 | */ |
511 | if (ct->vport != 65535) { | 511 | if (ct->vport != htons(0xffff)) { |
512 | if (ip_vs_conn_unhash(ct)) { | 512 | if (ip_vs_conn_unhash(ct)) { |
513 | ct->dport = 65535; | 513 | ct->dport = htons(0xffff); |
514 | ct->vport = 65535; | 514 | ct->vport = htons(0xffff); |
515 | ct->cport = 0; | 515 | ct->cport = 0; |
516 | ip_vs_conn_hash(ct); | 516 | ip_vs_conn_hash(ct); |
517 | } | 517 | } |
@@ -596,8 +596,8 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp) | |||
596 | * Create a new connection entry and hash it into the ip_vs_conn_tab | 596 | * Create a new connection entry and hash it into the ip_vs_conn_tab |
597 | */ | 597 | */ |
598 | struct ip_vs_conn * | 598 | struct ip_vs_conn * |
599 | ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport, | 599 | ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport, |
600 | __u32 daddr, __u16 dport, unsigned flags, | 600 | __be32 daddr, __be16 dport, unsigned flags, |
601 | struct ip_vs_dest *dest) | 601 | struct ip_vs_dest *dest) |
602 | { | 602 | { |
603 | struct ip_vs_conn *cp; | 603 | struct ip_vs_conn *cp; |
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 3f47ad8e1cad..6dee03935f78 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c | |||
@@ -209,14 +209,14 @@ int ip_vs_make_skb_writable(struct sk_buff **pskb, int writable_len) | |||
209 | static struct ip_vs_conn * | 209 | static struct ip_vs_conn * |
210 | ip_vs_sched_persist(struct ip_vs_service *svc, | 210 | ip_vs_sched_persist(struct ip_vs_service *svc, |
211 | const struct sk_buff *skb, | 211 | const struct sk_buff *skb, |
212 | __u16 ports[2]) | 212 | __be16 ports[2]) |
213 | { | 213 | { |
214 | struct ip_vs_conn *cp = NULL; | 214 | struct ip_vs_conn *cp = NULL; |
215 | struct iphdr *iph = skb->nh.iph; | 215 | struct iphdr *iph = skb->nh.iph; |
216 | struct ip_vs_dest *dest; | 216 | struct ip_vs_dest *dest; |
217 | struct ip_vs_conn *ct; | 217 | struct ip_vs_conn *ct; |
218 | __u16 dport; /* destination port to forward */ | 218 | __be16 dport; /* destination port to forward */ |
219 | __u32 snet; /* source network of the client, after masking */ | 219 | __be32 snet; /* source network of the client, after masking */ |
220 | 220 | ||
221 | /* Mask saddr with the netmask to adjust template granularity */ | 221 | /* Mask saddr with the netmask to adjust template granularity */ |
222 | snet = iph->saddr & svc->netmask; | 222 | snet = iph->saddr & svc->netmask; |
@@ -383,7 +383,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
383 | struct ip_vs_conn *cp = NULL; | 383 | struct ip_vs_conn *cp = NULL; |
384 | struct iphdr *iph = skb->nh.iph; | 384 | struct iphdr *iph = skb->nh.iph; |
385 | struct ip_vs_dest *dest; | 385 | struct ip_vs_dest *dest; |
386 | __u16 _ports[2], *pptr; | 386 | __be16 _ports[2], *pptr; |
387 | 387 | ||
388 | pptr = skb_header_pointer(skb, iph->ihl*4, | 388 | pptr = skb_header_pointer(skb, iph->ihl*4, |
389 | sizeof(_ports), _ports); | 389 | sizeof(_ports), _ports); |
@@ -446,7 +446,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
446 | int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, | 446 | int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
447 | struct ip_vs_protocol *pp) | 447 | struct ip_vs_protocol *pp) |
448 | { | 448 | { |
449 | __u16 _ports[2], *pptr; | 449 | __be16 _ports[2], *pptr; |
450 | struct iphdr *iph = skb->nh.iph; | 450 | struct iphdr *iph = skb->nh.iph; |
451 | 451 | ||
452 | pptr = skb_header_pointer(skb, iph->ihl*4, | 452 | pptr = skb_header_pointer(skb, iph->ihl*4, |
@@ -576,7 +576,7 @@ void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
576 | 576 | ||
577 | /* the TCP/UDP port */ | 577 | /* the TCP/UDP port */ |
578 | if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol) { | 578 | if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol) { |
579 | __u16 *ports = (void *)ciph + ciph->ihl*4; | 579 | __be16 *ports = (void *)ciph + ciph->ihl*4; |
580 | 580 | ||
581 | if (inout) | 581 | if (inout) |
582 | ports[1] = cp->vport; | 582 | ports[1] = cp->vport; |
@@ -775,7 +775,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, | |||
775 | if (sysctl_ip_vs_nat_icmp_send && | 775 | if (sysctl_ip_vs_nat_icmp_send && |
776 | (pp->protocol == IPPROTO_TCP || | 776 | (pp->protocol == IPPROTO_TCP || |
777 | pp->protocol == IPPROTO_UDP)) { | 777 | pp->protocol == IPPROTO_UDP)) { |
778 | __u16 _ports[2], *pptr; | 778 | __be16 _ports[2], *pptr; |
779 | 779 | ||
780 | pptr = skb_header_pointer(skb, ihl, | 780 | pptr = skb_header_pointer(skb, ihl, |
781 | sizeof(_ports), _ports); | 781 | sizeof(_ports), _ports); |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 6a28fafe910c..f261616e4602 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -283,7 +283,7 @@ static atomic_t ip_vs_nullsvc_counter = ATOMIC_INIT(0); | |||
283 | * Returns hash value for virtual service | 283 | * Returns hash value for virtual service |
284 | */ | 284 | */ |
285 | static __inline__ unsigned | 285 | static __inline__ unsigned |
286 | ip_vs_svc_hashkey(unsigned proto, __u32 addr, __u16 port) | 286 | ip_vs_svc_hashkey(unsigned proto, __be32 addr, __be16 port) |
287 | { | 287 | { |
288 | register unsigned porth = ntohs(port); | 288 | register unsigned porth = ntohs(port); |
289 | 289 | ||
@@ -365,7 +365,7 @@ static int ip_vs_svc_unhash(struct ip_vs_service *svc) | |||
365 | * Get service by {proto,addr,port} in the service table. | 365 | * Get service by {proto,addr,port} in the service table. |
366 | */ | 366 | */ |
367 | static __inline__ struct ip_vs_service * | 367 | static __inline__ struct ip_vs_service * |
368 | __ip_vs_service_get(__u16 protocol, __u32 vaddr, __u16 vport) | 368 | __ip_vs_service_get(__u16 protocol, __be32 vaddr, __be16 vport) |
369 | { | 369 | { |
370 | unsigned hash; | 370 | unsigned hash; |
371 | struct ip_vs_service *svc; | 371 | struct ip_vs_service *svc; |
@@ -410,7 +410,7 @@ static __inline__ struct ip_vs_service *__ip_vs_svc_fwm_get(__u32 fwmark) | |||
410 | } | 410 | } |
411 | 411 | ||
412 | struct ip_vs_service * | 412 | struct ip_vs_service * |
413 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport) | 413 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport) |
414 | { | 414 | { |
415 | struct ip_vs_service *svc; | 415 | struct ip_vs_service *svc; |
416 | 416 | ||
@@ -480,7 +480,7 @@ __ip_vs_unbind_svc(struct ip_vs_dest *dest) | |||
480 | /* | 480 | /* |
481 | * Returns hash value for real service | 481 | * Returns hash value for real service |
482 | */ | 482 | */ |
483 | static __inline__ unsigned ip_vs_rs_hashkey(__u32 addr, __u16 port) | 483 | static __inline__ unsigned ip_vs_rs_hashkey(__be32 addr, __be16 port) |
484 | { | 484 | { |
485 | register unsigned porth = ntohs(port); | 485 | register unsigned porth = ntohs(port); |
486 | 486 | ||
@@ -531,7 +531,7 @@ static int ip_vs_rs_unhash(struct ip_vs_dest *dest) | |||
531 | * Lookup real service by <proto,addr,port> in the real service table. | 531 | * Lookup real service by <proto,addr,port> in the real service table. |
532 | */ | 532 | */ |
533 | struct ip_vs_dest * | 533 | struct ip_vs_dest * |
534 | ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport) | 534 | ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport) |
535 | { | 535 | { |
536 | unsigned hash; | 536 | unsigned hash; |
537 | struct ip_vs_dest *dest; | 537 | struct ip_vs_dest *dest; |
@@ -562,7 +562,7 @@ ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport) | |||
562 | * Lookup destination by {addr,port} in the given service | 562 | * Lookup destination by {addr,port} in the given service |
563 | */ | 563 | */ |
564 | static struct ip_vs_dest * | 564 | static struct ip_vs_dest * |
565 | ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) | 565 | ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport) |
566 | { | 566 | { |
567 | struct ip_vs_dest *dest; | 567 | struct ip_vs_dest *dest; |
568 | 568 | ||
@@ -591,7 +591,7 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) | |||
591 | * scheduling. | 591 | * scheduling. |
592 | */ | 592 | */ |
593 | static struct ip_vs_dest * | 593 | static struct ip_vs_dest * |
594 | ip_vs_trash_get_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport) | 594 | ip_vs_trash_get_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport) |
595 | { | 595 | { |
596 | struct ip_vs_dest *dest, *nxt; | 596 | struct ip_vs_dest *dest, *nxt; |
597 | 597 | ||
@@ -773,8 +773,8 @@ static int | |||
773 | ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) | 773 | ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) |
774 | { | 774 | { |
775 | struct ip_vs_dest *dest; | 775 | struct ip_vs_dest *dest; |
776 | __u32 daddr = udest->addr; | 776 | __be32 daddr = udest->addr; |
777 | __u16 dport = udest->port; | 777 | __be16 dport = udest->port; |
778 | int ret; | 778 | int ret; |
779 | 779 | ||
780 | EnterFunction(2); | 780 | EnterFunction(2); |
@@ -879,8 +879,8 @@ static int | |||
879 | ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) | 879 | ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest) |
880 | { | 880 | { |
881 | struct ip_vs_dest *dest; | 881 | struct ip_vs_dest *dest; |
882 | __u32 daddr = udest->addr; | 882 | __be32 daddr = udest->addr; |
883 | __u16 dport = udest->port; | 883 | __be16 dport = udest->port; |
884 | 884 | ||
885 | EnterFunction(2); | 885 | EnterFunction(2); |
886 | 886 | ||
@@ -991,8 +991,8 @@ static int | |||
991 | ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest) | 991 | ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest) |
992 | { | 992 | { |
993 | struct ip_vs_dest *dest; | 993 | struct ip_vs_dest *dest; |
994 | __u32 daddr = udest->addr; | 994 | __be32 daddr = udest->addr; |
995 | __u16 dport = udest->port; | 995 | __be16 dport = udest->port; |
996 | 996 | ||
997 | EnterFunction(2); | 997 | EnterFunction(2); |
998 | 998 | ||
diff --git a/net/ipv4/ipvs/ip_vs_dh.c b/net/ipv4/ipvs/ip_vs_dh.c index 9fee19c4c617..502111fba872 100644 --- a/net/ipv4/ipvs/ip_vs_dh.c +++ b/net/ipv4/ipvs/ip_vs_dh.c | |||
@@ -66,7 +66,7 @@ struct ip_vs_dh_bucket { | |||
66 | /* | 66 | /* |
67 | * Returns hash value for IPVS DH entry | 67 | * Returns hash value for IPVS DH entry |
68 | */ | 68 | */ |
69 | static inline unsigned ip_vs_dh_hashkey(__u32 addr) | 69 | static inline unsigned ip_vs_dh_hashkey(__be32 addr) |
70 | { | 70 | { |
71 | return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK; | 71 | return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK; |
72 | } | 72 | } |
@@ -76,7 +76,7 @@ static inline unsigned ip_vs_dh_hashkey(__u32 addr) | |||
76 | * Get ip_vs_dest associated with supplied parameters. | 76 | * Get ip_vs_dest associated with supplied parameters. |
77 | */ | 77 | */ |
78 | static inline struct ip_vs_dest * | 78 | static inline struct ip_vs_dest * |
79 | ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __u32 addr) | 79 | ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __be32 addr) |
80 | { | 80 | { |
81 | return (tbl[ip_vs_dh_hashkey(addr)]).dest; | 81 | return (tbl[ip_vs_dh_hashkey(addr)]).dest; |
82 | } | 82 | } |
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c index 37fafb1fbcff..e433cb0ff894 100644 --- a/net/ipv4/ipvs/ip_vs_ftp.c +++ b/net/ipv4/ipvs/ip_vs_ftp.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
33 | #include <net/protocol.h> | 33 | #include <net/protocol.h> |
34 | #include <net/tcp.h> | 34 | #include <net/tcp.h> |
35 | #include <asm/unaligned.h> | ||
35 | 36 | ||
36 | #include <net/ip_vs.h> | 37 | #include <net/ip_vs.h> |
37 | 38 | ||
@@ -44,8 +45,8 @@ | |||
44 | * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper | 45 | * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper |
45 | * First port is set to the default port. | 46 | * First port is set to the default port. |
46 | */ | 47 | */ |
47 | static int ports[IP_VS_APP_MAX_PORTS] = {21, 0}; | 48 | static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; |
48 | module_param_array(ports, int, NULL, 0); | 49 | module_param_array(ports, ushort, NULL, 0); |
49 | MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); | 50 | MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); |
50 | 51 | ||
51 | 52 | ||
@@ -74,7 +75,7 @@ ip_vs_ftp_done_conn(struct ip_vs_app *app, struct ip_vs_conn *cp) | |||
74 | */ | 75 | */ |
75 | static int ip_vs_ftp_get_addrport(char *data, char *data_limit, | 76 | static int ip_vs_ftp_get_addrport(char *data, char *data_limit, |
76 | const char *pattern, size_t plen, char term, | 77 | const char *pattern, size_t plen, char term, |
77 | __u32 *addr, __u16 *port, | 78 | __be32 *addr, __be16 *port, |
78 | char **start, char **end) | 79 | char **start, char **end) |
79 | { | 80 | { |
80 | unsigned char p[6]; | 81 | unsigned char p[6]; |
@@ -114,8 +115,8 @@ static int ip_vs_ftp_get_addrport(char *data, char *data_limit, | |||
114 | if (i != 5) | 115 | if (i != 5) |
115 | return -1; | 116 | return -1; |
116 | 117 | ||
117 | *addr = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0]; | 118 | *addr = get_unaligned((__be32 *)p); |
118 | *port = (p[5]<<8) | p[4]; | 119 | *port = get_unaligned((__be16 *)(p + 4)); |
119 | return 1; | 120 | return 1; |
120 | } | 121 | } |
121 | 122 | ||
@@ -140,8 +141,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
140 | struct tcphdr *th; | 141 | struct tcphdr *th; |
141 | char *data, *data_limit; | 142 | char *data, *data_limit; |
142 | char *start, *end; | 143 | char *start, *end; |
143 | __u32 from; | 144 | __be32 from; |
144 | __u16 port; | 145 | __be16 port; |
145 | struct ip_vs_conn *n_cp; | 146 | struct ip_vs_conn *n_cp; |
146 | char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */ | 147 | char buf[24]; /* xxx.xxx.xxx.xxx,ppp,ppp\000 */ |
147 | unsigned buf_len; | 148 | unsigned buf_len; |
@@ -199,7 +200,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
199 | from = n_cp->vaddr; | 200 | from = n_cp->vaddr; |
200 | port = n_cp->vport; | 201 | port = n_cp->vport; |
201 | sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from), | 202 | sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from), |
202 | port&255, (port>>8)&255); | 203 | ntohs(port)&255, (ntohs(port)>>8)&255); |
203 | buf_len = strlen(buf); | 204 | buf_len = strlen(buf); |
204 | 205 | ||
205 | /* | 206 | /* |
@@ -243,8 +244,8 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, | |||
243 | struct tcphdr *th; | 244 | struct tcphdr *th; |
244 | char *data, *data_start, *data_limit; | 245 | char *data, *data_start, *data_limit; |
245 | char *start, *end; | 246 | char *start, *end; |
246 | __u32 to; | 247 | __be32 to; |
247 | __u16 port; | 248 | __be16 port; |
248 | struct ip_vs_conn *n_cp; | 249 | struct ip_vs_conn *n_cp; |
249 | 250 | ||
250 | /* no diff required for incoming packets */ | 251 | /* no diff required for incoming packets */ |
@@ -365,12 +366,6 @@ static int __init ip_vs_ftp_init(void) | |||
365 | for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { | 366 | for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { |
366 | if (!ports[i]) | 367 | if (!ports[i]) |
367 | continue; | 368 | continue; |
368 | if (ports[i] < 0 || ports[i] > 0xffff) { | ||
369 | IP_VS_WARNING("ip_vs_ftp: Ignoring invalid " | ||
370 | "configuration port[%d] = %d\n", | ||
371 | i, ports[i]); | ||
372 | continue; | ||
373 | } | ||
374 | ret = register_ip_vs_app_inc(app, app->protocol, ports[i]); | 369 | ret = register_ip_vs_app_inc(app, app->protocol, ports[i]); |
375 | if (ret) | 370 | if (ret) |
376 | break; | 371 | break; |
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index 6e5cb92a5c83..524751e031de 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c | |||
@@ -87,7 +87,7 @@ static int sysctl_ip_vs_lblc_expiration = 24*60*60*HZ; | |||
87 | */ | 87 | */ |
88 | struct ip_vs_lblc_entry { | 88 | struct ip_vs_lblc_entry { |
89 | struct list_head list; | 89 | struct list_head list; |
90 | __u32 addr; /* destination IP address */ | 90 | __be32 addr; /* destination IP address */ |
91 | struct ip_vs_dest *dest; /* real server (cache) */ | 91 | struct ip_vs_dest *dest; /* real server (cache) */ |
92 | unsigned long lastuse; /* last used time */ | 92 | unsigned long lastuse; /* last used time */ |
93 | }; | 93 | }; |
@@ -160,7 +160,7 @@ static struct ctl_table_header * sysctl_header; | |||
160 | * IP address to a server. | 160 | * IP address to a server. |
161 | */ | 161 | */ |
162 | static inline struct ip_vs_lblc_entry * | 162 | static inline struct ip_vs_lblc_entry * |
163 | ip_vs_lblc_new(__u32 daddr, struct ip_vs_dest *dest) | 163 | ip_vs_lblc_new(__be32 daddr, struct ip_vs_dest *dest) |
164 | { | 164 | { |
165 | struct ip_vs_lblc_entry *en; | 165 | struct ip_vs_lblc_entry *en; |
166 | 166 | ||
@@ -195,7 +195,7 @@ static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en) | |||
195 | /* | 195 | /* |
196 | * Returns hash value for IPVS LBLC entry | 196 | * Returns hash value for IPVS LBLC entry |
197 | */ | 197 | */ |
198 | static inline unsigned ip_vs_lblc_hashkey(__u32 addr) | 198 | static inline unsigned ip_vs_lblc_hashkey(__be32 addr) |
199 | { | 199 | { |
200 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK; | 200 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK; |
201 | } | 201 | } |
@@ -234,7 +234,7 @@ ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en) | |||
234 | * Get ip_vs_lblc_entry associated with supplied parameters. | 234 | * Get ip_vs_lblc_entry associated with supplied parameters. |
235 | */ | 235 | */ |
236 | static inline struct ip_vs_lblc_entry * | 236 | static inline struct ip_vs_lblc_entry * |
237 | ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __u32 addr) | 237 | ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __be32 addr) |
238 | { | 238 | { |
239 | unsigned hash; | 239 | unsigned hash; |
240 | struct ip_vs_lblc_entry *en; | 240 | struct ip_vs_lblc_entry *en; |
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index 32ba37ba72d8..08990192b6ec 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c | |||
@@ -276,7 +276,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set) | |||
276 | */ | 276 | */ |
277 | struct ip_vs_lblcr_entry { | 277 | struct ip_vs_lblcr_entry { |
278 | struct list_head list; | 278 | struct list_head list; |
279 | __u32 addr; /* destination IP address */ | 279 | __be32 addr; /* destination IP address */ |
280 | struct ip_vs_dest_set set; /* destination server set */ | 280 | struct ip_vs_dest_set set; /* destination server set */ |
281 | unsigned long lastuse; /* last used time */ | 281 | unsigned long lastuse; /* last used time */ |
282 | }; | 282 | }; |
@@ -348,7 +348,7 @@ static struct ctl_table_header * sysctl_header; | |||
348 | * new/free a ip_vs_lblcr_entry, which is a mapping of a destination | 348 | * new/free a ip_vs_lblcr_entry, which is a mapping of a destination |
349 | * IP address to a server. | 349 | * IP address to a server. |
350 | */ | 350 | */ |
351 | static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__u32 daddr) | 351 | static inline struct ip_vs_lblcr_entry *ip_vs_lblcr_new(__be32 daddr) |
352 | { | 352 | { |
353 | struct ip_vs_lblcr_entry *en; | 353 | struct ip_vs_lblcr_entry *en; |
354 | 354 | ||
@@ -381,7 +381,7 @@ static inline void ip_vs_lblcr_free(struct ip_vs_lblcr_entry *en) | |||
381 | /* | 381 | /* |
382 | * Returns hash value for IPVS LBLCR entry | 382 | * Returns hash value for IPVS LBLCR entry |
383 | */ | 383 | */ |
384 | static inline unsigned ip_vs_lblcr_hashkey(__u32 addr) | 384 | static inline unsigned ip_vs_lblcr_hashkey(__be32 addr) |
385 | { | 385 | { |
386 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLCR_TAB_MASK; | 386 | return (ntohl(addr)*2654435761UL) & IP_VS_LBLCR_TAB_MASK; |
387 | } | 387 | } |
@@ -420,7 +420,7 @@ ip_vs_lblcr_hash(struct ip_vs_lblcr_table *tbl, struct ip_vs_lblcr_entry *en) | |||
420 | * Get ip_vs_lblcr_entry associated with supplied parameters. | 420 | * Get ip_vs_lblcr_entry associated with supplied parameters. |
421 | */ | 421 | */ |
422 | static inline struct ip_vs_lblcr_entry * | 422 | static inline struct ip_vs_lblcr_entry * |
423 | ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __u32 addr) | 423 | ip_vs_lblcr_get(struct ip_vs_lblcr_table *tbl, __be32 addr) |
424 | { | 424 | { |
425 | unsigned hash; | 425 | unsigned hash; |
426 | struct ip_vs_lblcr_entry *en; | 426 | struct ip_vs_lblcr_entry *en; |
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c index 867d4e9c6594..c4528b5c800d 100644 --- a/net/ipv4/ipvs/ip_vs_proto.c +++ b/net/ipv4/ipvs/ip_vs_proto.c | |||
@@ -176,7 +176,7 @@ ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, | |||
176 | pp->name, NIPQUAD(ih->saddr), | 176 | pp->name, NIPQUAD(ih->saddr), |
177 | NIPQUAD(ih->daddr)); | 177 | NIPQUAD(ih->daddr)); |
178 | else { | 178 | else { |
179 | __u16 _ports[2], *pptr | 179 | __be16 _ports[2], *pptr |
180 | ; | 180 | ; |
181 | pptr = skb_header_pointer(skb, offset + ih->ihl*4, | 181 | pptr = skb_header_pointer(skb, offset + ih->ihl*4, |
182 | sizeof(_ports), _ports); | 182 | sizeof(_ports), _ports); |
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c index 820e8318d10d..bfe779e74590 100644 --- a/net/ipv4/ipvs/ip_vs_proto_tcp.c +++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c | |||
@@ -29,7 +29,7 @@ static struct ip_vs_conn * | |||
29 | tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | 29 | tcp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, |
30 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 30 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
31 | { | 31 | { |
32 | __u16 _ports[2], *pptr; | 32 | __be16 _ports[2], *pptr; |
33 | 33 | ||
34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); | 34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); |
35 | if (pptr == NULL) | 35 | if (pptr == NULL) |
@@ -50,7 +50,7 @@ static struct ip_vs_conn * | |||
50 | tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | 50 | tcp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, |
51 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 51 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
52 | { | 52 | { |
53 | __u16 _ports[2], *pptr; | 53 | __be16 _ports[2], *pptr; |
54 | 54 | ||
55 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); | 55 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); |
56 | if (pptr == NULL) | 56 | if (pptr == NULL) |
@@ -112,12 +112,12 @@ tcp_conn_schedule(struct sk_buff *skb, | |||
112 | 112 | ||
113 | 113 | ||
114 | static inline void | 114 | static inline void |
115 | tcp_fast_csum_update(struct tcphdr *tcph, u32 oldip, u32 newip, | 115 | tcp_fast_csum_update(struct tcphdr *tcph, __be32 oldip, __be32 newip, |
116 | u16 oldport, u16 newport) | 116 | __be16 oldport, __be16 newport) |
117 | { | 117 | { |
118 | tcph->check = | 118 | tcph->check = |
119 | ip_vs_check_diff(~oldip, newip, | 119 | ip_vs_check_diff(~oldip, newip, |
120 | ip_vs_check_diff(oldport ^ 0xFFFF, | 120 | ip_vs_check_diff(oldport ^ htonl(0xFFFF), |
121 | newport, tcph->check)); | 121 | newport, tcph->check)); |
122 | } | 122 | } |
123 | 123 | ||
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c index 90c8166c0ec1..54aa7603591f 100644 --- a/net/ipv4/ipvs/ip_vs_proto_udp.c +++ b/net/ipv4/ipvs/ip_vs_proto_udp.c | |||
@@ -29,7 +29,7 @@ udp_conn_in_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
29 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 29 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
30 | { | 30 | { |
31 | struct ip_vs_conn *cp; | 31 | struct ip_vs_conn *cp; |
32 | __u16 _ports[2], *pptr; | 32 | __be16 _ports[2], *pptr; |
33 | 33 | ||
34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); | 34 | pptr = skb_header_pointer(skb, proto_off, sizeof(_ports), _ports); |
35 | if (pptr == NULL) | 35 | if (pptr == NULL) |
@@ -54,7 +54,7 @@ udp_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
54 | const struct iphdr *iph, unsigned int proto_off, int inverse) | 54 | const struct iphdr *iph, unsigned int proto_off, int inverse) |
55 | { | 55 | { |
56 | struct ip_vs_conn *cp; | 56 | struct ip_vs_conn *cp; |
57 | __u16 _ports[2], *pptr; | 57 | __be16 _ports[2], *pptr; |
58 | 58 | ||
59 | pptr = skb_header_pointer(skb, skb->nh.iph->ihl*4, | 59 | pptr = skb_header_pointer(skb, skb->nh.iph->ihl*4, |
60 | sizeof(_ports), _ports); | 60 | sizeof(_ports), _ports); |
@@ -117,15 +117,15 @@ udp_conn_schedule(struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
117 | 117 | ||
118 | 118 | ||
119 | static inline void | 119 | static inline void |
120 | udp_fast_csum_update(struct udphdr *uhdr, u32 oldip, u32 newip, | 120 | udp_fast_csum_update(struct udphdr *uhdr, __be32 oldip, __be32 newip, |
121 | u16 oldport, u16 newport) | 121 | __be16 oldport, __be16 newport) |
122 | { | 122 | { |
123 | uhdr->check = | 123 | uhdr->check = |
124 | ip_vs_check_diff(~oldip, newip, | 124 | ip_vs_check_diff(~oldip, newip, |
125 | ip_vs_check_diff(oldport ^ 0xFFFF, | 125 | ip_vs_check_diff(oldport ^ htonl(0xFFFF), |
126 | newport, uhdr->check)); | 126 | newport, uhdr->check)); |
127 | if (!uhdr->check) | 127 | if (!uhdr->check) |
128 | uhdr->check = 0xFFFF; | 128 | uhdr->check = htonl(0xFFFF); |
129 | } | 129 | } |
130 | 130 | ||
131 | static int | 131 | static int |
@@ -173,7 +173,7 @@ udp_snat_handler(struct sk_buff **pskb, | |||
173 | cp->protocol, | 173 | cp->protocol, |
174 | (*pskb)->csum); | 174 | (*pskb)->csum); |
175 | if (udph->check == 0) | 175 | if (udph->check == 0) |
176 | udph->check = 0xFFFF; | 176 | udph->check = htonl(0xFFFF); |
177 | IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n", | 177 | IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n", |
178 | pp->name, udph->check, | 178 | pp->name, udph->check, |
179 | (char*)&(udph->check) - (char*)udph); | 179 | (char*)&(udph->check) - (char*)udph); |
diff --git a/net/ipv4/ipvs/ip_vs_sh.c b/net/ipv4/ipvs/ip_vs_sh.c index 7775e6cc68be..338668f88fe2 100644 --- a/net/ipv4/ipvs/ip_vs_sh.c +++ b/net/ipv4/ipvs/ip_vs_sh.c | |||
@@ -63,7 +63,7 @@ struct ip_vs_sh_bucket { | |||
63 | /* | 63 | /* |
64 | * Returns hash value for IPVS SH entry | 64 | * Returns hash value for IPVS SH entry |
65 | */ | 65 | */ |
66 | static inline unsigned ip_vs_sh_hashkey(__u32 addr) | 66 | static inline unsigned ip_vs_sh_hashkey(__be32 addr) |
67 | { | 67 | { |
68 | return (ntohl(addr)*2654435761UL) & IP_VS_SH_TAB_MASK; | 68 | return (ntohl(addr)*2654435761UL) & IP_VS_SH_TAB_MASK; |
69 | } | 69 | } |
@@ -73,7 +73,7 @@ static inline unsigned ip_vs_sh_hashkey(__u32 addr) | |||
73 | * Get ip_vs_dest associated with supplied parameters. | 73 | * Get ip_vs_dest associated with supplied parameters. |
74 | */ | 74 | */ |
75 | static inline struct ip_vs_dest * | 75 | static inline struct ip_vs_dest * |
76 | ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __u32 addr) | 76 | ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __be32 addr) |
77 | { | 77 | { |
78 | return (tbl[ip_vs_sh_hashkey(addr)]).dest; | 78 | return (tbl[ip_vs_sh_hashkey(addr)]).dest; |
79 | } | 79 | } |
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 1bca714bda3d..6ab57d72b615 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c | |||
@@ -48,16 +48,16 @@ struct ip_vs_sync_conn { | |||
48 | 48 | ||
49 | /* Protocol, addresses and port numbers */ | 49 | /* Protocol, addresses and port numbers */ |
50 | __u8 protocol; /* Which protocol (TCP/UDP) */ | 50 | __u8 protocol; /* Which protocol (TCP/UDP) */ |
51 | __u16 cport; | 51 | __be16 cport; |
52 | __u16 vport; | 52 | __be16 vport; |
53 | __u16 dport; | 53 | __be16 dport; |
54 | __u32 caddr; /* client address */ | 54 | __be32 caddr; /* client address */ |
55 | __u32 vaddr; /* virtual address */ | 55 | __be32 vaddr; /* virtual address */ |
56 | __u32 daddr; /* destination address */ | 56 | __be32 daddr; /* destination address */ |
57 | 57 | ||
58 | /* Flags and state transition */ | 58 | /* Flags and state transition */ |
59 | __u16 flags; /* status flags */ | 59 | __be16 flags; /* status flags */ |
60 | __u16 state; /* state info */ | 60 | __be16 state; /* state info */ |
61 | 61 | ||
62 | /* The sequence options start here */ | 62 | /* The sequence options start here */ |
63 | }; | 63 | }; |
@@ -464,7 +464,7 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname) | |||
464 | static int bind_mcastif_addr(struct socket *sock, char *ifname) | 464 | static int bind_mcastif_addr(struct socket *sock, char *ifname) |
465 | { | 465 | { |
466 | struct net_device *dev; | 466 | struct net_device *dev; |
467 | u32 addr; | 467 | __be32 addr; |
468 | struct sockaddr_in sin; | 468 | struct sockaddr_in sin; |
469 | 469 | ||
470 | if ((dev = __dev_get_by_name(ifname)) == NULL) | 470 | if ((dev = __dev_get_by_name(ifname)) == NULL) |
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c index 52c12e9edbbc..e1f77bd7c9a5 100644 --- a/net/ipv4/ipvs/ip_vs_xmit.c +++ b/net/ipv4/ipvs/ip_vs_xmit.c | |||
@@ -232,7 +232,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
232 | 232 | ||
233 | /* check if it is a connection of no-client-port */ | 233 | /* check if it is a connection of no-client-port */ |
234 | if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) { | 234 | if (unlikely(cp->flags & IP_VS_CONN_F_NO_CPORT)) { |
235 | __u16 _pt, *p; | 235 | __be16 _pt, *p; |
236 | p = skb_header_pointer(skb, iph->ihl*4, sizeof(_pt), &_pt); | 236 | p = skb_header_pointer(skb, iph->ihl*4, sizeof(_pt), &_pt); |
237 | if (p == NULL) | 237 | if (p == NULL) |
238 | goto tx_error; | 238 | goto tx_error; |
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c index d25ec4ae09e5..92b04823e034 100644 --- a/net/ipv4/multipath_wrandom.c +++ b/net/ipv4/multipath_wrandom.c | |||
@@ -60,8 +60,8 @@ struct multipath_dest { | |||
60 | struct list_head list; | 60 | struct list_head list; |
61 | 61 | ||
62 | const struct fib_nh *nh_info; | 62 | const struct fib_nh *nh_info; |
63 | __u32 netmask; | 63 | __be32 netmask; |
64 | __u32 network; | 64 | __be32 network; |
65 | unsigned char prefixlen; | 65 | unsigned char prefixlen; |
66 | 66 | ||
67 | struct rcu_head rcu; | 67 | struct rcu_head rcu; |
@@ -76,7 +76,7 @@ struct multipath_route { | |||
76 | struct list_head list; | 76 | struct list_head list; |
77 | 77 | ||
78 | int oif; | 78 | int oif; |
79 | __u32 gw; | 79 | __be32 gw; |
80 | struct list_head dests; | 80 | struct list_head dests; |
81 | 81 | ||
82 | struct rcu_head rcu; | 82 | struct rcu_head rcu; |
@@ -128,8 +128,8 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl, | |||
128 | 128 | ||
129 | /* find state entry for destination */ | 129 | /* find state entry for destination */ |
130 | list_for_each_entry_rcu(d, &target_route->dests, list) { | 130 | list_for_each_entry_rcu(d, &target_route->dests, list) { |
131 | __u32 targetnetwork = fl->fl4_dst & | 131 | __be32 targetnetwork = fl->fl4_dst & |
132 | (0xFFFFFFFF >> (32 - d->prefixlen)); | 132 | inet_make_mask(d->prefixlen); |
133 | 133 | ||
134 | if ((targetnetwork & d->netmask) == d->network) { | 134 | if ((targetnetwork & d->netmask) == d->network) { |
135 | weight = d->nh_info->nh_weight; | 135 | weight = d->nh_info->nh_weight; |
@@ -217,8 +217,8 @@ static void wrandom_select_route(const struct flowi *flp, | |||
217 | *rp = decision; | 217 | *rp = decision; |
218 | } | 218 | } |
219 | 219 | ||
220 | static void wrandom_set_nhinfo(__u32 network, | 220 | static void wrandom_set_nhinfo(__be32 network, |
221 | __u32 netmask, | 221 | __be32 netmask, |
222 | unsigned char prefixlen, | 222 | unsigned char prefixlen, |
223 | const struct fib_nh *nh) | 223 | const struct fib_nh *nh) |
224 | { | 224 | { |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index f88347de21a9..5ac15379a0cf 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -128,8 +128,8 @@ EXPORT_SYMBOL(ip_nat_decode_session); | |||
128 | */ | 128 | */ |
129 | 129 | ||
130 | struct ip_rt_info { | 130 | struct ip_rt_info { |
131 | u_int32_t daddr; | 131 | __be32 daddr; |
132 | u_int32_t saddr; | 132 | __be32 saddr; |
133 | u_int8_t tos; | 133 | u_int8_t tos; |
134 | }; | 134 | }; |
135 | 135 | ||
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 85f0d73ebfb4..17e1a687ab45 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -80,7 +80,7 @@ static inline int arp_packet_match(const struct arphdr *arphdr, | |||
80 | { | 80 | { |
81 | char *arpptr = (char *)(arphdr + 1); | 81 | char *arpptr = (char *)(arphdr + 1); |
82 | char *src_devaddr, *tgt_devaddr; | 82 | char *src_devaddr, *tgt_devaddr; |
83 | u32 src_ipaddr, tgt_ipaddr; | 83 | __be32 src_ipaddr, tgt_ipaddr; |
84 | int i, ret; | 84 | int i, ret; |
85 | 85 | ||
86 | #define FWINV(bool,invflg) ((bool) ^ !!(arpinfo->invflags & invflg)) | 86 | #define FWINV(bool,invflg) ((bool) ^ !!(arpinfo->invflags & invflg)) |
diff --git a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c index 0a7bd7f04061..6c7383a8e42b 100644 --- a/net/ipv4/netfilter/ip_conntrack_amanda.c +++ b/net/ipv4/netfilter/ip_conntrack_amanda.c | |||
@@ -155,11 +155,11 @@ static int help(struct sk_buff **pskb, | |||
155 | exp->tuple.dst.protonum = IPPROTO_TCP; | 155 | exp->tuple.dst.protonum = IPPROTO_TCP; |
156 | exp->tuple.dst.u.tcp.port = htons(port); | 156 | exp->tuple.dst.u.tcp.port = htons(port); |
157 | 157 | ||
158 | exp->mask.src.ip = 0xFFFFFFFF; | 158 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
159 | exp->mask.src.u.tcp.port = 0; | 159 | exp->mask.src.u.tcp.port = 0; |
160 | exp->mask.dst.ip = 0xFFFFFFFF; | 160 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
161 | exp->mask.dst.protonum = 0xFF; | 161 | exp->mask.dst.protonum = 0xFF; |
162 | exp->mask.dst.u.tcp.port = 0xFFFF; | 162 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
163 | 163 | ||
164 | if (ip_nat_amanda_hook) | 164 | if (ip_nat_amanda_hook) |
165 | ret = ip_nat_amanda_hook(pskb, ctinfo, off - dataoff, | 165 | ret = ip_nat_amanda_hook(pskb, ctinfo, off - dataoff, |
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index c432b3163609..143c4668538b 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c | |||
@@ -149,8 +149,8 @@ static unsigned int ip_conntrack_hash_rnd; | |||
149 | static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple, | 149 | static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple, |
150 | unsigned int size, unsigned int rnd) | 150 | unsigned int size, unsigned int rnd) |
151 | { | 151 | { |
152 | return (jhash_3words(tuple->src.ip, | 152 | return (jhash_3words((__force u32)tuple->src.ip, |
153 | (tuple->dst.ip ^ tuple->dst.protonum), | 153 | ((__force u32)tuple->dst.ip ^ tuple->dst.protonum), |
154 | (tuple->src.u.all | (tuple->dst.u.all << 16)), | 154 | (tuple->src.u.all | (tuple->dst.u.all << 16)), |
155 | rnd) % size); | 155 | rnd) % size); |
156 | } | 156 | } |
@@ -1169,9 +1169,9 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct, | |||
1169 | int ip_ct_port_tuple_to_nfattr(struct sk_buff *skb, | 1169 | int ip_ct_port_tuple_to_nfattr(struct sk_buff *skb, |
1170 | const struct ip_conntrack_tuple *tuple) | 1170 | const struct ip_conntrack_tuple *tuple) |
1171 | { | 1171 | { |
1172 | NFA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(u_int16_t), | 1172 | NFA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(__be16), |
1173 | &tuple->src.u.tcp.port); | 1173 | &tuple->src.u.tcp.port); |
1174 | NFA_PUT(skb, CTA_PROTO_DST_PORT, sizeof(u_int16_t), | 1174 | NFA_PUT(skb, CTA_PROTO_DST_PORT, sizeof(__be16), |
1175 | &tuple->dst.u.tcp.port); | 1175 | &tuple->dst.u.tcp.port); |
1176 | return 0; | 1176 | return 0; |
1177 | 1177 | ||
@@ -1186,9 +1186,9 @@ int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[], | |||
1186 | return -EINVAL; | 1186 | return -EINVAL; |
1187 | 1187 | ||
1188 | t->src.u.tcp.port = | 1188 | t->src.u.tcp.port = |
1189 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_SRC_PORT-1]); | 1189 | *(__be16 *)NFA_DATA(tb[CTA_PROTO_SRC_PORT-1]); |
1190 | t->dst.u.tcp.port = | 1190 | t->dst.u.tcp.port = |
1191 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_DST_PORT-1]); | 1191 | *(__be16 *)NFA_DATA(tb[CTA_PROTO_DST_PORT-1]); |
1192 | 1192 | ||
1193 | return 0; | 1193 | return 0; |
1194 | } | 1194 | } |
diff --git a/net/ipv4/netfilter/ip_conntrack_ftp.c b/net/ipv4/netfilter/ip_conntrack_ftp.c index 1d18c863f064..93dcf960662f 100644 --- a/net/ipv4/netfilter/ip_conntrack_ftp.c +++ b/net/ipv4/netfilter/ip_conntrack_ftp.c | |||
@@ -425,8 +425,8 @@ static int help(struct sk_buff **pskb, | |||
425 | exp->tuple.src.u.tcp.port = 0; /* Don't care. */ | 425 | exp->tuple.src.u.tcp.port = 0; /* Don't care. */ |
426 | exp->tuple.dst.protonum = IPPROTO_TCP; | 426 | exp->tuple.dst.protonum = IPPROTO_TCP; |
427 | exp->mask = ((struct ip_conntrack_tuple) | 427 | exp->mask = ((struct ip_conntrack_tuple) |
428 | { { 0xFFFFFFFF, { 0 } }, | 428 | { { htonl(0xFFFFFFFF), { 0 } }, |
429 | { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }}); | 429 | { htonl(0xFFFFFFFF), { .tcp = { htons(0xFFFF) } }, 0xFF }}); |
430 | 430 | ||
431 | exp->expectfn = NULL; | 431 | exp->expectfn = NULL; |
432 | exp->flags = 0; | 432 | exp->flags = 0; |
@@ -488,7 +488,7 @@ static int __init ip_conntrack_ftp_init(void) | |||
488 | for (i = 0; i < ports_c; i++) { | 488 | for (i = 0; i < ports_c; i++) { |
489 | ftp[i].tuple.src.u.tcp.port = htons(ports[i]); | 489 | ftp[i].tuple.src.u.tcp.port = htons(ports[i]); |
490 | ftp[i].tuple.dst.protonum = IPPROTO_TCP; | 490 | ftp[i].tuple.dst.protonum = IPPROTO_TCP; |
491 | ftp[i].mask.src.u.tcp.port = 0xFFFF; | 491 | ftp[i].mask.src.u.tcp.port = htons(0xFFFF); |
492 | ftp[i].mask.dst.protonum = 0xFF; | 492 | ftp[i].mask.dst.protonum = 0xFF; |
493 | ftp[i].max_expected = 1; | 493 | ftp[i].max_expected = 1; |
494 | ftp[i].timeout = 5 * 60; /* 5 minutes */ | 494 | ftp[i].timeout = 5 * 60; /* 5 minutes */ |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c index 9a39e2969712..7b7441202bfd 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c | |||
@@ -49,11 +49,11 @@ MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations " | |||
49 | int (*set_h245_addr_hook) (struct sk_buff ** pskb, | 49 | int (*set_h245_addr_hook) (struct sk_buff ** pskb, |
50 | unsigned char **data, int dataoff, | 50 | unsigned char **data, int dataoff, |
51 | H245_TransportAddress * addr, | 51 | H245_TransportAddress * addr, |
52 | u_int32_t ip, u_int16_t port); | 52 | __be32 ip, u_int16_t port); |
53 | int (*set_h225_addr_hook) (struct sk_buff ** pskb, | 53 | int (*set_h225_addr_hook) (struct sk_buff ** pskb, |
54 | unsigned char **data, int dataoff, | 54 | unsigned char **data, int dataoff, |
55 | TransportAddress * addr, | 55 | TransportAddress * addr, |
56 | u_int32_t ip, u_int16_t port); | 56 | __be32 ip, u_int16_t port); |
57 | int (*set_sig_addr_hook) (struct sk_buff ** pskb, | 57 | int (*set_sig_addr_hook) (struct sk_buff ** pskb, |
58 | struct ip_conntrack * ct, | 58 | struct ip_conntrack * ct, |
59 | enum ip_conntrack_info ctinfo, | 59 | enum ip_conntrack_info ctinfo, |
@@ -209,7 +209,7 @@ static int get_tpkt_data(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
209 | 209 | ||
210 | /****************************************************************************/ | 210 | /****************************************************************************/ |
211 | static int get_h245_addr(unsigned char *data, H245_TransportAddress * addr, | 211 | static int get_h245_addr(unsigned char *data, H245_TransportAddress * addr, |
212 | u_int32_t * ip, u_int16_t * port) | 212 | __be32 * ip, u_int16_t * port) |
213 | { | 213 | { |
214 | unsigned char *p; | 214 | unsigned char *p; |
215 | 215 | ||
@@ -232,7 +232,7 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
232 | { | 232 | { |
233 | int dir = CTINFO2DIR(ctinfo); | 233 | int dir = CTINFO2DIR(ctinfo); |
234 | int ret = 0; | 234 | int ret = 0; |
235 | u_int32_t ip; | 235 | __be32 ip; |
236 | u_int16_t port; | 236 | u_int16_t port; |
237 | u_int16_t rtp_port; | 237 | u_int16_t rtp_port; |
238 | struct ip_conntrack_expect *rtp_exp; | 238 | struct ip_conntrack_expect *rtp_exp; |
@@ -254,10 +254,10 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
254 | rtp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 254 | rtp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
255 | rtp_exp->tuple.dst.u.udp.port = htons(rtp_port); | 255 | rtp_exp->tuple.dst.u.udp.port = htons(rtp_port); |
256 | rtp_exp->tuple.dst.protonum = IPPROTO_UDP; | 256 | rtp_exp->tuple.dst.protonum = IPPROTO_UDP; |
257 | rtp_exp->mask.src.ip = 0xFFFFFFFF; | 257 | rtp_exp->mask.src.ip = htonl(0xFFFFFFFF); |
258 | rtp_exp->mask.src.u.udp.port = 0; | 258 | rtp_exp->mask.src.u.udp.port = 0; |
259 | rtp_exp->mask.dst.ip = 0xFFFFFFFF; | 259 | rtp_exp->mask.dst.ip = htonl(0xFFFFFFFF); |
260 | rtp_exp->mask.dst.u.udp.port = 0xFFFF; | 260 | rtp_exp->mask.dst.u.udp.port = htons(0xFFFF); |
261 | rtp_exp->mask.dst.protonum = 0xFF; | 261 | rtp_exp->mask.dst.protonum = 0xFF; |
262 | rtp_exp->flags = 0; | 262 | rtp_exp->flags = 0; |
263 | 263 | ||
@@ -271,10 +271,10 @@ static int expect_rtp_rtcp(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
271 | rtcp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 271 | rtcp_exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
272 | rtcp_exp->tuple.dst.u.udp.port = htons(rtp_port + 1); | 272 | rtcp_exp->tuple.dst.u.udp.port = htons(rtp_port + 1); |
273 | rtcp_exp->tuple.dst.protonum = IPPROTO_UDP; | 273 | rtcp_exp->tuple.dst.protonum = IPPROTO_UDP; |
274 | rtcp_exp->mask.src.ip = 0xFFFFFFFF; | 274 | rtcp_exp->mask.src.ip = htonl(0xFFFFFFFF); |
275 | rtcp_exp->mask.src.u.udp.port = 0; | 275 | rtcp_exp->mask.src.u.udp.port = 0; |
276 | rtcp_exp->mask.dst.ip = 0xFFFFFFFF; | 276 | rtcp_exp->mask.dst.ip = htonl(0xFFFFFFFF); |
277 | rtcp_exp->mask.dst.u.udp.port = 0xFFFF; | 277 | rtcp_exp->mask.dst.u.udp.port = htons(0xFFFF); |
278 | rtcp_exp->mask.dst.protonum = 0xFF; | 278 | rtcp_exp->mask.dst.protonum = 0xFF; |
279 | rtcp_exp->flags = 0; | 279 | rtcp_exp->flags = 0; |
280 | 280 | ||
@@ -325,7 +325,7 @@ static int expect_t120(struct sk_buff **pskb, | |||
325 | { | 325 | { |
326 | int dir = CTINFO2DIR(ctinfo); | 326 | int dir = CTINFO2DIR(ctinfo); |
327 | int ret = 0; | 327 | int ret = 0; |
328 | u_int32_t ip; | 328 | __be32 ip; |
329 | u_int16_t port; | 329 | u_int16_t port; |
330 | struct ip_conntrack_expect *exp = NULL; | 330 | struct ip_conntrack_expect *exp = NULL; |
331 | 331 | ||
@@ -342,10 +342,10 @@ static int expect_t120(struct sk_buff **pskb, | |||
342 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 342 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
343 | exp->tuple.dst.u.tcp.port = htons(port); | 343 | exp->tuple.dst.u.tcp.port = htons(port); |
344 | exp->tuple.dst.protonum = IPPROTO_TCP; | 344 | exp->tuple.dst.protonum = IPPROTO_TCP; |
345 | exp->mask.src.ip = 0xFFFFFFFF; | 345 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
346 | exp->mask.src.u.tcp.port = 0; | 346 | exp->mask.src.u.tcp.port = 0; |
347 | exp->mask.dst.ip = 0xFFFFFFFF; | 347 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
348 | exp->mask.dst.u.tcp.port = 0xFFFF; | 348 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
349 | exp->mask.dst.protonum = 0xFF; | 349 | exp->mask.dst.protonum = 0xFF; |
350 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple channels */ | 350 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple channels */ |
351 | 351 | ||
@@ -626,7 +626,7 @@ void ip_conntrack_h245_expect(struct ip_conntrack *new, | |||
626 | 626 | ||
627 | /****************************************************************************/ | 627 | /****************************************************************************/ |
628 | int get_h225_addr(unsigned char *data, TransportAddress * addr, | 628 | int get_h225_addr(unsigned char *data, TransportAddress * addr, |
629 | u_int32_t * ip, u_int16_t * port) | 629 | __be32 * ip, u_int16_t * port) |
630 | { | 630 | { |
631 | unsigned char *p; | 631 | unsigned char *p; |
632 | 632 | ||
@@ -648,7 +648,7 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
648 | { | 648 | { |
649 | int dir = CTINFO2DIR(ctinfo); | 649 | int dir = CTINFO2DIR(ctinfo); |
650 | int ret = 0; | 650 | int ret = 0; |
651 | u_int32_t ip; | 651 | __be32 ip; |
652 | u_int16_t port; | 652 | u_int16_t port; |
653 | struct ip_conntrack_expect *exp = NULL; | 653 | struct ip_conntrack_expect *exp = NULL; |
654 | 654 | ||
@@ -665,10 +665,10 @@ static int expect_h245(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
665 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 665 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
666 | exp->tuple.dst.u.tcp.port = htons(port); | 666 | exp->tuple.dst.u.tcp.port = htons(port); |
667 | exp->tuple.dst.protonum = IPPROTO_TCP; | 667 | exp->tuple.dst.protonum = IPPROTO_TCP; |
668 | exp->mask.src.ip = 0xFFFFFFFF; | 668 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
669 | exp->mask.src.u.tcp.port = 0; | 669 | exp->mask.src.u.tcp.port = 0; |
670 | exp->mask.dst.ip = 0xFFFFFFFF; | 670 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
671 | exp->mask.dst.u.tcp.port = 0xFFFF; | 671 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
672 | exp->mask.dst.protonum = 0xFF; | 672 | exp->mask.dst.protonum = 0xFF; |
673 | exp->flags = 0; | 673 | exp->flags = 0; |
674 | 674 | ||
@@ -709,7 +709,7 @@ static int expect_callforwarding(struct sk_buff **pskb, | |||
709 | { | 709 | { |
710 | int dir = CTINFO2DIR(ctinfo); | 710 | int dir = CTINFO2DIR(ctinfo); |
711 | int ret = 0; | 711 | int ret = 0; |
712 | u_int32_t ip; | 712 | __be32 ip; |
713 | u_int16_t port; | 713 | u_int16_t port; |
714 | struct ip_conntrack_expect *exp = NULL; | 714 | struct ip_conntrack_expect *exp = NULL; |
715 | 715 | ||
@@ -751,10 +751,10 @@ static int expect_callforwarding(struct sk_buff **pskb, | |||
751 | exp->tuple.dst.ip = ip; | 751 | exp->tuple.dst.ip = ip; |
752 | exp->tuple.dst.u.tcp.port = htons(port); | 752 | exp->tuple.dst.u.tcp.port = htons(port); |
753 | exp->tuple.dst.protonum = IPPROTO_TCP; | 753 | exp->tuple.dst.protonum = IPPROTO_TCP; |
754 | exp->mask.src.ip = 0xFFFFFFFF; | 754 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
755 | exp->mask.src.u.tcp.port = 0; | 755 | exp->mask.src.u.tcp.port = 0; |
756 | exp->mask.dst.ip = 0xFFFFFFFF; | 756 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
757 | exp->mask.dst.u.tcp.port = 0xFFFF; | 757 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
758 | exp->mask.dst.protonum = 0xFF; | 758 | exp->mask.dst.protonum = 0xFF; |
759 | exp->flags = 0; | 759 | exp->flags = 0; |
760 | 760 | ||
@@ -791,7 +791,7 @@ static int process_setup(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
791 | int dir = CTINFO2DIR(ctinfo); | 791 | int dir = CTINFO2DIR(ctinfo); |
792 | int ret; | 792 | int ret; |
793 | int i; | 793 | int i; |
794 | u_int32_t ip; | 794 | __be32 ip; |
795 | u_int16_t port; | 795 | u_int16_t port; |
796 | 796 | ||
797 | DEBUGP("ip_ct_q931: Setup\n"); | 797 | DEBUGP("ip_ct_q931: Setup\n"); |
@@ -1188,7 +1188,7 @@ static unsigned char *get_udp_data(struct sk_buff **pskb, int *datalen) | |||
1188 | 1188 | ||
1189 | /****************************************************************************/ | 1189 | /****************************************************************************/ |
1190 | static struct ip_conntrack_expect *find_expect(struct ip_conntrack *ct, | 1190 | static struct ip_conntrack_expect *find_expect(struct ip_conntrack *ct, |
1191 | u_int32_t ip, u_int16_t port) | 1191 | __be32 ip, u_int16_t port) |
1192 | { | 1192 | { |
1193 | struct ip_conntrack_expect *exp; | 1193 | struct ip_conntrack_expect *exp; |
1194 | struct ip_conntrack_tuple tuple; | 1194 | struct ip_conntrack_tuple tuple; |
@@ -1228,7 +1228,7 @@ static int expect_q931(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1228 | int dir = CTINFO2DIR(ctinfo); | 1228 | int dir = CTINFO2DIR(ctinfo); |
1229 | int ret = 0; | 1229 | int ret = 0; |
1230 | int i; | 1230 | int i; |
1231 | u_int32_t ip; | 1231 | __be32 ip; |
1232 | u_int16_t port; | 1232 | u_int16_t port; |
1233 | struct ip_conntrack_expect *exp; | 1233 | struct ip_conntrack_expect *exp; |
1234 | 1234 | ||
@@ -1251,10 +1251,10 @@ static int expect_q931(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1251 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; | 1251 | exp->tuple.dst.ip = ct->tuplehash[!dir].tuple.dst.ip; |
1252 | exp->tuple.dst.u.tcp.port = htons(port); | 1252 | exp->tuple.dst.u.tcp.port = htons(port); |
1253 | exp->tuple.dst.protonum = IPPROTO_TCP; | 1253 | exp->tuple.dst.protonum = IPPROTO_TCP; |
1254 | exp->mask.src.ip = gkrouted_only ? 0xFFFFFFFF : 0; | 1254 | exp->mask.src.ip = gkrouted_only ? htonl(0xFFFFFFFF) : 0; |
1255 | exp->mask.src.u.tcp.port = 0; | 1255 | exp->mask.src.u.tcp.port = 0; |
1256 | exp->mask.dst.ip = 0xFFFFFFFF; | 1256 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1257 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1257 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1258 | exp->mask.dst.protonum = 0xFF; | 1258 | exp->mask.dst.protonum = 0xFF; |
1259 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple calls */ | 1259 | exp->flags = IP_CT_EXPECT_PERMANENT; /* Accept multiple calls */ |
1260 | 1260 | ||
@@ -1307,7 +1307,7 @@ static int process_gcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1307 | { | 1307 | { |
1308 | int dir = CTINFO2DIR(ctinfo); | 1308 | int dir = CTINFO2DIR(ctinfo); |
1309 | int ret = 0; | 1309 | int ret = 0; |
1310 | u_int32_t ip; | 1310 | __be32 ip; |
1311 | u_int16_t port; | 1311 | u_int16_t port; |
1312 | struct ip_conntrack_expect *exp; | 1312 | struct ip_conntrack_expect *exp; |
1313 | 1313 | ||
@@ -1333,10 +1333,10 @@ static int process_gcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1333 | exp->tuple.dst.ip = ip; | 1333 | exp->tuple.dst.ip = ip; |
1334 | exp->tuple.dst.u.tcp.port = htons(port); | 1334 | exp->tuple.dst.u.tcp.port = htons(port); |
1335 | exp->tuple.dst.protonum = IPPROTO_UDP; | 1335 | exp->tuple.dst.protonum = IPPROTO_UDP; |
1336 | exp->mask.src.ip = 0xFFFFFFFF; | 1336 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
1337 | exp->mask.src.u.tcp.port = 0; | 1337 | exp->mask.src.u.tcp.port = 0; |
1338 | exp->mask.dst.ip = 0xFFFFFFFF; | 1338 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1339 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1339 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1340 | exp->mask.dst.protonum = 0xFF; | 1340 | exp->mask.dst.protonum = 0xFF; |
1341 | exp->flags = 0; | 1341 | exp->flags = 0; |
1342 | exp->expectfn = ip_conntrack_ras_expect; | 1342 | exp->expectfn = ip_conntrack_ras_expect; |
@@ -1477,7 +1477,7 @@ static int process_arq(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1477 | { | 1477 | { |
1478 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; | 1478 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; |
1479 | int dir = CTINFO2DIR(ctinfo); | 1479 | int dir = CTINFO2DIR(ctinfo); |
1480 | u_int32_t ip; | 1480 | __be32 ip; |
1481 | u_int16_t port; | 1481 | u_int16_t port; |
1482 | 1482 | ||
1483 | DEBUGP("ip_ct_ras: ARQ\n"); | 1483 | DEBUGP("ip_ct_ras: ARQ\n"); |
@@ -1513,7 +1513,7 @@ static int process_acf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1513 | { | 1513 | { |
1514 | int dir = CTINFO2DIR(ctinfo); | 1514 | int dir = CTINFO2DIR(ctinfo); |
1515 | int ret = 0; | 1515 | int ret = 0; |
1516 | u_int32_t ip; | 1516 | __be32 ip; |
1517 | u_int16_t port; | 1517 | u_int16_t port; |
1518 | struct ip_conntrack_expect *exp; | 1518 | struct ip_conntrack_expect *exp; |
1519 | 1519 | ||
@@ -1538,10 +1538,10 @@ static int process_acf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1538 | exp->tuple.dst.ip = ip; | 1538 | exp->tuple.dst.ip = ip; |
1539 | exp->tuple.dst.u.tcp.port = htons(port); | 1539 | exp->tuple.dst.u.tcp.port = htons(port); |
1540 | exp->tuple.dst.protonum = IPPROTO_TCP; | 1540 | exp->tuple.dst.protonum = IPPROTO_TCP; |
1541 | exp->mask.src.ip = 0xFFFFFFFF; | 1541 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
1542 | exp->mask.src.u.tcp.port = 0; | 1542 | exp->mask.src.u.tcp.port = 0; |
1543 | exp->mask.dst.ip = 0xFFFFFFFF; | 1543 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1544 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1544 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1545 | exp->mask.dst.protonum = 0xFF; | 1545 | exp->mask.dst.protonum = 0xFF; |
1546 | exp->flags = IP_CT_EXPECT_PERMANENT; | 1546 | exp->flags = IP_CT_EXPECT_PERMANENT; |
1547 | exp->expectfn = ip_conntrack_q931_expect; | 1547 | exp->expectfn = ip_conntrack_q931_expect; |
@@ -1581,7 +1581,7 @@ static int process_lcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1581 | { | 1581 | { |
1582 | int dir = CTINFO2DIR(ctinfo); | 1582 | int dir = CTINFO2DIR(ctinfo); |
1583 | int ret = 0; | 1583 | int ret = 0; |
1584 | u_int32_t ip; | 1584 | __be32 ip; |
1585 | u_int16_t port; | 1585 | u_int16_t port; |
1586 | struct ip_conntrack_expect *exp = NULL; | 1586 | struct ip_conntrack_expect *exp = NULL; |
1587 | 1587 | ||
@@ -1598,10 +1598,10 @@ static int process_lcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1598 | exp->tuple.dst.ip = ip; | 1598 | exp->tuple.dst.ip = ip; |
1599 | exp->tuple.dst.u.tcp.port = htons(port); | 1599 | exp->tuple.dst.u.tcp.port = htons(port); |
1600 | exp->tuple.dst.protonum = IPPROTO_TCP; | 1600 | exp->tuple.dst.protonum = IPPROTO_TCP; |
1601 | exp->mask.src.ip = 0xFFFFFFFF; | 1601 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
1602 | exp->mask.src.u.tcp.port = 0; | 1602 | exp->mask.src.u.tcp.port = 0; |
1603 | exp->mask.dst.ip = 0xFFFFFFFF; | 1603 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
1604 | exp->mask.dst.u.tcp.port = 0xFFFF; | 1604 | exp->mask.dst.u.tcp.port = htons(0xFFFF); |
1605 | exp->mask.dst.protonum = 0xFF; | 1605 | exp->mask.dst.protonum = 0xFF; |
1606 | exp->flags = IP_CT_EXPECT_PERMANENT; | 1606 | exp->flags = IP_CT_EXPECT_PERMANENT; |
1607 | exp->expectfn = ip_conntrack_q931_expect; | 1607 | exp->expectfn = ip_conntrack_q931_expect; |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index fb0aee691721..a2af5e0c7f99 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c | |||
@@ -242,10 +242,10 @@ exp_gre(struct ip_conntrack *ct, | |||
242 | exp_orig->tuple.dst.u.gre.key = callid; | 242 | exp_orig->tuple.dst.u.gre.key = callid; |
243 | exp_orig->tuple.dst.protonum = IPPROTO_GRE; | 243 | exp_orig->tuple.dst.protonum = IPPROTO_GRE; |
244 | 244 | ||
245 | exp_orig->mask.src.ip = 0xffffffff; | 245 | exp_orig->mask.src.ip = htonl(0xffffffff); |
246 | exp_orig->mask.src.u.all = 0; | 246 | exp_orig->mask.src.u.all = 0; |
247 | exp_orig->mask.dst.u.gre.key = htons(0xffff); | 247 | exp_orig->mask.dst.u.gre.key = htons(0xffff); |
248 | exp_orig->mask.dst.ip = 0xffffffff; | 248 | exp_orig->mask.dst.ip = htonl(0xffffffff); |
249 | exp_orig->mask.dst.protonum = 0xff; | 249 | exp_orig->mask.dst.protonum = 0xff; |
250 | 250 | ||
251 | exp_orig->master = ct; | 251 | exp_orig->master = ct; |
diff --git a/net/ipv4/netfilter/ip_conntrack_irc.c b/net/ipv4/netfilter/ip_conntrack_irc.c index 44889075f3b2..75f7c3db1619 100644 --- a/net/ipv4/netfilter/ip_conntrack_irc.c +++ b/net/ipv4/netfilter/ip_conntrack_irc.c | |||
@@ -218,7 +218,8 @@ static int help(struct sk_buff **pskb, | |||
218 | IPPROTO_TCP }}); | 218 | IPPROTO_TCP }}); |
219 | exp->mask = ((struct ip_conntrack_tuple) | 219 | exp->mask = ((struct ip_conntrack_tuple) |
220 | { { 0, { 0 } }, | 220 | { { 0, { 0 } }, |
221 | { 0xFFFFFFFF, { .tcp = { 0xFFFF } }, 0xFF }}); | 221 | { htonl(0xFFFFFFFF), |
222 | { .tcp = { htons(0xFFFF) } }, 0xFF }}); | ||
222 | exp->expectfn = NULL; | 223 | exp->expectfn = NULL; |
223 | exp->flags = 0; | 224 | exp->flags = 0; |
224 | if (ip_nat_irc_hook) | 225 | if (ip_nat_irc_hook) |
@@ -266,7 +267,7 @@ static int __init ip_conntrack_irc_init(void) | |||
266 | hlpr = &irc_helpers[i]; | 267 | hlpr = &irc_helpers[i]; |
267 | hlpr->tuple.src.u.tcp.port = htons(ports[i]); | 268 | hlpr->tuple.src.u.tcp.port = htons(ports[i]); |
268 | hlpr->tuple.dst.protonum = IPPROTO_TCP; | 269 | hlpr->tuple.dst.protonum = IPPROTO_TCP; |
269 | hlpr->mask.src.u.tcp.port = 0xFFFF; | 270 | hlpr->mask.src.u.tcp.port = htons(0xFFFF); |
270 | hlpr->mask.dst.protonum = 0xFF; | 271 | hlpr->mask.dst.protonum = 0xFF; |
271 | hlpr->max_expected = max_dcc_channels; | 272 | hlpr->max_expected = max_dcc_channels; |
272 | hlpr->timeout = dcc_timeout; | 273 | hlpr->timeout = dcc_timeout; |
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index 3d0b438783db..a1d6a89f64aa 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c | |||
@@ -48,7 +48,7 @@ static int help(struct sk_buff **pskb, | |||
48 | struct iphdr *iph = (*pskb)->nh.iph; | 48 | struct iphdr *iph = (*pskb)->nh.iph; |
49 | struct rtable *rt = (struct rtable *)(*pskb)->dst; | 49 | struct rtable *rt = (struct rtable *)(*pskb)->dst; |
50 | struct in_device *in_dev; | 50 | struct in_device *in_dev; |
51 | u_int32_t mask = 0; | 51 | __be32 mask = 0; |
52 | 52 | ||
53 | /* we're only interested in locally generated packets */ | 53 | /* we're only interested in locally generated packets */ |
54 | if ((*pskb)->sk == NULL) | 54 | if ((*pskb)->sk == NULL) |
@@ -78,12 +78,12 @@ static int help(struct sk_buff **pskb, | |||
78 | goto out; | 78 | goto out; |
79 | 79 | ||
80 | exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; | 80 | exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; |
81 | exp->tuple.src.u.udp.port = ntohs(NMBD_PORT); | 81 | exp->tuple.src.u.udp.port = htons(NMBD_PORT); |
82 | 82 | ||
83 | exp->mask.src.ip = mask; | 83 | exp->mask.src.ip = mask; |
84 | exp->mask.src.u.udp.port = 0xFFFF; | 84 | exp->mask.src.u.udp.port = htons(0xFFFF); |
85 | exp->mask.dst.ip = 0xFFFFFFFF; | 85 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
86 | exp->mask.dst.u.udp.port = 0xFFFF; | 86 | exp->mask.dst.u.udp.port = htons(0xFFFF); |
87 | exp->mask.dst.protonum = 0xFF; | 87 | exp->mask.dst.protonum = 0xFF; |
88 | 88 | ||
89 | exp->expectfn = NULL; | 89 | exp->expectfn = NULL; |
@@ -115,7 +115,7 @@ static struct ip_conntrack_helper helper = { | |||
115 | .src = { | 115 | .src = { |
116 | .u = { | 116 | .u = { |
117 | .udp = { | 117 | .udp = { |
118 | .port = 0xFFFF, | 118 | .port = __constant_htons(0xFFFF), |
119 | } | 119 | } |
120 | } | 120 | } |
121 | }, | 121 | }, |
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c index 52eddea27e93..53b6dffea6c2 100644 --- a/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/net/ipv4/netfilter/ip_conntrack_netlink.c | |||
@@ -78,8 +78,8 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb, | |||
78 | { | 78 | { |
79 | struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP); | 79 | struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP); |
80 | 80 | ||
81 | NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t), &tuple->src.ip); | 81 | NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(__be32), &tuple->src.ip); |
82 | NFA_PUT(skb, CTA_IP_V4_DST, sizeof(u_int32_t), &tuple->dst.ip); | 82 | NFA_PUT(skb, CTA_IP_V4_DST, sizeof(__be32), &tuple->dst.ip); |
83 | 83 | ||
84 | NFA_NEST_END(skb, nest_parms); | 84 | NFA_NEST_END(skb, nest_parms); |
85 | 85 | ||
@@ -110,7 +110,7 @@ ctnetlink_dump_tuples(struct sk_buff *skb, | |||
110 | static inline int | 110 | static inline int |
111 | ctnetlink_dump_status(struct sk_buff *skb, const struct ip_conntrack *ct) | 111 | ctnetlink_dump_status(struct sk_buff *skb, const struct ip_conntrack *ct) |
112 | { | 112 | { |
113 | u_int32_t status = htonl((u_int32_t) ct->status); | 113 | __be32 status = htonl((u_int32_t) ct->status); |
114 | NFA_PUT(skb, CTA_STATUS, sizeof(status), &status); | 114 | NFA_PUT(skb, CTA_STATUS, sizeof(status), &status); |
115 | return 0; | 115 | return 0; |
116 | 116 | ||
@@ -122,7 +122,7 @@ static inline int | |||
122 | ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct) | 122 | ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct) |
123 | { | 123 | { |
124 | long timeout_l = ct->timeout.expires - jiffies; | 124 | long timeout_l = ct->timeout.expires - jiffies; |
125 | u_int32_t timeout; | 125 | __be32 timeout; |
126 | 126 | ||
127 | if (timeout_l < 0) | 127 | if (timeout_l < 0) |
128 | timeout = 0; | 128 | timeout = 0; |
@@ -192,13 +192,13 @@ ctnetlink_dump_counters(struct sk_buff *skb, const struct ip_conntrack *ct, | |||
192 | { | 192 | { |
193 | enum ctattr_type type = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG; | 193 | enum ctattr_type type = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG; |
194 | struct nfattr *nest_count = NFA_NEST(skb, type); | 194 | struct nfattr *nest_count = NFA_NEST(skb, type); |
195 | u_int32_t tmp; | 195 | __be32 tmp; |
196 | 196 | ||
197 | tmp = htonl(ct->counters[dir].packets); | 197 | tmp = htonl(ct->counters[dir].packets); |
198 | NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(u_int32_t), &tmp); | 198 | NFA_PUT(skb, CTA_COUNTERS32_PACKETS, sizeof(__be32), &tmp); |
199 | 199 | ||
200 | tmp = htonl(ct->counters[dir].bytes); | 200 | tmp = htonl(ct->counters[dir].bytes); |
201 | NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(u_int32_t), &tmp); | 201 | NFA_PUT(skb, CTA_COUNTERS32_BYTES, sizeof(__be32), &tmp); |
202 | 202 | ||
203 | NFA_NEST_END(skb, nest_count); | 203 | NFA_NEST_END(skb, nest_count); |
204 | 204 | ||
@@ -215,9 +215,9 @@ nfattr_failure: | |||
215 | static inline int | 215 | static inline int |
216 | ctnetlink_dump_mark(struct sk_buff *skb, const struct ip_conntrack *ct) | 216 | ctnetlink_dump_mark(struct sk_buff *skb, const struct ip_conntrack *ct) |
217 | { | 217 | { |
218 | u_int32_t mark = htonl(ct->mark); | 218 | __be32 mark = htonl(ct->mark); |
219 | 219 | ||
220 | NFA_PUT(skb, CTA_MARK, sizeof(u_int32_t), &mark); | 220 | NFA_PUT(skb, CTA_MARK, sizeof(__be32), &mark); |
221 | return 0; | 221 | return 0; |
222 | 222 | ||
223 | nfattr_failure: | 223 | nfattr_failure: |
@@ -230,8 +230,8 @@ nfattr_failure: | |||
230 | static inline int | 230 | static inline int |
231 | ctnetlink_dump_id(struct sk_buff *skb, const struct ip_conntrack *ct) | 231 | ctnetlink_dump_id(struct sk_buff *skb, const struct ip_conntrack *ct) |
232 | { | 232 | { |
233 | u_int32_t id = htonl(ct->id); | 233 | __be32 id = htonl(ct->id); |
234 | NFA_PUT(skb, CTA_ID, sizeof(u_int32_t), &id); | 234 | NFA_PUT(skb, CTA_ID, sizeof(__be32), &id); |
235 | return 0; | 235 | return 0; |
236 | 236 | ||
237 | nfattr_failure: | 237 | nfattr_failure: |
@@ -241,9 +241,9 @@ nfattr_failure: | |||
241 | static inline int | 241 | static inline int |
242 | ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) | 242 | ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) |
243 | { | 243 | { |
244 | u_int32_t use = htonl(atomic_read(&ct->ct_general.use)); | 244 | __be32 use = htonl(atomic_read(&ct->ct_general.use)); |
245 | 245 | ||
246 | NFA_PUT(skb, CTA_USE, sizeof(u_int32_t), &use); | 246 | NFA_PUT(skb, CTA_USE, sizeof(__be32), &use); |
247 | return 0; | 247 | return 0; |
248 | 248 | ||
249 | nfattr_failure: | 249 | nfattr_failure: |
@@ -457,8 +457,8 @@ out: | |||
457 | } | 457 | } |
458 | 458 | ||
459 | static const size_t cta_min_ip[CTA_IP_MAX] = { | 459 | static const size_t cta_min_ip[CTA_IP_MAX] = { |
460 | [CTA_IP_V4_SRC-1] = sizeof(u_int32_t), | 460 | [CTA_IP_V4_SRC-1] = sizeof(__be32), |
461 | [CTA_IP_V4_DST-1] = sizeof(u_int32_t), | 461 | [CTA_IP_V4_DST-1] = sizeof(__be32), |
462 | }; | 462 | }; |
463 | 463 | ||
464 | static inline int | 464 | static inline int |
@@ -475,11 +475,11 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple) | |||
475 | 475 | ||
476 | if (!tb[CTA_IP_V4_SRC-1]) | 476 | if (!tb[CTA_IP_V4_SRC-1]) |
477 | return -EINVAL; | 477 | return -EINVAL; |
478 | tuple->src.ip = *(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_SRC-1]); | 478 | tuple->src.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_SRC-1]); |
479 | 479 | ||
480 | if (!tb[CTA_IP_V4_DST-1]) | 480 | if (!tb[CTA_IP_V4_DST-1]) |
481 | return -EINVAL; | 481 | return -EINVAL; |
482 | tuple->dst.ip = *(u_int32_t *)NFA_DATA(tb[CTA_IP_V4_DST-1]); | 482 | tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]); |
483 | 483 | ||
484 | DEBUGP("leaving\n"); | 484 | DEBUGP("leaving\n"); |
485 | 485 | ||
@@ -602,8 +602,8 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr, | |||
602 | } | 602 | } |
603 | 603 | ||
604 | static const size_t cta_min_nat[CTA_NAT_MAX] = { | 604 | static const size_t cta_min_nat[CTA_NAT_MAX] = { |
605 | [CTA_NAT_MINIP-1] = sizeof(u_int32_t), | 605 | [CTA_NAT_MINIP-1] = sizeof(__be32), |
606 | [CTA_NAT_MAXIP-1] = sizeof(u_int32_t), | 606 | [CTA_NAT_MAXIP-1] = sizeof(__be32), |
607 | }; | 607 | }; |
608 | 608 | ||
609 | static inline int | 609 | static inline int |
@@ -623,12 +623,12 @@ ctnetlink_parse_nat(struct nfattr *nat, | |||
623 | return -EINVAL; | 623 | return -EINVAL; |
624 | 624 | ||
625 | if (tb[CTA_NAT_MINIP-1]) | 625 | if (tb[CTA_NAT_MINIP-1]) |
626 | range->min_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MINIP-1]); | 626 | range->min_ip = *(__be32 *)NFA_DATA(tb[CTA_NAT_MINIP-1]); |
627 | 627 | ||
628 | if (!tb[CTA_NAT_MAXIP-1]) | 628 | if (!tb[CTA_NAT_MAXIP-1]) |
629 | range->max_ip = range->min_ip; | 629 | range->max_ip = range->min_ip; |
630 | else | 630 | else |
631 | range->max_ip = *(u_int32_t *)NFA_DATA(tb[CTA_NAT_MAXIP-1]); | 631 | range->max_ip = *(__be32 *)NFA_DATA(tb[CTA_NAT_MAXIP-1]); |
632 | 632 | ||
633 | if (range->min_ip) | 633 | if (range->min_ip) |
634 | range->flags |= IP_NAT_RANGE_MAP_IPS; | 634 | range->flags |= IP_NAT_RANGE_MAP_IPS; |
@@ -663,11 +663,11 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name) | |||
663 | } | 663 | } |
664 | 664 | ||
665 | static const size_t cta_min[CTA_MAX] = { | 665 | static const size_t cta_min[CTA_MAX] = { |
666 | [CTA_STATUS-1] = sizeof(u_int32_t), | 666 | [CTA_STATUS-1] = sizeof(__be32), |
667 | [CTA_TIMEOUT-1] = sizeof(u_int32_t), | 667 | [CTA_TIMEOUT-1] = sizeof(__be32), |
668 | [CTA_MARK-1] = sizeof(u_int32_t), | 668 | [CTA_MARK-1] = sizeof(__be32), |
669 | [CTA_USE-1] = sizeof(u_int32_t), | 669 | [CTA_USE-1] = sizeof(__be32), |
670 | [CTA_ID-1] = sizeof(u_int32_t) | 670 | [CTA_ID-1] = sizeof(__be32) |
671 | }; | 671 | }; |
672 | 672 | ||
673 | static int | 673 | static int |
@@ -706,7 +706,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, | |||
706 | ct = tuplehash_to_ctrack(h); | 706 | ct = tuplehash_to_ctrack(h); |
707 | 707 | ||
708 | if (cda[CTA_ID-1]) { | 708 | if (cda[CTA_ID-1]) { |
709 | u_int32_t id = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_ID-1])); | 709 | u_int32_t id = ntohl(*(__be32 *)NFA_DATA(cda[CTA_ID-1])); |
710 | if (ct->id != id) { | 710 | if (ct->id != id) { |
711 | ip_conntrack_put(ct); | 711 | ip_conntrack_put(ct); |
712 | return -ENOENT; | 712 | return -ENOENT; |
@@ -808,7 +808,7 @@ static inline int | |||
808 | ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) | 808 | ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) |
809 | { | 809 | { |
810 | unsigned long d; | 810 | unsigned long d; |
811 | unsigned status = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1])); | 811 | unsigned status = ntohl(*(__be32 *)NFA_DATA(cda[CTA_STATUS-1])); |
812 | d = ct->status ^ status; | 812 | d = ct->status ^ status; |
813 | 813 | ||
814 | if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) | 814 | if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) |
@@ -903,7 +903,7 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[]) | |||
903 | static inline int | 903 | static inline int |
904 | ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) | 904 | ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) |
905 | { | 905 | { |
906 | u_int32_t timeout = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_TIMEOUT-1])); | 906 | u_int32_t timeout = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1])); |
907 | 907 | ||
908 | if (!del_timer(&ct->timeout)) | 908 | if (!del_timer(&ct->timeout)) |
909 | return -ETIME; | 909 | return -ETIME; |
@@ -966,7 +966,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) | |||
966 | 966 | ||
967 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) | 967 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) |
968 | if (cda[CTA_MARK-1]) | 968 | if (cda[CTA_MARK-1]) |
969 | ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1])); | 969 | ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1])); |
970 | #endif | 970 | #endif |
971 | 971 | ||
972 | DEBUGP("all done\n"); | 972 | DEBUGP("all done\n"); |
@@ -989,7 +989,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], | |||
989 | 989 | ||
990 | if (!cda[CTA_TIMEOUT-1]) | 990 | if (!cda[CTA_TIMEOUT-1]) |
991 | goto err; | 991 | goto err; |
992 | ct->timeout.expires = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_TIMEOUT-1])); | 992 | ct->timeout.expires = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1])); |
993 | 993 | ||
994 | ct->timeout.expires = jiffies + ct->timeout.expires * HZ; | 994 | ct->timeout.expires = jiffies + ct->timeout.expires * HZ; |
995 | ct->status |= IPS_CONFIRMED; | 995 | ct->status |= IPS_CONFIRMED; |
@@ -1006,7 +1006,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], | |||
1006 | 1006 | ||
1007 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) | 1007 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) |
1008 | if (cda[CTA_MARK-1]) | 1008 | if (cda[CTA_MARK-1]) |
1009 | ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1])); | 1009 | ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1])); |
1010 | #endif | 1010 | #endif |
1011 | 1011 | ||
1012 | ct->helper = ip_conntrack_helper_find_get(rtuple); | 1012 | ct->helper = ip_conntrack_helper_find_get(rtuple); |
@@ -1138,8 +1138,8 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb, | |||
1138 | const struct ip_conntrack_expect *exp) | 1138 | const struct ip_conntrack_expect *exp) |
1139 | { | 1139 | { |
1140 | struct ip_conntrack *master = exp->master; | 1140 | struct ip_conntrack *master = exp->master; |
1141 | u_int32_t timeout = htonl((exp->timeout.expires - jiffies) / HZ); | 1141 | __be32 timeout = htonl((exp->timeout.expires - jiffies) / HZ); |
1142 | u_int32_t id = htonl(exp->id); | 1142 | __be32 id = htonl(exp->id); |
1143 | 1143 | ||
1144 | if (ctnetlink_exp_dump_tuple(skb, &exp->tuple, CTA_EXPECT_TUPLE) < 0) | 1144 | if (ctnetlink_exp_dump_tuple(skb, &exp->tuple, CTA_EXPECT_TUPLE) < 0) |
1145 | goto nfattr_failure; | 1145 | goto nfattr_failure; |
@@ -1150,8 +1150,8 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb, | |||
1150 | CTA_EXPECT_MASTER) < 0) | 1150 | CTA_EXPECT_MASTER) < 0) |
1151 | goto nfattr_failure; | 1151 | goto nfattr_failure; |
1152 | 1152 | ||
1153 | NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(timeout), &timeout); | 1153 | NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(__be32), &timeout); |
1154 | NFA_PUT(skb, CTA_EXPECT_ID, sizeof(u_int32_t), &id); | 1154 | NFA_PUT(skb, CTA_EXPECT_ID, sizeof(__be32), &id); |
1155 | 1155 | ||
1156 | return 0; | 1156 | return 0; |
1157 | 1157 | ||
@@ -1272,8 +1272,8 @@ out: | |||
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | static const size_t cta_min_exp[CTA_EXPECT_MAX] = { | 1274 | static const size_t cta_min_exp[CTA_EXPECT_MAX] = { |
1275 | [CTA_EXPECT_TIMEOUT-1] = sizeof(u_int32_t), | 1275 | [CTA_EXPECT_TIMEOUT-1] = sizeof(__be32), |
1276 | [CTA_EXPECT_ID-1] = sizeof(u_int32_t) | 1276 | [CTA_EXPECT_ID-1] = sizeof(__be32) |
1277 | }; | 1277 | }; |
1278 | 1278 | ||
1279 | static int | 1279 | static int |
@@ -1321,7 +1321,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, | |||
1321 | return -ENOENT; | 1321 | return -ENOENT; |
1322 | 1322 | ||
1323 | if (cda[CTA_EXPECT_ID-1]) { | 1323 | if (cda[CTA_EXPECT_ID-1]) { |
1324 | u_int32_t id = *(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_ID-1]); | 1324 | __be32 id = *(__be32 *)NFA_DATA(cda[CTA_EXPECT_ID-1]); |
1325 | if (exp->id != ntohl(id)) { | 1325 | if (exp->id != ntohl(id)) { |
1326 | ip_conntrack_expect_put(exp); | 1326 | ip_conntrack_expect_put(exp); |
1327 | return -ENOENT; | 1327 | return -ENOENT; |
@@ -1375,8 +1375,8 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, | |||
1375 | return -ENOENT; | 1375 | return -ENOENT; |
1376 | 1376 | ||
1377 | if (cda[CTA_EXPECT_ID-1]) { | 1377 | if (cda[CTA_EXPECT_ID-1]) { |
1378 | u_int32_t id = | 1378 | __be32 id = |
1379 | *(u_int32_t *)NFA_DATA(cda[CTA_EXPECT_ID-1]); | 1379 | *(__be32 *)NFA_DATA(cda[CTA_EXPECT_ID-1]); |
1380 | if (exp->id != ntohl(id)) { | 1380 | if (exp->id != ntohl(id)) { |
1381 | ip_conntrack_expect_put(exp); | 1381 | ip_conntrack_expect_put(exp); |
1382 | return -ENOENT; | 1382 | return -ENOENT; |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c index 09c40ebe3345..295b6fa340db 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c | |||
@@ -261,7 +261,7 @@ icmp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, | |||
261 | static int icmp_tuple_to_nfattr(struct sk_buff *skb, | 261 | static int icmp_tuple_to_nfattr(struct sk_buff *skb, |
262 | const struct ip_conntrack_tuple *t) | 262 | const struct ip_conntrack_tuple *t) |
263 | { | 263 | { |
264 | NFA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(u_int16_t), | 264 | NFA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(__be16), |
265 | &t->src.u.icmp.id); | 265 | &t->src.u.icmp.id); |
266 | NFA_PUT(skb, CTA_PROTO_ICMP_TYPE, sizeof(u_int8_t), | 266 | NFA_PUT(skb, CTA_PROTO_ICMP_TYPE, sizeof(u_int8_t), |
267 | &t->dst.u.icmp.type); | 267 | &t->dst.u.icmp.type); |
@@ -287,7 +287,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[], | |||
287 | tuple->dst.u.icmp.code = | 287 | tuple->dst.u.icmp.code = |
288 | *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]); | 288 | *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]); |
289 | tuple->src.u.icmp.id = | 289 | tuple->src.u.icmp.id = |
290 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]); | 290 | *(__be16 *)NFA_DATA(tb[CTA_PROTO_ICMP_ID-1]); |
291 | 291 | ||
292 | if (tuple->dst.u.icmp.type >= sizeof(invmap) | 292 | if (tuple->dst.u.icmp.type >= sizeof(invmap) |
293 | || !invmap[tuple->dst.u.icmp.type]) | 293 | || !invmap[tuple->dst.u.icmp.type]) |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index b908a4842e18..2443322e4128 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c | |||
@@ -210,7 +210,7 @@ static int sctp_print_conntrack(struct seq_file *s, | |||
210 | for (offset = skb->nh.iph->ihl * 4 + sizeof(sctp_sctphdr_t), count = 0; \ | 210 | for (offset = skb->nh.iph->ihl * 4 + sizeof(sctp_sctphdr_t), count = 0; \ |
211 | offset < skb->len && \ | 211 | offset < skb->len && \ |
212 | (sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch)); \ | 212 | (sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch)); \ |
213 | offset += (htons(sch->length) + 3) & ~3, count++) | 213 | offset += (ntohs(sch->length) + 3) & ~3, count++) |
214 | 214 | ||
215 | /* Some validity checks to make sure the chunks are fine */ | 215 | /* Some validity checks to make sure the chunks are fine */ |
216 | static int do_basic_checks(struct ip_conntrack *conntrack, | 216 | static int do_basic_checks(struct ip_conntrack *conntrack, |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 03ae9a04cb37..06e4e8a6dd9f 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c | |||
@@ -519,8 +519,8 @@ static void tcp_sack(const struct sk_buff *skb, | |||
519 | 519 | ||
520 | /* Fast path for timestamp-only option */ | 520 | /* Fast path for timestamp-only option */ |
521 | if (length == TCPOLEN_TSTAMP_ALIGNED*4 | 521 | if (length == TCPOLEN_TSTAMP_ALIGNED*4 |
522 | && *(__u32 *)ptr == | 522 | && *(__be32 *)ptr == |
523 | __constant_ntohl((TCPOPT_NOP << 24) | 523 | __constant_htonl((TCPOPT_NOP << 24) |
524 | | (TCPOPT_NOP << 16) | 524 | | (TCPOPT_NOP << 16) |
525 | | (TCPOPT_TIMESTAMP << 8) | 525 | | (TCPOPT_TIMESTAMP << 8) |
526 | | TCPOLEN_TIMESTAMP)) | 526 | | TCPOLEN_TIMESTAMP)) |
@@ -551,7 +551,7 @@ static void tcp_sack(const struct sk_buff *skb, | |||
551 | for (i = 0; | 551 | for (i = 0; |
552 | i < (opsize - TCPOLEN_SACK_BASE); | 552 | i < (opsize - TCPOLEN_SACK_BASE); |
553 | i += TCPOLEN_SACK_PERBLOCK) { | 553 | i += TCPOLEN_SACK_PERBLOCK) { |
554 | tmp = ntohl(*((u_int32_t *)(ptr+i)+1)); | 554 | tmp = ntohl(*((__be32 *)(ptr+i)+1)); |
555 | 555 | ||
556 | if (after(tmp, *sack)) | 556 | if (after(tmp, *sack)) |
557 | *sack = tmp; | 557 | *sack = tmp; |
diff --git a/net/ipv4/netfilter/ip_conntrack_sip.c b/net/ipv4/netfilter/ip_conntrack_sip.c index 2893e9c74850..f4f75995a9e4 100644 --- a/net/ipv4/netfilter/ip_conntrack_sip.c +++ b/net/ipv4/netfilter/ip_conntrack_sip.c | |||
@@ -193,7 +193,7 @@ static int skp_digits_len(const char *dptr, const char *limit, int *shift) | |||
193 | 193 | ||
194 | /* Simple ipaddr parser.. */ | 194 | /* Simple ipaddr parser.. */ |
195 | static int parse_ipaddr(const char *cp, const char **endp, | 195 | static int parse_ipaddr(const char *cp, const char **endp, |
196 | u_int32_t *ipaddr, const char *limit) | 196 | __be32 *ipaddr, const char *limit) |
197 | { | 197 | { |
198 | unsigned long int val; | 198 | unsigned long int val; |
199 | int i, digit = 0; | 199 | int i, digit = 0; |
@@ -227,7 +227,7 @@ static int parse_ipaddr(const char *cp, const char **endp, | |||
227 | static int epaddr_len(const char *dptr, const char *limit, int *shift) | 227 | static int epaddr_len(const char *dptr, const char *limit, int *shift) |
228 | { | 228 | { |
229 | const char *aux = dptr; | 229 | const char *aux = dptr; |
230 | u_int32_t ip; | 230 | __be32 ip; |
231 | 231 | ||
232 | if (parse_ipaddr(dptr, &dptr, &ip, limit) < 0) { | 232 | if (parse_ipaddr(dptr, &dptr, &ip, limit) < 0) { |
233 | DEBUGP("ip: %s parse failed.!\n", dptr); | 233 | DEBUGP("ip: %s parse failed.!\n", dptr); |
@@ -302,7 +302,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen, | |||
302 | static int set_expected_rtp(struct sk_buff **pskb, | 302 | static int set_expected_rtp(struct sk_buff **pskb, |
303 | struct ip_conntrack *ct, | 303 | struct ip_conntrack *ct, |
304 | enum ip_conntrack_info ctinfo, | 304 | enum ip_conntrack_info ctinfo, |
305 | u_int32_t ipaddr, u_int16_t port, | 305 | __be32 ipaddr, u_int16_t port, |
306 | const char *dptr) | 306 | const char *dptr) |
307 | { | 307 | { |
308 | struct ip_conntrack_expect *exp; | 308 | struct ip_conntrack_expect *exp; |
@@ -319,10 +319,10 @@ static int set_expected_rtp(struct sk_buff **pskb, | |||
319 | exp->tuple.dst.u.udp.port = htons(port); | 319 | exp->tuple.dst.u.udp.port = htons(port); |
320 | exp->tuple.dst.protonum = IPPROTO_UDP; | 320 | exp->tuple.dst.protonum = IPPROTO_UDP; |
321 | 321 | ||
322 | exp->mask.src.ip = 0xFFFFFFFF; | 322 | exp->mask.src.ip = htonl(0xFFFFFFFF); |
323 | exp->mask.src.u.udp.port = 0; | 323 | exp->mask.src.u.udp.port = 0; |
324 | exp->mask.dst.ip = 0xFFFFFFFF; | 324 | exp->mask.dst.ip = htonl(0xFFFFFFFF); |
325 | exp->mask.dst.u.udp.port = 0xFFFF; | 325 | exp->mask.dst.u.udp.port = htons(0xFFFF); |
326 | exp->mask.dst.protonum = 0xFF; | 326 | exp->mask.dst.protonum = 0xFF; |
327 | 327 | ||
328 | exp->expectfn = NULL; | 328 | exp->expectfn = NULL; |
@@ -349,7 +349,7 @@ static int sip_help(struct sk_buff **pskb, | |||
349 | const char *dptr; | 349 | const char *dptr; |
350 | int ret = NF_ACCEPT; | 350 | int ret = NF_ACCEPT; |
351 | int matchoff, matchlen; | 351 | int matchoff, matchlen; |
352 | u_int32_t ipaddr; | 352 | __be32 ipaddr; |
353 | u_int16_t port; | 353 | u_int16_t port; |
354 | 354 | ||
355 | /* No Data ? */ | 355 | /* No Data ? */ |
@@ -439,7 +439,7 @@ static int __init init(void) | |||
439 | 439 | ||
440 | sip[i].tuple.dst.protonum = IPPROTO_UDP; | 440 | sip[i].tuple.dst.protonum = IPPROTO_UDP; |
441 | sip[i].tuple.src.u.udp.port = htons(ports[i]); | 441 | sip[i].tuple.src.u.udp.port = htons(ports[i]); |
442 | sip[i].mask.src.u.udp.port = 0xFFFF; | 442 | sip[i].mask.src.u.udp.port = htons(0xFFFF); |
443 | sip[i].mask.dst.protonum = 0xFF; | 443 | sip[i].mask.dst.protonum = 0xFF; |
444 | sip[i].max_expected = 2; | 444 | sip[i].max_expected = 2; |
445 | sip[i].timeout = 3 * 60; /* 3 minutes */ | 445 | sip[i].timeout = 3 * 60; /* 3 minutes */ |
diff --git a/net/ipv4/netfilter/ip_conntrack_tftp.c b/net/ipv4/netfilter/ip_conntrack_tftp.c index 7e33d3bed5e3..fe0b634dd377 100644 --- a/net/ipv4/netfilter/ip_conntrack_tftp.c +++ b/net/ipv4/netfilter/ip_conntrack_tftp.c | |||
@@ -70,10 +70,10 @@ static int tftp_help(struct sk_buff **pskb, | |||
70 | return NF_DROP; | 70 | return NF_DROP; |
71 | 71 | ||
72 | exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; | 72 | exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY].tuple; |
73 | exp->mask.src.ip = 0xffffffff; | 73 | exp->mask.src.ip = htonl(0xffffffff); |
74 | exp->mask.src.u.udp.port = 0; | 74 | exp->mask.src.u.udp.port = 0; |
75 | exp->mask.dst.ip = 0xffffffff; | 75 | exp->mask.dst.ip = htonl(0xffffffff); |
76 | exp->mask.dst.u.udp.port = 0xffff; | 76 | exp->mask.dst.u.udp.port = htons(0xffff); |
77 | exp->mask.dst.protonum = 0xff; | 77 | exp->mask.dst.protonum = 0xff; |
78 | exp->expectfn = NULL; | 78 | exp->expectfn = NULL; |
79 | exp->flags = 0; | 79 | exp->flags = 0; |
@@ -129,7 +129,7 @@ static int __init ip_conntrack_tftp_init(void) | |||
129 | tftp[i].tuple.dst.protonum = IPPROTO_UDP; | 129 | tftp[i].tuple.dst.protonum = IPPROTO_UDP; |
130 | tftp[i].tuple.src.u.udp.port = htons(ports[i]); | 130 | tftp[i].tuple.src.u.udp.port = htons(ports[i]); |
131 | tftp[i].mask.dst.protonum = 0xFF; | 131 | tftp[i].mask.dst.protonum = 0xFF; |
132 | tftp[i].mask.src.u.udp.port = 0xFFFF; | 132 | tftp[i].mask.src.u.udp.port = htons(0xFFFF); |
133 | tftp[i].max_expected = 1; | 133 | tftp[i].max_expected = 1; |
134 | tftp[i].timeout = 5 * 60; /* 5 minutes */ | 134 | tftp[i].timeout = 5 * 60; /* 5 minutes */ |
135 | tftp[i].me = THIS_MODULE; | 135 | tftp[i].me = THIS_MODULE; |
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c index 71f3e09cbc84..4b6260a97408 100644 --- a/net/ipv4/netfilter/ip_nat_core.c +++ b/net/ipv4/netfilter/ip_nat_core.c | |||
@@ -82,7 +82,7 @@ static inline unsigned int | |||
82 | hash_by_src(const struct ip_conntrack_tuple *tuple) | 82 | hash_by_src(const struct ip_conntrack_tuple *tuple) |
83 | { | 83 | { |
84 | /* Original src, to ensure we map it consistently if poss. */ | 84 | /* Original src, to ensure we map it consistently if poss. */ |
85 | return jhash_3words(tuple->src.ip, tuple->src.u.all, | 85 | return jhash_3words((__force u32)tuple->src.ip, tuple->src.u.all, |
86 | tuple->dst.protonum, 0) % ip_nat_htable_size; | 86 | tuple->dst.protonum, 0) % ip_nat_htable_size; |
87 | } | 87 | } |
88 | 88 | ||
@@ -190,7 +190,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, | |||
190 | const struct ip_conntrack *conntrack, | 190 | const struct ip_conntrack *conntrack, |
191 | enum ip_nat_manip_type maniptype) | 191 | enum ip_nat_manip_type maniptype) |
192 | { | 192 | { |
193 | u_int32_t *var_ipp; | 193 | __be32 *var_ipp; |
194 | /* Host order */ | 194 | /* Host order */ |
195 | u_int32_t minip, maxip, j; | 195 | u_int32_t minip, maxip, j; |
196 | 196 | ||
@@ -217,7 +217,7 @@ find_best_ips_proto(struct ip_conntrack_tuple *tuple, | |||
217 | * like this), even across reboots. */ | 217 | * like this), even across reboots. */ |
218 | minip = ntohl(range->min_ip); | 218 | minip = ntohl(range->min_ip); |
219 | maxip = ntohl(range->max_ip); | 219 | maxip = ntohl(range->max_ip); |
220 | j = jhash_2words(tuple->src.ip, tuple->dst.ip, 0); | 220 | j = jhash_2words((__force u32)tuple->src.ip, (__force u32)tuple->dst.ip, 0); |
221 | *var_ipp = htonl(minip + j % (maxip - minip + 1)); | 221 | *var_ipp = htonl(minip + j % (maxip - minip + 1)); |
222 | } | 222 | } |
223 | 223 | ||
@@ -534,9 +534,9 @@ int | |||
534 | ip_nat_port_range_to_nfattr(struct sk_buff *skb, | 534 | ip_nat_port_range_to_nfattr(struct sk_buff *skb, |
535 | const struct ip_nat_range *range) | 535 | const struct ip_nat_range *range) |
536 | { | 536 | { |
537 | NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(u_int16_t), | 537 | NFA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16), |
538 | &range->min.tcp.port); | 538 | &range->min.tcp.port); |
539 | NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(u_int16_t), | 539 | NFA_PUT(skb, CTA_PROTONAT_PORT_MAX, sizeof(__be16), |
540 | &range->max.tcp.port); | 540 | &range->max.tcp.port); |
541 | 541 | ||
542 | return 0; | 542 | return 0; |
@@ -555,7 +555,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) | |||
555 | if (tb[CTA_PROTONAT_PORT_MIN-1]) { | 555 | if (tb[CTA_PROTONAT_PORT_MIN-1]) { |
556 | ret = 1; | 556 | ret = 1; |
557 | range->min.tcp.port = | 557 | range->min.tcp.port = |
558 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); | 558 | *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MIN-1]); |
559 | } | 559 | } |
560 | 560 | ||
561 | if (!tb[CTA_PROTONAT_PORT_MAX-1]) { | 561 | if (!tb[CTA_PROTONAT_PORT_MAX-1]) { |
@@ -564,7 +564,7 @@ ip_nat_port_nfattr_to_range(struct nfattr *tb[], struct ip_nat_range *range) | |||
564 | } else { | 564 | } else { |
565 | ret = 1; | 565 | ret = 1; |
566 | range->max.tcp.port = | 566 | range->max.tcp.port = |
567 | *(u_int16_t *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); | 567 | *(__be16 *)NFA_DATA(tb[CTA_PROTONAT_PORT_MAX-1]); |
568 | } | 568 | } |
569 | 569 | ||
570 | return ret; | 570 | return ret; |
diff --git a/net/ipv4/netfilter/ip_nat_ftp.c b/net/ipv4/netfilter/ip_nat_ftp.c index 3328fc5c5f50..a71c233d8112 100644 --- a/net/ipv4/netfilter/ip_nat_ftp.c +++ b/net/ipv4/netfilter/ip_nat_ftp.c | |||
@@ -34,7 +34,7 @@ MODULE_DESCRIPTION("ftp NAT helper"); | |||
34 | 34 | ||
35 | static int | 35 | static int |
36 | mangle_rfc959_packet(struct sk_buff **pskb, | 36 | mangle_rfc959_packet(struct sk_buff **pskb, |
37 | u_int32_t newip, | 37 | __be32 newip, |
38 | u_int16_t port, | 38 | u_int16_t port, |
39 | unsigned int matchoff, | 39 | unsigned int matchoff, |
40 | unsigned int matchlen, | 40 | unsigned int matchlen, |
@@ -57,7 +57,7 @@ mangle_rfc959_packet(struct sk_buff **pskb, | |||
57 | /* |1|132.235.1.2|6275| */ | 57 | /* |1|132.235.1.2|6275| */ |
58 | static int | 58 | static int |
59 | mangle_eprt_packet(struct sk_buff **pskb, | 59 | mangle_eprt_packet(struct sk_buff **pskb, |
60 | u_int32_t newip, | 60 | __be32 newip, |
61 | u_int16_t port, | 61 | u_int16_t port, |
62 | unsigned int matchoff, | 62 | unsigned int matchoff, |
63 | unsigned int matchlen, | 63 | unsigned int matchlen, |
@@ -79,7 +79,7 @@ mangle_eprt_packet(struct sk_buff **pskb, | |||
79 | /* |1|132.235.1.2|6275| */ | 79 | /* |1|132.235.1.2|6275| */ |
80 | static int | 80 | static int |
81 | mangle_epsv_packet(struct sk_buff **pskb, | 81 | mangle_epsv_packet(struct sk_buff **pskb, |
82 | u_int32_t newip, | 82 | __be32 newip, |
83 | u_int16_t port, | 83 | u_int16_t port, |
84 | unsigned int matchoff, | 84 | unsigned int matchoff, |
85 | unsigned int matchlen, | 85 | unsigned int matchlen, |
@@ -98,7 +98,7 @@ mangle_epsv_packet(struct sk_buff **pskb, | |||
98 | matchlen, buffer, strlen(buffer)); | 98 | matchlen, buffer, strlen(buffer)); |
99 | } | 99 | } |
100 | 100 | ||
101 | static int (*mangle[])(struct sk_buff **, u_int32_t, u_int16_t, | 101 | static int (*mangle[])(struct sk_buff **, __be32, u_int16_t, |
102 | unsigned int, | 102 | unsigned int, |
103 | unsigned int, | 103 | unsigned int, |
104 | struct ip_conntrack *, | 104 | struct ip_conntrack *, |
@@ -120,7 +120,7 @@ static unsigned int ip_nat_ftp(struct sk_buff **pskb, | |||
120 | struct ip_conntrack_expect *exp, | 120 | struct ip_conntrack_expect *exp, |
121 | u32 *seq) | 121 | u32 *seq) |
122 | { | 122 | { |
123 | u_int32_t newip; | 123 | __be32 newip; |
124 | u_int16_t port; | 124 | u_int16_t port; |
125 | int dir = CTINFO2DIR(ctinfo); | 125 | int dir = CTINFO2DIR(ctinfo); |
126 | struct ip_conntrack *ct = exp->master; | 126 | struct ip_conntrack *ct = exp->master; |
diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c index 7f6a75984f6c..3bf858480558 100644 --- a/net/ipv4/netfilter/ip_nat_helper.c +++ b/net/ipv4/netfilter/ip_nat_helper.c | |||
@@ -189,7 +189,7 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, | |||
189 | datalen, 0)); | 189 | datalen, 0)); |
190 | } else | 190 | } else |
191 | tcph->check = nf_proto_csum_update(*pskb, | 191 | tcph->check = nf_proto_csum_update(*pskb, |
192 | htons(oldlen) ^ 0xFFFF, | 192 | htons(oldlen) ^ htons(0xFFFF), |
193 | htons(datalen), | 193 | htons(datalen), |
194 | tcph->check, 1); | 194 | tcph->check, 1); |
195 | 195 | ||
@@ -267,7 +267,7 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, | |||
267 | udph->check = -1; | 267 | udph->check = -1; |
268 | } else | 268 | } else |
269 | udph->check = nf_proto_csum_update(*pskb, | 269 | udph->check = nf_proto_csum_update(*pskb, |
270 | htons(oldlen) ^ 0xFFFF, | 270 | htons(oldlen) ^ htons(0xFFFF), |
271 | htons(datalen), | 271 | htons(datalen), |
272 | udph->check, 1); | 272 | udph->check, 1); |
273 | return 1; | 273 | return 1; |
@@ -283,27 +283,25 @@ sack_adjust(struct sk_buff *skb, | |||
283 | struct ip_nat_seq *natseq) | 283 | struct ip_nat_seq *natseq) |
284 | { | 284 | { |
285 | while (sackoff < sackend) { | 285 | while (sackoff < sackend) { |
286 | struct tcp_sack_block *sack; | 286 | struct tcp_sack_block_wire *sack; |
287 | u_int32_t new_start_seq, new_end_seq; | 287 | __be32 new_start_seq, new_end_seq; |
288 | 288 | ||
289 | sack = (void *)skb->data + sackoff; | 289 | sack = (void *)skb->data + sackoff; |
290 | if (after(ntohl(sack->start_seq) - natseq->offset_before, | 290 | if (after(ntohl(sack->start_seq) - natseq->offset_before, |
291 | natseq->correction_pos)) | 291 | natseq->correction_pos)) |
292 | new_start_seq = ntohl(sack->start_seq) | 292 | new_start_seq = htonl(ntohl(sack->start_seq) |
293 | - natseq->offset_after; | 293 | - natseq->offset_after); |
294 | else | 294 | else |
295 | new_start_seq = ntohl(sack->start_seq) | 295 | new_start_seq = htonl(ntohl(sack->start_seq) |
296 | - natseq->offset_before; | 296 | - natseq->offset_before); |
297 | new_start_seq = htonl(new_start_seq); | ||
298 | 297 | ||
299 | if (after(ntohl(sack->end_seq) - natseq->offset_before, | 298 | if (after(ntohl(sack->end_seq) - natseq->offset_before, |
300 | natseq->correction_pos)) | 299 | natseq->correction_pos)) |
301 | new_end_seq = ntohl(sack->end_seq) | 300 | new_end_seq = htonl(ntohl(sack->end_seq) |
302 | - natseq->offset_after; | 301 | - natseq->offset_after); |
303 | else | 302 | else |
304 | new_end_seq = ntohl(sack->end_seq) | 303 | new_end_seq = htonl(ntohl(sack->end_seq) |
305 | - natseq->offset_before; | 304 | - natseq->offset_before); |
306 | new_end_seq = htonl(new_end_seq); | ||
307 | 305 | ||
308 | DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", | 306 | DEBUGP("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n", |
309 | ntohl(sack->start_seq), new_start_seq, | 307 | ntohl(sack->start_seq), new_start_seq, |
@@ -375,7 +373,8 @@ ip_nat_seq_adjust(struct sk_buff **pskb, | |||
375 | enum ip_conntrack_info ctinfo) | 373 | enum ip_conntrack_info ctinfo) |
376 | { | 374 | { |
377 | struct tcphdr *tcph; | 375 | struct tcphdr *tcph; |
378 | int dir, newseq, newack; | 376 | int dir; |
377 | __be32 newseq, newack; | ||
379 | struct ip_nat_seq *this_way, *other_way; | 378 | struct ip_nat_seq *this_way, *other_way; |
380 | 379 | ||
381 | dir = CTINFO2DIR(ctinfo); | 380 | dir = CTINFO2DIR(ctinfo); |
@@ -388,17 +387,15 @@ ip_nat_seq_adjust(struct sk_buff **pskb, | |||
388 | 387 | ||
389 | tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4; | 388 | tcph = (void *)(*pskb)->data + (*pskb)->nh.iph->ihl*4; |
390 | if (after(ntohl(tcph->seq), this_way->correction_pos)) | 389 | if (after(ntohl(tcph->seq), this_way->correction_pos)) |
391 | newseq = ntohl(tcph->seq) + this_way->offset_after; | 390 | newseq = htonl(ntohl(tcph->seq) + this_way->offset_after); |
392 | else | 391 | else |
393 | newseq = ntohl(tcph->seq) + this_way->offset_before; | 392 | newseq = htonl(ntohl(tcph->seq) + this_way->offset_before); |
394 | newseq = htonl(newseq); | ||
395 | 393 | ||
396 | if (after(ntohl(tcph->ack_seq) - other_way->offset_before, | 394 | if (after(ntohl(tcph->ack_seq) - other_way->offset_before, |
397 | other_way->correction_pos)) | 395 | other_way->correction_pos)) |
398 | newack = ntohl(tcph->ack_seq) - other_way->offset_after; | 396 | newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_after); |
399 | else | 397 | else |
400 | newack = ntohl(tcph->ack_seq) - other_way->offset_before; | 398 | newack = htonl(ntohl(tcph->ack_seq) - other_way->offset_before); |
401 | newack = htonl(newack); | ||
402 | 399 | ||
403 | tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq, | 400 | tcph->check = nf_proto_csum_update(*pskb, ~tcph->seq, newseq, |
404 | tcph->check, 0); | 401 | tcph->check, 0); |
diff --git a/net/ipv4/netfilter/ip_nat_helper_h323.c b/net/ipv4/netfilter/ip_nat_helper_h323.c index 419b878fb467..4a7d34466ee2 100644 --- a/net/ipv4/netfilter/ip_nat_helper_h323.c +++ b/net/ipv4/netfilter/ip_nat_helper_h323.c | |||
@@ -32,13 +32,13 @@ | |||
32 | /****************************************************************************/ | 32 | /****************************************************************************/ |
33 | static int set_addr(struct sk_buff **pskb, | 33 | static int set_addr(struct sk_buff **pskb, |
34 | unsigned char **data, int dataoff, | 34 | unsigned char **data, int dataoff, |
35 | unsigned int addroff, u_int32_t ip, u_int16_t port) | 35 | unsigned int addroff, __be32 ip, u_int16_t port) |
36 | { | 36 | { |
37 | enum ip_conntrack_info ctinfo; | 37 | enum ip_conntrack_info ctinfo; |
38 | struct ip_conntrack *ct = ip_conntrack_get(*pskb, &ctinfo); | 38 | struct ip_conntrack *ct = ip_conntrack_get(*pskb, &ctinfo); |
39 | struct { | 39 | struct { |
40 | u_int32_t ip; | 40 | __be32 ip; |
41 | u_int16_t port; | 41 | __be16 port; |
42 | } __attribute__ ((__packed__)) buf; | 42 | } __attribute__ ((__packed__)) buf; |
43 | struct tcphdr _tcph, *th; | 43 | struct tcphdr _tcph, *th; |
44 | 44 | ||
@@ -86,7 +86,7 @@ static int set_addr(struct sk_buff **pskb, | |||
86 | static int set_h225_addr(struct sk_buff **pskb, | 86 | static int set_h225_addr(struct sk_buff **pskb, |
87 | unsigned char **data, int dataoff, | 87 | unsigned char **data, int dataoff, |
88 | TransportAddress * addr, | 88 | TransportAddress * addr, |
89 | u_int32_t ip, u_int16_t port) | 89 | __be32 ip, u_int16_t port) |
90 | { | 90 | { |
91 | return set_addr(pskb, data, dataoff, addr->ipAddress.ip, ip, port); | 91 | return set_addr(pskb, data, dataoff, addr->ipAddress.ip, ip, port); |
92 | } | 92 | } |
@@ -95,7 +95,7 @@ static int set_h225_addr(struct sk_buff **pskb, | |||
95 | static int set_h245_addr(struct sk_buff **pskb, | 95 | static int set_h245_addr(struct sk_buff **pskb, |
96 | unsigned char **data, int dataoff, | 96 | unsigned char **data, int dataoff, |
97 | H245_TransportAddress * addr, | 97 | H245_TransportAddress * addr, |
98 | u_int32_t ip, u_int16_t port) | 98 | __be32 ip, u_int16_t port) |
99 | { | 99 | { |
100 | return set_addr(pskb, data, dataoff, | 100 | return set_addr(pskb, data, dataoff, |
101 | addr->unicastAddress.iPAddress.network, ip, port); | 101 | addr->unicastAddress.iPAddress.network, ip, port); |
@@ -110,7 +110,7 @@ static int set_sig_addr(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
110 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; | 110 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; |
111 | int dir = CTINFO2DIR(ctinfo); | 111 | int dir = CTINFO2DIR(ctinfo); |
112 | int i; | 112 | int i; |
113 | u_int32_t ip; | 113 | __be32 ip; |
114 | u_int16_t port; | 114 | u_int16_t port; |
115 | 115 | ||
116 | for (i = 0; i < count; i++) { | 116 | for (i = 0; i < count; i++) { |
@@ -164,7 +164,7 @@ static int set_ras_addr(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
164 | { | 164 | { |
165 | int dir = CTINFO2DIR(ctinfo); | 165 | int dir = CTINFO2DIR(ctinfo); |
166 | int i; | 166 | int i; |
167 | u_int32_t ip; | 167 | __be32 ip; |
168 | u_int16_t port; | 168 | u_int16_t port; |
169 | 169 | ||
170 | for (i = 0; i < count; i++) { | 170 | for (i = 0; i < count; i++) { |
@@ -433,7 +433,7 @@ static int nat_q931(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
433 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; | 433 | struct ip_ct_h323_master *info = &ct->help.ct_h323_info; |
434 | int dir = CTINFO2DIR(ctinfo); | 434 | int dir = CTINFO2DIR(ctinfo); |
435 | u_int16_t nated_port = port; | 435 | u_int16_t nated_port = port; |
436 | u_int32_t ip; | 436 | __be32 ip; |
437 | 437 | ||
438 | /* Set expectations for NAT */ | 438 | /* Set expectations for NAT */ |
439 | exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; | 439 | exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; |
diff --git a/net/ipv4/netfilter/ip_nat_helper_pptp.c b/net/ipv4/netfilter/ip_nat_helper_pptp.c index 2ff578807123..329fdcd7d702 100644 --- a/net/ipv4/netfilter/ip_nat_helper_pptp.c +++ b/net/ipv4/netfilter/ip_nat_helper_pptp.c | |||
@@ -51,7 +51,7 @@ | |||
51 | 51 | ||
52 | #define IP_NAT_PPTP_VERSION "3.0" | 52 | #define IP_NAT_PPTP_VERSION "3.0" |
53 | 53 | ||
54 | #define REQ_CID(req, off) (*(u_int16_t *)((char *)(req) + (off))) | 54 | #define REQ_CID(req, off) (*(__be16 *)((char *)(req) + (off))) |
55 | 55 | ||
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | 57 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
diff --git a/net/ipv4/netfilter/ip_nat_proto_icmp.c b/net/ipv4/netfilter/ip_nat_proto_icmp.c index ec50cc295317..3f6efc13ac74 100644 --- a/net/ipv4/netfilter/ip_nat_proto_icmp.c +++ b/net/ipv4/netfilter/ip_nat_proto_icmp.c | |||
@@ -67,7 +67,7 @@ icmp_manip_pkt(struct sk_buff **pskb, | |||
67 | 67 | ||
68 | hdr = (struct icmphdr *)((*pskb)->data + hdroff); | 68 | hdr = (struct icmphdr *)((*pskb)->data + hdroff); |
69 | hdr->checksum = nf_proto_csum_update(*pskb, | 69 | hdr->checksum = nf_proto_csum_update(*pskb, |
70 | hdr->un.echo.id ^ 0xFFFF, | 70 | hdr->un.echo.id ^ htons(0xFFFF), |
71 | tuple->src.u.icmp.id, | 71 | tuple->src.u.icmp.id, |
72 | hdr->checksum, 0); | 72 | hdr->checksum, 0); |
73 | hdr->un.echo.id = tuple->src.u.icmp.id; | 73 | hdr->un.echo.id = tuple->src.u.icmp.id; |
diff --git a/net/ipv4/netfilter/ip_nat_proto_tcp.c b/net/ipv4/netfilter/ip_nat_proto_tcp.c index 72a6307bd2db..12deb13b93b1 100644 --- a/net/ipv4/netfilter/ip_nat_proto_tcp.c +++ b/net/ipv4/netfilter/ip_nat_proto_tcp.c | |||
@@ -24,7 +24,7 @@ tcp_in_range(const struct ip_conntrack_tuple *tuple, | |||
24 | const union ip_conntrack_manip_proto *min, | 24 | const union ip_conntrack_manip_proto *min, |
25 | const union ip_conntrack_manip_proto *max) | 25 | const union ip_conntrack_manip_proto *max) |
26 | { | 26 | { |
27 | u_int16_t port; | 27 | __be16 port; |
28 | 28 | ||
29 | if (maniptype == IP_NAT_MANIP_SRC) | 29 | if (maniptype == IP_NAT_MANIP_SRC) |
30 | port = tuple->src.u.tcp.port; | 30 | port = tuple->src.u.tcp.port; |
@@ -42,7 +42,7 @@ tcp_unique_tuple(struct ip_conntrack_tuple *tuple, | |||
42 | const struct ip_conntrack *conntrack) | 42 | const struct ip_conntrack *conntrack) |
43 | { | 43 | { |
44 | static u_int16_t port; | 44 | static u_int16_t port; |
45 | u_int16_t *portptr; | 45 | __be16 *portptr; |
46 | unsigned int range_size, min, i; | 46 | unsigned int range_size, min, i; |
47 | 47 | ||
48 | if (maniptype == IP_NAT_MANIP_SRC) | 48 | if (maniptype == IP_NAT_MANIP_SRC) |
@@ -93,8 +93,8 @@ tcp_manip_pkt(struct sk_buff **pskb, | |||
93 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); | 93 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); |
94 | struct tcphdr *hdr; | 94 | struct tcphdr *hdr; |
95 | unsigned int hdroff = iphdroff + iph->ihl*4; | 95 | unsigned int hdroff = iphdroff + iph->ihl*4; |
96 | u32 oldip, newip; | 96 | __be32 oldip, newip; |
97 | u16 *portptr, newport, oldport; | 97 | __be16 *portptr, newport, oldport; |
98 | int hdrsize = 8; /* TCP connection tracking guarantees this much */ | 98 | int hdrsize = 8; /* TCP connection tracking guarantees this much */ |
99 | 99 | ||
100 | /* this could be a inner header returned in icmp packet; in such | 100 | /* this could be a inner header returned in icmp packet; in such |
@@ -130,7 +130,7 @@ tcp_manip_pkt(struct sk_buff **pskb, | |||
130 | return 1; | 130 | return 1; |
131 | 131 | ||
132 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, hdr->check, 1); | 132 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, hdr->check, 1); |
133 | hdr->check = nf_proto_csum_update(*pskb, oldport ^ 0xFFFF, newport, | 133 | hdr->check = nf_proto_csum_update(*pskb, oldport ^ htons(0xFFFF), newport, |
134 | hdr->check, 0); | 134 | hdr->check, 0); |
135 | return 1; | 135 | return 1; |
136 | } | 136 | } |
diff --git a/net/ipv4/netfilter/ip_nat_proto_udp.c b/net/ipv4/netfilter/ip_nat_proto_udp.c index 5da196ae758c..4bbec7730d18 100644 --- a/net/ipv4/netfilter/ip_nat_proto_udp.c +++ b/net/ipv4/netfilter/ip_nat_proto_udp.c | |||
@@ -24,7 +24,7 @@ udp_in_range(const struct ip_conntrack_tuple *tuple, | |||
24 | const union ip_conntrack_manip_proto *min, | 24 | const union ip_conntrack_manip_proto *min, |
25 | const union ip_conntrack_manip_proto *max) | 25 | const union ip_conntrack_manip_proto *max) |
26 | { | 26 | { |
27 | u_int16_t port; | 27 | __be16 port; |
28 | 28 | ||
29 | if (maniptype == IP_NAT_MANIP_SRC) | 29 | if (maniptype == IP_NAT_MANIP_SRC) |
30 | port = tuple->src.u.udp.port; | 30 | port = tuple->src.u.udp.port; |
@@ -42,7 +42,7 @@ udp_unique_tuple(struct ip_conntrack_tuple *tuple, | |||
42 | const struct ip_conntrack *conntrack) | 42 | const struct ip_conntrack *conntrack) |
43 | { | 43 | { |
44 | static u_int16_t port; | 44 | static u_int16_t port; |
45 | u_int16_t *portptr; | 45 | __be16 *portptr; |
46 | unsigned int range_size, min, i; | 46 | unsigned int range_size, min, i; |
47 | 47 | ||
48 | if (maniptype == IP_NAT_MANIP_SRC) | 48 | if (maniptype == IP_NAT_MANIP_SRC) |
@@ -91,8 +91,8 @@ udp_manip_pkt(struct sk_buff **pskb, | |||
91 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); | 91 | struct iphdr *iph = (struct iphdr *)((*pskb)->data + iphdroff); |
92 | struct udphdr *hdr; | 92 | struct udphdr *hdr; |
93 | unsigned int hdroff = iphdroff + iph->ihl*4; | 93 | unsigned int hdroff = iphdroff + iph->ihl*4; |
94 | u32 oldip, newip; | 94 | __be32 oldip, newip; |
95 | u16 *portptr, newport; | 95 | __be16 *portptr, newport; |
96 | 96 | ||
97 | if (!skb_make_writable(pskb, hdroff + sizeof(*hdr))) | 97 | if (!skb_make_writable(pskb, hdroff + sizeof(*hdr))) |
98 | return 0; | 98 | return 0; |
@@ -118,7 +118,7 @@ udp_manip_pkt(struct sk_buff **pskb, | |||
118 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, | 118 | hdr->check = nf_proto_csum_update(*pskb, ~oldip, newip, |
119 | hdr->check, 1); | 119 | hdr->check, 1); |
120 | hdr->check = nf_proto_csum_update(*pskb, | 120 | hdr->check = nf_proto_csum_update(*pskb, |
121 | *portptr ^ 0xFFFF, newport, | 121 | *portptr ^ htons(0xFFFF), newport, |
122 | hdr->check, 0); | 122 | hdr->check, 0); |
123 | if (!hdr->check) | 123 | if (!hdr->check) |
124 | hdr->check = -1; | 124 | hdr->check = -1; |
diff --git a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c index 7b703839aa58..a176aa3031e0 100644 --- a/net/ipv4/netfilter/ip_nat_rule.c +++ b/net/ipv4/netfilter/ip_nat_rule.c | |||
@@ -119,7 +119,7 @@ static unsigned int ipt_snat_target(struct sk_buff **pskb, | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /* Before 2.6.11 we did implicit source NAT if required. Warn about change. */ | 121 | /* Before 2.6.11 we did implicit source NAT if required. Warn about change. */ |
122 | static void warn_if_extra_mangle(u32 dstip, u32 srcip) | 122 | static void warn_if_extra_mangle(__be32 dstip, __be32 srcip) |
123 | { | 123 | { |
124 | static int warned = 0; | 124 | static int warned = 0; |
125 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } }; | 125 | struct flowi fl = { .nl_u = { .ip4_u = { .daddr = dstip } } }; |
@@ -205,7 +205,7 @@ alloc_null_binding(struct ip_conntrack *conntrack, | |||
205 | per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). | 205 | per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). |
206 | Use reply in case it's already been mangled (eg local packet). | 206 | Use reply in case it's already been mangled (eg local packet). |
207 | */ | 207 | */ |
208 | u_int32_t ip | 208 | __be32 ip |
209 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC | 209 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC |
210 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip | 210 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip |
211 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); | 211 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); |
@@ -222,7 +222,7 @@ alloc_null_binding_confirmed(struct ip_conntrack *conntrack, | |||
222 | struct ip_nat_info *info, | 222 | struct ip_nat_info *info, |
223 | unsigned int hooknum) | 223 | unsigned int hooknum) |
224 | { | 224 | { |
225 | u_int32_t ip | 225 | __be32 ip |
226 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC | 226 | = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC |
227 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip | 227 | ? conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip |
228 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); | 228 | : conntrack->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip); |
diff --git a/net/ipv4/netfilter/ip_nat_sip.c b/net/ipv4/netfilter/ip_nat_sip.c index 6ffba63adca2..71fc2730a007 100644 --- a/net/ipv4/netfilter/ip_nat_sip.c +++ b/net/ipv4/netfilter/ip_nat_sip.c | |||
@@ -60,8 +60,8 @@ static unsigned int ip_nat_sip(struct sk_buff **pskb, | |||
60 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); | 60 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); |
61 | char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; | 61 | char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; |
62 | unsigned int bufflen, dataoff; | 62 | unsigned int bufflen, dataoff; |
63 | u_int32_t ip; | 63 | __be32 ip; |
64 | u_int16_t port; | 64 | __be16 port; |
65 | 65 | ||
66 | dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); | 66 | dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); |
67 | 67 | ||
@@ -159,7 +159,7 @@ static int mangle_content_len(struct sk_buff **pskb, | |||
159 | static unsigned int mangle_sdp(struct sk_buff **pskb, | 159 | static unsigned int mangle_sdp(struct sk_buff **pskb, |
160 | enum ip_conntrack_info ctinfo, | 160 | enum ip_conntrack_info ctinfo, |
161 | struct ip_conntrack *ct, | 161 | struct ip_conntrack *ct, |
162 | u_int32_t newip, u_int16_t port, | 162 | __be32 newip, u_int16_t port, |
163 | const char *dptr) | 163 | const char *dptr) |
164 | { | 164 | { |
165 | char buffer[sizeof("nnn.nnn.nnn.nnn")]; | 165 | char buffer[sizeof("nnn.nnn.nnn.nnn")]; |
@@ -195,7 +195,7 @@ static unsigned int ip_nat_sdp(struct sk_buff **pskb, | |||
195 | { | 195 | { |
196 | struct ip_conntrack *ct = exp->master; | 196 | struct ip_conntrack *ct = exp->master; |
197 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); | 197 | enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); |
198 | u_int32_t newip; | 198 | __be32 newip; |
199 | u_int16_t port; | 199 | u_int16_t port; |
200 | 200 | ||
201 | DEBUGP("ip_nat_sdp():\n"); | 201 | DEBUGP("ip_nat_sdp():\n"); |
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c index 18b7fbdccb61..168f45fa1898 100644 --- a/net/ipv4/netfilter/ip_nat_snmp_basic.c +++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c | |||
@@ -1211,7 +1211,7 @@ static int snmp_translate(struct ip_conntrack *ct, | |||
1211 | struct sk_buff **pskb) | 1211 | struct sk_buff **pskb) |
1212 | { | 1212 | { |
1213 | struct iphdr *iph = (*pskb)->nh.iph; | 1213 | struct iphdr *iph = (*pskb)->nh.iph; |
1214 | struct udphdr *udph = (struct udphdr *)((u_int32_t *)iph + iph->ihl); | 1214 | struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl); |
1215 | u_int16_t udplen = ntohs(udph->len); | 1215 | u_int16_t udplen = ntohs(udph->len); |
1216 | u_int16_t paylen = udplen - sizeof(struct udphdr); | 1216 | u_int16_t paylen = udplen - sizeof(struct udphdr); |
1217 | int dir = CTINFO2DIR(ctinfo); | 1217 | int dir = CTINFO2DIR(ctinfo); |
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c index 9c577db62047..021395b67463 100644 --- a/net/ipv4/netfilter/ip_nat_standalone.c +++ b/net/ipv4/netfilter/ip_nat_standalone.c | |||
@@ -191,7 +191,7 @@ ip_nat_in(unsigned int hooknum, | |||
191 | int (*okfn)(struct sk_buff *)) | 191 | int (*okfn)(struct sk_buff *)) |
192 | { | 192 | { |
193 | unsigned int ret; | 193 | unsigned int ret; |
194 | u_int32_t daddr = (*pskb)->nh.iph->daddr; | 194 | __be32 daddr = (*pskb)->nh.iph->daddr; |
195 | 195 | ||
196 | ret = ip_nat_fn(hooknum, pskb, in, out, okfn); | 196 | ret = ip_nat_fn(hooknum, pskb, in, out, okfn); |
197 | if (ret != NF_DROP && ret != NF_STOLEN | 197 | if (ret != NF_DROP && ret != NF_STOLEN |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 41589665fc5d..7a29d6e7baa7 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -52,7 +52,7 @@ struct clusterip_config { | |||
52 | atomic_t entries; /* number of entries/rules | 52 | atomic_t entries; /* number of entries/rules |
53 | * referencing us */ | 53 | * referencing us */ |
54 | 54 | ||
55 | u_int32_t clusterip; /* the IP address */ | 55 | __be32 clusterip; /* the IP address */ |
56 | u_int8_t clustermac[ETH_ALEN]; /* the MAC address */ | 56 | u_int8_t clustermac[ETH_ALEN]; /* the MAC address */ |
57 | struct net_device *dev; /* device */ | 57 | struct net_device *dev; /* device */ |
58 | u_int16_t num_total_nodes; /* total number of nodes */ | 58 | u_int16_t num_total_nodes; /* total number of nodes */ |
@@ -119,7 +119,7 @@ clusterip_config_entry_put(struct clusterip_config *c) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | static struct clusterip_config * | 121 | static struct clusterip_config * |
122 | __clusterip_config_find(u_int32_t clusterip) | 122 | __clusterip_config_find(__be32 clusterip) |
123 | { | 123 | { |
124 | struct list_head *pos; | 124 | struct list_head *pos; |
125 | 125 | ||
@@ -136,7 +136,7 @@ __clusterip_config_find(u_int32_t clusterip) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | static inline struct clusterip_config * | 138 | static inline struct clusterip_config * |
139 | clusterip_config_find_get(u_int32_t clusterip, int entry) | 139 | clusterip_config_find_get(__be32 clusterip, int entry) |
140 | { | 140 | { |
141 | struct clusterip_config *c; | 141 | struct clusterip_config *c; |
142 | 142 | ||
@@ -166,7 +166,7 @@ clusterip_config_init_nodelist(struct clusterip_config *c, | |||
166 | } | 166 | } |
167 | 167 | ||
168 | static struct clusterip_config * | 168 | static struct clusterip_config * |
169 | clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip, | 169 | clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip, |
170 | struct net_device *dev) | 170 | struct net_device *dev) |
171 | { | 171 | { |
172 | struct clusterip_config *c; | 172 | struct clusterip_config *c; |
@@ -387,7 +387,7 @@ checkentry(const char *tablename, | |||
387 | return 0; | 387 | return 0; |
388 | 388 | ||
389 | } | 389 | } |
390 | if (e->ip.dmsk.s_addr != 0xffffffff | 390 | if (e->ip.dmsk.s_addr != htonl(0xffffffff) |
391 | || e->ip.dst.s_addr == 0) { | 391 | || e->ip.dst.s_addr == 0) { |
392 | printk(KERN_ERR "CLUSTERIP: Please specify destination IP\n"); | 392 | printk(KERN_ERR "CLUSTERIP: Please specify destination IP\n"); |
393 | return 0; | 393 | return 0; |
@@ -476,9 +476,9 @@ static struct ipt_target clusterip_tgt = { | |||
476 | /* hardcoded for 48bit ethernet and 32bit ipv4 addresses */ | 476 | /* hardcoded for 48bit ethernet and 32bit ipv4 addresses */ |
477 | struct arp_payload { | 477 | struct arp_payload { |
478 | u_int8_t src_hw[ETH_ALEN]; | 478 | u_int8_t src_hw[ETH_ALEN]; |
479 | u_int32_t src_ip; | 479 | __be32 src_ip; |
480 | u_int8_t dst_hw[ETH_ALEN]; | 480 | u_int8_t dst_hw[ETH_ALEN]; |
481 | u_int32_t dst_ip; | 481 | __be32 dst_ip; |
482 | } __attribute__ ((packed)); | 482 | } __attribute__ ((packed)); |
483 | 483 | ||
484 | #ifdef CLUSTERIP_DEBUG | 484 | #ifdef CLUSTERIP_DEBUG |
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c index 23f9c7ebe7eb..12a818a2462f 100644 --- a/net/ipv4/netfilter/ipt_ECN.c +++ b/net/ipv4/netfilter/ipt_ECN.c | |||
@@ -28,7 +28,7 @@ static inline int | |||
28 | set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | 28 | set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) |
29 | { | 29 | { |
30 | struct iphdr *iph = (*pskb)->nh.iph; | 30 | struct iphdr *iph = (*pskb)->nh.iph; |
31 | u_int16_t oldtos; | 31 | __be16 oldtos; |
32 | 32 | ||
33 | if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { | 33 | if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { |
34 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) | 34 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) |
@@ -37,7 +37,7 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | |||
37 | oldtos = iph->tos; | 37 | oldtos = iph->tos; |
38 | iph->tos &= ~IPT_ECN_IP_MASK; | 38 | iph->tos &= ~IPT_ECN_IP_MASK; |
39 | iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); | 39 | iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); |
40 | iph->check = nf_csum_update(oldtos ^ 0xFFFF, iph->tos, | 40 | iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, |
41 | iph->check); | 41 | iph->check); |
42 | } | 42 | } |
43 | return 1; | 43 | return 1; |
@@ -48,7 +48,7 @@ static inline int | |||
48 | set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | 48 | set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) |
49 | { | 49 | { |
50 | struct tcphdr _tcph, *tcph; | 50 | struct tcphdr _tcph, *tcph; |
51 | u_int16_t oldval; | 51 | __be16 oldval; |
52 | 52 | ||
53 | /* Not enought header? */ | 53 | /* Not enought header? */ |
54 | tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4, | 54 | tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4, |
@@ -66,15 +66,15 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) | |||
66 | return 0; | 66 | return 0; |
67 | tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4; | 67 | tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4; |
68 | 68 | ||
69 | oldval = ((u_int16_t *)tcph)[6]; | 69 | oldval = ((__be16 *)tcph)[6]; |
70 | if (einfo->operation & IPT_ECN_OP_SET_ECE) | 70 | if (einfo->operation & IPT_ECN_OP_SET_ECE) |
71 | tcph->ece = einfo->proto.tcp.ece; | 71 | tcph->ece = einfo->proto.tcp.ece; |
72 | if (einfo->operation & IPT_ECN_OP_SET_CWR) | 72 | if (einfo->operation & IPT_ECN_OP_SET_CWR) |
73 | tcph->cwr = einfo->proto.tcp.cwr; | 73 | tcph->cwr = einfo->proto.tcp.cwr; |
74 | 74 | ||
75 | tcph->check = nf_proto_csum_update((*pskb), | 75 | tcph->check = nf_proto_csum_update((*pskb), |
76 | oldval ^ 0xFFFF, | 76 | oldval ^ htons(0xFFFF), |
77 | ((u_int16_t *)tcph)[6], | 77 | ((__be16 *)tcph)[6], |
78 | tcph->check, 0); | 78 | tcph->check, 0); |
79 | return 1; | 79 | return 1; |
80 | } | 80 | } |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index bc65168a3437..3dbfcfac8a84 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -70,7 +70,7 @@ masquerade_target(struct sk_buff **pskb, | |||
70 | const struct ip_nat_multi_range_compat *mr; | 70 | const struct ip_nat_multi_range_compat *mr; |
71 | struct ip_nat_range newrange; | 71 | struct ip_nat_range newrange; |
72 | struct rtable *rt; | 72 | struct rtable *rt; |
73 | u_int32_t newsrc; | 73 | __be32 newsrc; |
74 | 74 | ||
75 | IP_NF_ASSERT(hooknum == NF_IP_POST_ROUTING); | 75 | IP_NF_ASSERT(hooknum == NF_IP_POST_ROUTING); |
76 | 76 | ||
diff --git a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c index beb2914225ff..58a88f227108 100644 --- a/net/ipv4/netfilter/ipt_NETMAP.c +++ b/net/ipv4/netfilter/ipt_NETMAP.c | |||
@@ -58,7 +58,7 @@ target(struct sk_buff **pskb, | |||
58 | { | 58 | { |
59 | struct ip_conntrack *ct; | 59 | struct ip_conntrack *ct; |
60 | enum ip_conntrack_info ctinfo; | 60 | enum ip_conntrack_info ctinfo; |
61 | u_int32_t new_ip, netmask; | 61 | __be32 new_ip, netmask; |
62 | const struct ip_nat_multi_range_compat *mr = targinfo; | 62 | const struct ip_nat_multi_range_compat *mr = targinfo; |
63 | struct ip_nat_range newrange; | 63 | struct ip_nat_range newrange; |
64 | 64 | ||
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index f03d43671c6d..c0dcfe9d610c 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -61,7 +61,7 @@ redirect_target(struct sk_buff **pskb, | |||
61 | { | 61 | { |
62 | struct ip_conntrack *ct; | 62 | struct ip_conntrack *ct; |
63 | enum ip_conntrack_info ctinfo; | 63 | enum ip_conntrack_info ctinfo; |
64 | u_int32_t newdst; | 64 | __be32 newdst; |
65 | const struct ip_nat_multi_range_compat *mr = targinfo; | 65 | const struct ip_nat_multi_range_compat *mr = targinfo; |
66 | struct ip_nat_range newrange; | 66 | struct ip_nat_range newrange; |
67 | 67 | ||
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index b81821edd893..fd0c05efed8a 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -104,8 +104,8 @@ static void send_reset(struct sk_buff *oldskb, int hook) | |||
104 | struct iphdr *iph = oldskb->nh.iph; | 104 | struct iphdr *iph = oldskb->nh.iph; |
105 | struct tcphdr _otcph, *oth, *tcph; | 105 | struct tcphdr _otcph, *oth, *tcph; |
106 | struct rtable *rt; | 106 | struct rtable *rt; |
107 | u_int16_t tmp_port; | 107 | __be16 tmp_port; |
108 | u_int32_t tmp_addr; | 108 | __be32 tmp_addr; |
109 | int needs_ack; | 109 | int needs_ack; |
110 | int hh_len; | 110 | int hh_len; |
111 | 111 | ||
diff --git a/net/ipv4/netfilter/ipt_SAME.c b/net/ipv4/netfilter/ipt_SAME.c index efbcb1198832..b38b13328d73 100644 --- a/net/ipv4/netfilter/ipt_SAME.c +++ b/net/ipv4/netfilter/ipt_SAME.c | |||
@@ -135,7 +135,8 @@ same_target(struct sk_buff **pskb, | |||
135 | { | 135 | { |
136 | struct ip_conntrack *ct; | 136 | struct ip_conntrack *ct; |
137 | enum ip_conntrack_info ctinfo; | 137 | enum ip_conntrack_info ctinfo; |
138 | u_int32_t tmpip, aindex, new_ip; | 138 | u_int32_t tmpip, aindex; |
139 | __be32 new_ip; | ||
139 | const struct ipt_same_info *same = targinfo; | 140 | const struct ipt_same_info *same = targinfo; |
140 | struct ip_nat_range newrange; | 141 | struct ip_nat_range newrange; |
141 | const struct ip_conntrack_tuple *t; | 142 | const struct ip_conntrack_tuple *t; |
diff --git a/net/ipv4/netfilter/ipt_TCPMSS.c b/net/ipv4/netfilter/ipt_TCPMSS.c index 4246c4321e5b..108b6b76311f 100644 --- a/net/ipv4/netfilter/ipt_TCPMSS.c +++ b/net/ipv4/netfilter/ipt_TCPMSS.c | |||
@@ -42,7 +42,8 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
42 | const struct ipt_tcpmss_info *tcpmssinfo = targinfo; | 42 | const struct ipt_tcpmss_info *tcpmssinfo = targinfo; |
43 | struct tcphdr *tcph; | 43 | struct tcphdr *tcph; |
44 | struct iphdr *iph; | 44 | struct iphdr *iph; |
45 | u_int16_t tcplen, newtotlen, oldval, newmss; | 45 | u_int16_t tcplen, newmss; |
46 | __be16 newtotlen, oldval; | ||
46 | unsigned int i; | 47 | unsigned int i; |
47 | u_int8_t *opt; | 48 | u_int8_t *opt; |
48 | 49 | ||
@@ -97,7 +98,7 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
97 | opt[i+3] = (newmss & 0x00ff); | 98 | opt[i+3] = (newmss & 0x00ff); |
98 | 99 | ||
99 | tcph->check = nf_proto_csum_update(*pskb, | 100 | tcph->check = nf_proto_csum_update(*pskb, |
100 | htons(oldmss)^0xFFFF, | 101 | htons(oldmss)^htons(0xFFFF), |
101 | htons(newmss), | 102 | htons(newmss), |
102 | tcph->check, 0); | 103 | tcph->check, 0); |
103 | return IPT_CONTINUE; | 104 | return IPT_CONTINUE; |
@@ -126,7 +127,7 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
126 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); | 127 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); |
127 | 128 | ||
128 | tcph->check = nf_proto_csum_update(*pskb, | 129 | tcph->check = nf_proto_csum_update(*pskb, |
129 | htons(tcplen) ^ 0xFFFF, | 130 | htons(tcplen) ^ htons(0xFFFF), |
130 | htons(tcplen + TCPOLEN_MSS), | 131 | htons(tcplen + TCPOLEN_MSS), |
131 | tcph->check, 1); | 132 | tcph->check, 1); |
132 | opt[0] = TCPOPT_MSS; | 133 | opt[0] = TCPOPT_MSS; |
@@ -134,18 +135,18 @@ ipt_tcpmss_target(struct sk_buff **pskb, | |||
134 | opt[2] = (newmss & 0xff00) >> 8; | 135 | opt[2] = (newmss & 0xff00) >> 8; |
135 | opt[3] = (newmss & 0x00ff); | 136 | opt[3] = (newmss & 0x00ff); |
136 | 137 | ||
137 | tcph->check = nf_proto_csum_update(*pskb, ~0, *((u_int32_t *)opt), | 138 | tcph->check = nf_proto_csum_update(*pskb, htonl(~0), *((__be32 *)opt), |
138 | tcph->check, 0); | 139 | tcph->check, 0); |
139 | 140 | ||
140 | oldval = ((u_int16_t *)tcph)[6]; | 141 | oldval = ((__be16 *)tcph)[6]; |
141 | tcph->doff += TCPOLEN_MSS/4; | 142 | tcph->doff += TCPOLEN_MSS/4; |
142 | tcph->check = nf_proto_csum_update(*pskb, | 143 | tcph->check = nf_proto_csum_update(*pskb, |
143 | oldval ^ 0xFFFF, | 144 | oldval ^ htons(0xFFFF), |
144 | ((u_int16_t *)tcph)[6], | 145 | ((__be16 *)tcph)[6], |
145 | tcph->check, 0); | 146 | tcph->check, 0); |
146 | 147 | ||
147 | newtotlen = htons(ntohs(iph->tot_len) + TCPOLEN_MSS); | 148 | newtotlen = htons(ntohs(iph->tot_len) + TCPOLEN_MSS); |
148 | iph->check = nf_csum_update(iph->tot_len ^ 0xFFFF, | 149 | iph->check = nf_csum_update(iph->tot_len ^ htons(0xFFFF), |
149 | newtotlen, iph->check); | 150 | newtotlen, iph->check); |
150 | iph->tot_len = newtotlen; | 151 | iph->tot_len = newtotlen; |
151 | return IPT_CONTINUE; | 152 | return IPT_CONTINUE; |
diff --git a/net/ipv4/netfilter/ipt_TOS.c b/net/ipv4/netfilter/ipt_TOS.c index 471a4c438b0a..6b8b14ccc3d3 100644 --- a/net/ipv4/netfilter/ipt_TOS.c +++ b/net/ipv4/netfilter/ipt_TOS.c | |||
@@ -30,7 +30,7 @@ target(struct sk_buff **pskb, | |||
30 | { | 30 | { |
31 | const struct ipt_tos_target_info *tosinfo = targinfo; | 31 | const struct ipt_tos_target_info *tosinfo = targinfo; |
32 | struct iphdr *iph = (*pskb)->nh.iph; | 32 | struct iphdr *iph = (*pskb)->nh.iph; |
33 | u_int16_t oldtos; | 33 | __be16 oldtos; |
34 | 34 | ||
35 | if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { | 35 | if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { |
36 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) | 36 | if (!skb_make_writable(pskb, sizeof(struct iphdr))) |
@@ -38,7 +38,7 @@ target(struct sk_buff **pskb, | |||
38 | iph = (*pskb)->nh.iph; | 38 | iph = (*pskb)->nh.iph; |
39 | oldtos = iph->tos; | 39 | oldtos = iph->tos; |
40 | iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; | 40 | iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; |
41 | iph->check = nf_csum_update(oldtos ^ 0xFFFF, iph->tos, | 41 | iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, |
42 | iph->check); | 42 | iph->check); |
43 | } | 43 | } |
44 | return IPT_CONTINUE; | 44 | return IPT_CONTINUE; |
diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c index 96e79cc6d0f2..ac9517d62af0 100644 --- a/net/ipv4/netfilter/ipt_TTL.c +++ b/net/ipv4/netfilter/ipt_TTL.c | |||
@@ -54,8 +54,8 @@ ipt_ttl_target(struct sk_buff **pskb, | |||
54 | } | 54 | } |
55 | 55 | ||
56 | if (new_ttl != iph->ttl) { | 56 | if (new_ttl != iph->ttl) { |
57 | iph->check = nf_csum_update(ntohs((iph->ttl << 8)) ^ 0xFFFF, | 57 | iph->check = nf_csum_update(htons((iph->ttl << 8)) ^ htons(0xFFFF), |
58 | ntohs(new_ttl << 8), | 58 | htons(new_ttl << 8), |
59 | iph->check); | 59 | iph->check); |
60 | iph->ttl = new_ttl; | 60 | iph->ttl = new_ttl; |
61 | } | 61 | } |
diff --git a/net/ipv4/netfilter/ipt_addrtype.c b/net/ipv4/netfilter/ipt_addrtype.c index 893dae210b04..7b60eb74788b 100644 --- a/net/ipv4/netfilter/ipt_addrtype.c +++ b/net/ipv4/netfilter/ipt_addrtype.c | |||
@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL"); | |||
22 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); | 22 | MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); |
23 | MODULE_DESCRIPTION("iptables addrtype match"); | 23 | MODULE_DESCRIPTION("iptables addrtype match"); |
24 | 24 | ||
25 | static inline int match_type(u_int32_t addr, u_int16_t mask) | 25 | static inline int match_type(__be32 addr, u_int16_t mask) |
26 | { | 26 | { |
27 | return !!(mask & (1 << inet_addr_type(addr))); | 27 | return !!(mask & (1 << inet_addr_type(addr))); |
28 | } | 28 | } |
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index 4f73a61aa3dd..33ccdbf8e794 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -50,11 +50,11 @@ static struct file_operations dl_file_ops; | |||
50 | /* hash table crap */ | 50 | /* hash table crap */ |
51 | 51 | ||
52 | struct dsthash_dst { | 52 | struct dsthash_dst { |
53 | u_int32_t src_ip; | 53 | __be32 src_ip; |
54 | u_int32_t dst_ip; | 54 | __be32 dst_ip; |
55 | /* ports have to be consecutive !!! */ | 55 | /* ports have to be consecutive !!! */ |
56 | u_int16_t src_port; | 56 | __be16 src_port; |
57 | u_int16_t dst_port; | 57 | __be16 dst_port; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct dsthash_ent { | 60 | struct dsthash_ent { |
@@ -106,8 +106,10 @@ static inline int dst_cmp(const struct dsthash_ent *ent, struct dsthash_dst *b) | |||
106 | static inline u_int32_t | 106 | static inline u_int32_t |
107 | hash_dst(const struct ipt_hashlimit_htable *ht, const struct dsthash_dst *dst) | 107 | hash_dst(const struct ipt_hashlimit_htable *ht, const struct dsthash_dst *dst) |
108 | { | 108 | { |
109 | return (jhash_3words(dst->dst_ip, (dst->dst_port<<16 | dst->src_port), | 109 | return (jhash_3words((__force u32)dst->dst_ip, |
110 | dst->src_ip, ht->rnd) % ht->cfg.size); | 110 | ((__force u32)dst->dst_port<<16 | |
111 | (__force u32)dst->src_port), | ||
112 | (__force u32)dst->src_ip, ht->rnd) % ht->cfg.size); | ||
111 | } | 113 | } |
112 | 114 | ||
113 | static inline struct dsthash_ent * | 115 | static inline struct dsthash_ent * |
@@ -406,7 +408,7 @@ hashlimit_match(const struct sk_buff *skb, | |||
406 | dst.src_ip = skb->nh.iph->saddr; | 408 | dst.src_ip = skb->nh.iph->saddr; |
407 | if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT | 409 | if (hinfo->cfg.mode & IPT_HASHLIMIT_HASH_DPT |
408 | ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) { | 410 | ||hinfo->cfg.mode & IPT_HASHLIMIT_HASH_SPT) { |
409 | u_int16_t _ports[2], *ports; | 411 | __be16 _ports[2], *ports; |
410 | 412 | ||
411 | switch (skb->nh.iph->protocol) { | 413 | switch (skb->nh.iph->protocol) { |
412 | case IPPROTO_TCP: | 414 | case IPPROTO_TCP: |
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 32ae8d7ac506..126db44e71a8 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -50,11 +50,10 @@ MODULE_PARM_DESC(ip_list_perms, "permissions on /proc/net/ipt_recent/* files"); | |||
50 | MODULE_PARM_DESC(ip_list_uid,"owner of /proc/net/ipt_recent/* files"); | 50 | MODULE_PARM_DESC(ip_list_uid,"owner of /proc/net/ipt_recent/* files"); |
51 | MODULE_PARM_DESC(ip_list_gid,"owning group of /proc/net/ipt_recent/* files"); | 51 | MODULE_PARM_DESC(ip_list_gid,"owning group of /proc/net/ipt_recent/* files"); |
52 | 52 | ||
53 | |||
54 | struct recent_entry { | 53 | struct recent_entry { |
55 | struct list_head list; | 54 | struct list_head list; |
56 | struct list_head lru_list; | 55 | struct list_head lru_list; |
57 | u_int32_t addr; | 56 | __be32 addr; |
58 | u_int8_t ttl; | 57 | u_int8_t ttl; |
59 | u_int8_t index; | 58 | u_int8_t index; |
60 | u_int16_t nstamps; | 59 | u_int16_t nstamps; |
@@ -85,17 +84,17 @@ static struct file_operations recent_fops; | |||
85 | static u_int32_t hash_rnd; | 84 | static u_int32_t hash_rnd; |
86 | static int hash_rnd_initted; | 85 | static int hash_rnd_initted; |
87 | 86 | ||
88 | static unsigned int recent_entry_hash(u_int32_t addr) | 87 | static unsigned int recent_entry_hash(__be32 addr) |
89 | { | 88 | { |
90 | if (!hash_rnd_initted) { | 89 | if (!hash_rnd_initted) { |
91 | get_random_bytes(&hash_rnd, 4); | 90 | get_random_bytes(&hash_rnd, 4); |
92 | hash_rnd_initted = 1; | 91 | hash_rnd_initted = 1; |
93 | } | 92 | } |
94 | return jhash_1word(addr, hash_rnd) & (ip_list_hash_size - 1); | 93 | return jhash_1word((__force u32)addr, hash_rnd) & (ip_list_hash_size - 1); |
95 | } | 94 | } |
96 | 95 | ||
97 | static struct recent_entry * | 96 | static struct recent_entry * |
98 | recent_entry_lookup(const struct recent_table *table, u_int32_t addr, u_int8_t ttl) | 97 | recent_entry_lookup(const struct recent_table *table, __be32 addr, u_int8_t ttl) |
99 | { | 98 | { |
100 | struct recent_entry *e; | 99 | struct recent_entry *e; |
101 | unsigned int h; | 100 | unsigned int h; |
@@ -116,7 +115,7 @@ static void recent_entry_remove(struct recent_table *t, struct recent_entry *e) | |||
116 | } | 115 | } |
117 | 116 | ||
118 | static struct recent_entry * | 117 | static struct recent_entry * |
119 | recent_entry_init(struct recent_table *t, u_int32_t addr, u_int8_t ttl) | 118 | recent_entry_init(struct recent_table *t, __be32 addr, u_int8_t ttl) |
120 | { | 119 | { |
121 | struct recent_entry *e; | 120 | struct recent_entry *e; |
122 | 121 | ||
@@ -178,7 +177,7 @@ ipt_recent_match(const struct sk_buff *skb, | |||
178 | const struct ipt_recent_info *info = matchinfo; | 177 | const struct ipt_recent_info *info = matchinfo; |
179 | struct recent_table *t; | 178 | struct recent_table *t; |
180 | struct recent_entry *e; | 179 | struct recent_entry *e; |
181 | u_int32_t addr; | 180 | __be32 addr; |
182 | u_int8_t ttl; | 181 | u_int8_t ttl; |
183 | int ret = info->invert; | 182 | int ret = info->invert; |
184 | 183 | ||
@@ -406,7 +405,7 @@ static ssize_t recent_proc_write(struct file *file, const char __user *input, | |||
406 | struct recent_table *t = pde->data; | 405 | struct recent_table *t = pde->data; |
407 | struct recent_entry *e; | 406 | struct recent_entry *e; |
408 | char buf[sizeof("+255.255.255.255")], *c = buf; | 407 | char buf[sizeof("+255.255.255.255")], *c = buf; |
409 | u_int32_t addr; | 408 | __be32 addr; |
410 | int add; | 409 | int add; |
411 | 410 | ||
412 | if (size > sizeof(buf)) | 411 | if (size > sizeof(buf)) |
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c index 79336cb42527..e62ea2bb9c0a 100644 --- a/net/ipv4/netfilter/iptable_mangle.c +++ b/net/ipv4/netfilter/iptable_mangle.c | |||
@@ -131,7 +131,7 @@ ipt_local_hook(unsigned int hook, | |||
131 | { | 131 | { |
132 | unsigned int ret; | 132 | unsigned int ret; |
133 | u_int8_t tos; | 133 | u_int8_t tos; |
134 | u_int32_t saddr, daddr; | 134 | __be32 saddr, daddr; |
135 | unsigned long nfmark; | 135 | unsigned long nfmark; |
136 | 136 | ||
137 | /* root is playing with raw sockets. */ | 137 | /* root is playing with raw sockets. */ |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 0e935b4c8741..b430cf2a4f66 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -381,8 +381,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
381 | struct ipcm_cookie ipc; | 381 | struct ipcm_cookie ipc; |
382 | struct rtable *rt = NULL; | 382 | struct rtable *rt = NULL; |
383 | int free = 0; | 383 | int free = 0; |
384 | u32 daddr; | 384 | __be32 daddr; |
385 | u32 saddr; | 385 | __be32 saddr; |
386 | u8 tos; | 386 | u8 tos; |
387 | int err; | 387 | int err; |
388 | 388 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 20ffe8e88c0f..c41ddba02e9d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -261,6 +261,10 @@ static unsigned int rt_hash_code(u32 daddr, u32 saddr) | |||
261 | & rt_hash_mask); | 261 | & rt_hash_mask); |
262 | } | 262 | } |
263 | 263 | ||
264 | #define rt_hash(daddr, saddr, idx) \ | ||
265 | rt_hash_code((__force u32)(__be32)(daddr),\ | ||
266 | (__force u32)(__be32)(saddr) ^ ((idx) << 5)) | ||
267 | |||
264 | #ifdef CONFIG_PROC_FS | 268 | #ifdef CONFIG_PROC_FS |
265 | struct rt_cache_iter_state { | 269 | struct rt_cache_iter_state { |
266 | int bucket; | 270 | int bucket; |
@@ -1074,7 +1078,7 @@ static void ip_select_fb_ident(struct iphdr *iph) | |||
1074 | u32 salt; | 1078 | u32 salt; |
1075 | 1079 | ||
1076 | spin_lock_bh(&ip_fb_id_lock); | 1080 | spin_lock_bh(&ip_fb_id_lock); |
1077 | salt = secure_ip_id(ip_fallback_id ^ iph->daddr); | 1081 | salt = secure_ip_id((__force __be32)ip_fallback_id ^ iph->daddr); |
1078 | iph->id = htons(salt & 0xFFFF); | 1082 | iph->id = htons(salt & 0xFFFF); |
1079 | ip_fallback_id = salt; | 1083 | ip_fallback_id = salt; |
1080 | spin_unlock_bh(&ip_fb_id_lock); | 1084 | spin_unlock_bh(&ip_fb_id_lock); |
@@ -1118,13 +1122,13 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1118 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1122 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1119 | } | 1123 | } |
1120 | 1124 | ||
1121 | void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, | 1125 | void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, |
1122 | u32 saddr, struct net_device *dev) | 1126 | __be32 saddr, struct net_device *dev) |
1123 | { | 1127 | { |
1124 | int i, k; | 1128 | int i, k; |
1125 | struct in_device *in_dev = in_dev_get(dev); | 1129 | struct in_device *in_dev = in_dev_get(dev); |
1126 | struct rtable *rth, **rthp; | 1130 | struct rtable *rth, **rthp; |
1127 | u32 skeys[2] = { saddr, 0 }; | 1131 | __be32 skeys[2] = { saddr, 0 }; |
1128 | int ikeys[2] = { dev->ifindex, 0 }; | 1132 | int ikeys[2] = { dev->ifindex, 0 }; |
1129 | struct netevent_redirect netevent; | 1133 | struct netevent_redirect netevent; |
1130 | 1134 | ||
@@ -1147,8 +1151,7 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw, | |||
1147 | 1151 | ||
1148 | for (i = 0; i < 2; i++) { | 1152 | for (i = 0; i < 2; i++) { |
1149 | for (k = 0; k < 2; k++) { | 1153 | for (k = 0; k < 2; k++) { |
1150 | unsigned hash = rt_hash_code(daddr, | 1154 | unsigned hash = rt_hash(daddr, skeys[i], ikeys[k]); |
1151 | skeys[i] ^ (ikeys[k] << 5)); | ||
1152 | 1155 | ||
1153 | rthp=&rt_hash_table[hash].chain; | 1156 | rthp=&rt_hash_table[hash].chain; |
1154 | 1157 | ||
@@ -1260,9 +1263,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) | |||
1260 | ret = NULL; | 1263 | ret = NULL; |
1261 | } else if ((rt->rt_flags & RTCF_REDIRECTED) || | 1264 | } else if ((rt->rt_flags & RTCF_REDIRECTED) || |
1262 | rt->u.dst.expires) { | 1265 | rt->u.dst.expires) { |
1263 | unsigned hash = rt_hash_code(rt->fl.fl4_dst, | 1266 | unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, |
1264 | rt->fl.fl4_src ^ | 1267 | rt->fl.oif); |
1265 | (rt->fl.oif << 5)); | ||
1266 | #if RT_CACHE_DEBUG >= 1 | 1268 | #if RT_CACHE_DEBUG >= 1 |
1267 | printk(KERN_DEBUG "ip_rt_advice: redirect to " | 1269 | printk(KERN_DEBUG "ip_rt_advice: redirect to " |
1268 | "%u.%u.%u.%u/%02x dropped\n", | 1270 | "%u.%u.%u.%u/%02x dropped\n", |
@@ -1397,15 +1399,15 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu) | |||
1397 | int i; | 1399 | int i; |
1398 | unsigned short old_mtu = ntohs(iph->tot_len); | 1400 | unsigned short old_mtu = ntohs(iph->tot_len); |
1399 | struct rtable *rth; | 1401 | struct rtable *rth; |
1400 | u32 skeys[2] = { iph->saddr, 0, }; | 1402 | __be32 skeys[2] = { iph->saddr, 0, }; |
1401 | u32 daddr = iph->daddr; | 1403 | __be32 daddr = iph->daddr; |
1402 | unsigned short est_mtu = 0; | 1404 | unsigned short est_mtu = 0; |
1403 | 1405 | ||
1404 | if (ipv4_config.no_pmtu_disc) | 1406 | if (ipv4_config.no_pmtu_disc) |
1405 | return 0; | 1407 | return 0; |
1406 | 1408 | ||
1407 | for (i = 0; i < 2; i++) { | 1409 | for (i = 0; i < 2; i++) { |
1408 | unsigned hash = rt_hash_code(daddr, skeys[i]); | 1410 | unsigned hash = rt_hash(daddr, skeys[i], 0); |
1409 | 1411 | ||
1410 | rcu_read_lock(); | 1412 | rcu_read_lock(); |
1411 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 1413 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
@@ -1530,7 +1532,7 @@ static int ip_rt_bug(struct sk_buff *skb) | |||
1530 | 1532 | ||
1531 | void ip_rt_get_source(u8 *addr, struct rtable *rt) | 1533 | void ip_rt_get_source(u8 *addr, struct rtable *rt) |
1532 | { | 1534 | { |
1533 | u32 src; | 1535 | __be32 src; |
1534 | struct fib_result res; | 1536 | struct fib_result res; |
1535 | 1537 | ||
1536 | if (rt->fl.iif == 0) | 1538 | if (rt->fl.iif == 0) |
@@ -1596,12 +1598,12 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1596 | rt->rt_type = res->type; | 1598 | rt->rt_type = res->type; |
1597 | } | 1599 | } |
1598 | 1600 | ||
1599 | static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, | 1601 | static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
1600 | u8 tos, struct net_device *dev, int our) | 1602 | u8 tos, struct net_device *dev, int our) |
1601 | { | 1603 | { |
1602 | unsigned hash; | 1604 | unsigned hash; |
1603 | struct rtable *rth; | 1605 | struct rtable *rth; |
1604 | u32 spec_dst; | 1606 | __be32 spec_dst; |
1605 | struct in_device *in_dev = in_dev_get(dev); | 1607 | struct in_device *in_dev = in_dev_get(dev); |
1606 | u32 itag = 0; | 1608 | u32 itag = 0; |
1607 | 1609 | ||
@@ -1665,7 +1667,7 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1665 | RT_CACHE_STAT_INC(in_slow_mc); | 1667 | RT_CACHE_STAT_INC(in_slow_mc); |
1666 | 1668 | ||
1667 | in_dev_put(in_dev); | 1669 | in_dev_put(in_dev); |
1668 | hash = rt_hash_code(daddr, saddr ^ (dev->ifindex << 5)); | 1670 | hash = rt_hash(daddr, saddr, dev->ifindex); |
1669 | return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); | 1671 | return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); |
1670 | 1672 | ||
1671 | e_nobufs: | 1673 | e_nobufs: |
@@ -1681,8 +1683,8 @@ e_inval: | |||
1681 | static void ip_handle_martian_source(struct net_device *dev, | 1683 | static void ip_handle_martian_source(struct net_device *dev, |
1682 | struct in_device *in_dev, | 1684 | struct in_device *in_dev, |
1683 | struct sk_buff *skb, | 1685 | struct sk_buff *skb, |
1684 | u32 daddr, | 1686 | __be32 daddr, |
1685 | u32 saddr) | 1687 | __be32 saddr) |
1686 | { | 1688 | { |
1687 | RT_CACHE_STAT_INC(in_martian_src); | 1689 | RT_CACHE_STAT_INC(in_martian_src); |
1688 | #ifdef CONFIG_IP_ROUTE_VERBOSE | 1690 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
@@ -1712,7 +1714,7 @@ static void ip_handle_martian_source(struct net_device *dev, | |||
1712 | static inline int __mkroute_input(struct sk_buff *skb, | 1714 | static inline int __mkroute_input(struct sk_buff *skb, |
1713 | struct fib_result* res, | 1715 | struct fib_result* res, |
1714 | struct in_device *in_dev, | 1716 | struct in_device *in_dev, |
1715 | u32 daddr, u32 saddr, u32 tos, | 1717 | __be32 daddr, __be32 saddr, u32 tos, |
1716 | struct rtable **result) | 1718 | struct rtable **result) |
1717 | { | 1719 | { |
1718 | 1720 | ||
@@ -1720,7 +1722,8 @@ static inline int __mkroute_input(struct sk_buff *skb, | |||
1720 | int err; | 1722 | int err; |
1721 | struct in_device *out_dev; | 1723 | struct in_device *out_dev; |
1722 | unsigned flags = 0; | 1724 | unsigned flags = 0; |
1723 | u32 spec_dst, itag; | 1725 | __be32 spec_dst; |
1726 | u32 itag; | ||
1724 | 1727 | ||
1725 | /* get a working reference to the output device */ | 1728 | /* get a working reference to the output device */ |
1726 | out_dev = in_dev_get(FIB_RES_DEV(*res)); | 1729 | out_dev = in_dev_get(FIB_RES_DEV(*res)); |
@@ -1813,7 +1816,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb, | |||
1813 | struct fib_result* res, | 1816 | struct fib_result* res, |
1814 | const struct flowi *fl, | 1817 | const struct flowi *fl, |
1815 | struct in_device *in_dev, | 1818 | struct in_device *in_dev, |
1816 | u32 daddr, u32 saddr, u32 tos) | 1819 | __be32 daddr, __be32 saddr, u32 tos) |
1817 | { | 1820 | { |
1818 | struct rtable* rth = NULL; | 1821 | struct rtable* rth = NULL; |
1819 | int err; | 1822 | int err; |
@@ -1830,7 +1833,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb, | |||
1830 | return err; | 1833 | return err; |
1831 | 1834 | ||
1832 | /* put it into the cache */ | 1835 | /* put it into the cache */ |
1833 | hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5)); | 1836 | hash = rt_hash(daddr, saddr, fl->iif); |
1834 | return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); | 1837 | return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); |
1835 | } | 1838 | } |
1836 | 1839 | ||
@@ -1838,7 +1841,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, | |||
1838 | struct fib_result* res, | 1841 | struct fib_result* res, |
1839 | const struct flowi *fl, | 1842 | const struct flowi *fl, |
1840 | struct in_device *in_dev, | 1843 | struct in_device *in_dev, |
1841 | u32 daddr, u32 saddr, u32 tos) | 1844 | __be32 daddr, __be32 saddr, u32 tos) |
1842 | { | 1845 | { |
1843 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED | 1846 | #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED |
1844 | struct rtable* rth = NULL, *rtres; | 1847 | struct rtable* rth = NULL, *rtres; |
@@ -1871,7 +1874,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, | |||
1871 | return err; | 1874 | return err; |
1872 | 1875 | ||
1873 | /* put it into the cache */ | 1876 | /* put it into the cache */ |
1874 | hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5)); | 1877 | hash = rt_hash(daddr, saddr, fl->iif); |
1875 | err = rt_intern_hash(hash, rth, &rtres); | 1878 | err = rt_intern_hash(hash, rth, &rtres); |
1876 | if (err) | 1879 | if (err) |
1877 | return err; | 1880 | return err; |
@@ -1901,7 +1904,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb, | |||
1901 | * 2. IP spoofing attempts are filtered with 100% of guarantee. | 1904 | * 2. IP spoofing attempts are filtered with 100% of guarantee. |
1902 | */ | 1905 | */ |
1903 | 1906 | ||
1904 | static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | 1907 | static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
1905 | u8 tos, struct net_device *dev) | 1908 | u8 tos, struct net_device *dev) |
1906 | { | 1909 | { |
1907 | struct fib_result res; | 1910 | struct fib_result res; |
@@ -1920,7 +1923,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1920 | u32 itag = 0; | 1923 | u32 itag = 0; |
1921 | struct rtable * rth; | 1924 | struct rtable * rth; |
1922 | unsigned hash; | 1925 | unsigned hash; |
1923 | u32 spec_dst; | 1926 | __be32 spec_dst; |
1924 | int err = -EINVAL; | 1927 | int err = -EINVAL; |
1925 | int free_res = 0; | 1928 | int free_res = 0; |
1926 | 1929 | ||
@@ -1936,7 +1939,7 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
1936 | if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr)) | 1939 | if (MULTICAST(saddr) || BADCLASS(saddr) || LOOPBACK(saddr)) |
1937 | goto martian_source; | 1940 | goto martian_source; |
1938 | 1941 | ||
1939 | if (daddr == 0xFFFFFFFF || (saddr == 0 && daddr == 0)) | 1942 | if (daddr == htonl(0xFFFFFFFF) || (saddr == 0 && daddr == 0)) |
1940 | goto brd_input; | 1943 | goto brd_input; |
1941 | 1944 | ||
1942 | /* Accept zero addresses only to limited broadcast; | 1945 | /* Accept zero addresses only to limited broadcast; |
@@ -2048,7 +2051,7 @@ local_input: | |||
2048 | rth->rt_flags &= ~RTCF_LOCAL; | 2051 | rth->rt_flags &= ~RTCF_LOCAL; |
2049 | } | 2052 | } |
2050 | rth->rt_type = res.type; | 2053 | rth->rt_type = res.type; |
2051 | hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5)); | 2054 | hash = rt_hash(daddr, saddr, fl.iif); |
2052 | err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); | 2055 | err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); |
2053 | goto done; | 2056 | goto done; |
2054 | 2057 | ||
@@ -2087,7 +2090,7 @@ martian_source: | |||
2087 | goto e_inval; | 2090 | goto e_inval; |
2088 | } | 2091 | } |
2089 | 2092 | ||
2090 | int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, | 2093 | int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
2091 | u8 tos, struct net_device *dev) | 2094 | u8 tos, struct net_device *dev) |
2092 | { | 2095 | { |
2093 | struct rtable * rth; | 2096 | struct rtable * rth; |
@@ -2095,7 +2098,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
2095 | int iif = dev->ifindex; | 2098 | int iif = dev->ifindex; |
2096 | 2099 | ||
2097 | tos &= IPTOS_RT_MASK; | 2100 | tos &= IPTOS_RT_MASK; |
2098 | hash = rt_hash_code(daddr, saddr ^ (iif << 5)); | 2101 | hash = rt_hash(daddr, saddr, iif); |
2099 | 2102 | ||
2100 | rcu_read_lock(); | 2103 | rcu_read_lock(); |
2101 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2104 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
@@ -2169,7 +2172,7 @@ static inline int __mkroute_output(struct rtable **result, | |||
2169 | if (LOOPBACK(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK)) | 2172 | if (LOOPBACK(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK)) |
2170 | return -EINVAL; | 2173 | return -EINVAL; |
2171 | 2174 | ||
2172 | if (fl->fl4_dst == 0xFFFFFFFF) | 2175 | if (fl->fl4_dst == htonl(0xFFFFFFFF)) |
2173 | res->type = RTN_BROADCAST; | 2176 | res->type = RTN_BROADCAST; |
2174 | else if (MULTICAST(fl->fl4_dst)) | 2177 | else if (MULTICAST(fl->fl4_dst)) |
2175 | res->type = RTN_MULTICAST; | 2178 | res->type = RTN_MULTICAST; |
@@ -2293,8 +2296,7 @@ static inline int ip_mkroute_output_def(struct rtable **rp, | |||
2293 | int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags); | 2296 | int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags); |
2294 | unsigned hash; | 2297 | unsigned hash; |
2295 | if (err == 0) { | 2298 | if (err == 0) { |
2296 | hash = rt_hash_code(oldflp->fl4_dst, | 2299 | hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif); |
2297 | oldflp->fl4_src ^ (oldflp->oif << 5)); | ||
2298 | err = rt_intern_hash(hash, rth, rp); | 2300 | err = rt_intern_hash(hash, rth, rp); |
2299 | } | 2301 | } |
2300 | 2302 | ||
@@ -2336,9 +2338,8 @@ static inline int ip_mkroute_output(struct rtable** rp, | |||
2336 | if (err != 0) | 2338 | if (err != 0) |
2337 | goto cleanup; | 2339 | goto cleanup; |
2338 | 2340 | ||
2339 | hash = rt_hash_code(oldflp->fl4_dst, | 2341 | hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, |
2340 | oldflp->fl4_src ^ | 2342 | oldflp->oif); |
2341 | (oldflp->oif << 5)); | ||
2342 | err = rt_intern_hash(hash, rth, rp); | 2343 | err = rt_intern_hash(hash, rth, rp); |
2343 | 2344 | ||
2344 | /* forward hop information to multipath impl. */ | 2345 | /* forward hop information to multipath impl. */ |
@@ -2417,7 +2418,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) | |||
2417 | */ | 2418 | */ |
2418 | 2419 | ||
2419 | if (oldflp->oif == 0 | 2420 | if (oldflp->oif == 0 |
2420 | && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == 0xFFFFFFFF)) { | 2421 | && (MULTICAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF))) { |
2421 | /* Special hack: user can direct multicasts | 2422 | /* Special hack: user can direct multicasts |
2422 | and limited broadcast via necessary interface | 2423 | and limited broadcast via necessary interface |
2423 | without fiddling with IP_MULTICAST_IF or IP_PKTINFO. | 2424 | without fiddling with IP_MULTICAST_IF or IP_PKTINFO. |
@@ -2454,7 +2455,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) | |||
2454 | goto out; /* Wrong error code */ | 2455 | goto out; /* Wrong error code */ |
2455 | } | 2456 | } |
2456 | 2457 | ||
2457 | if (LOCAL_MCAST(oldflp->fl4_dst) || oldflp->fl4_dst == 0xFFFFFFFF) { | 2458 | if (LOCAL_MCAST(oldflp->fl4_dst) || oldflp->fl4_dst == htonl(0xFFFFFFFF)) { |
2458 | if (!fl.fl4_src) | 2459 | if (!fl.fl4_src) |
2459 | fl.fl4_src = inet_select_addr(dev_out, 0, | 2460 | fl.fl4_src = inet_select_addr(dev_out, 0, |
2460 | RT_SCOPE_LINK); | 2461 | RT_SCOPE_LINK); |
@@ -2567,7 +2568,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp) | |||
2567 | unsigned hash; | 2568 | unsigned hash; |
2568 | struct rtable *rth; | 2569 | struct rtable *rth; |
2569 | 2570 | ||
2570 | hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5)); | 2571 | hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif); |
2571 | 2572 | ||
2572 | rcu_read_lock_bh(); | 2573 | rcu_read_lock_bh(); |
2573 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; | 2574 | for (rth = rcu_dereference(rt_hash_table[hash].chain); rth; |
@@ -2660,11 +2661,11 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2660 | if (rt->rt_flags & RTCF_NOTIFY) | 2661 | if (rt->rt_flags & RTCF_NOTIFY) |
2661 | r->rtm_flags |= RTM_F_NOTIFY; | 2662 | r->rtm_flags |= RTM_F_NOTIFY; |
2662 | 2663 | ||
2663 | NLA_PUT_U32(skb, RTA_DST, rt->rt_dst); | 2664 | NLA_PUT_BE32(skb, RTA_DST, rt->rt_dst); |
2664 | 2665 | ||
2665 | if (rt->fl.fl4_src) { | 2666 | if (rt->fl.fl4_src) { |
2666 | r->rtm_src_len = 32; | 2667 | r->rtm_src_len = 32; |
2667 | NLA_PUT_U32(skb, RTA_SRC, rt->fl.fl4_src); | 2668 | NLA_PUT_BE32(skb, RTA_SRC, rt->fl.fl4_src); |
2668 | } | 2669 | } |
2669 | if (rt->u.dst.dev) | 2670 | if (rt->u.dst.dev) |
2670 | NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex); | 2671 | NLA_PUT_U32(skb, RTA_OIF, rt->u.dst.dev->ifindex); |
@@ -2677,12 +2678,12 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2677 | NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg); | 2678 | NLA_PUT_U32(skb, RTA_MP_ALGO, rt->rt_multipath_alg); |
2678 | #endif | 2679 | #endif |
2679 | if (rt->fl.iif) | 2680 | if (rt->fl.iif) |
2680 | NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_spec_dst); | 2681 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_spec_dst); |
2681 | else if (rt->rt_src != rt->fl.fl4_src) | 2682 | else if (rt->rt_src != rt->fl.fl4_src) |
2682 | NLA_PUT_U32(skb, RTA_PREFSRC, rt->rt_src); | 2683 | NLA_PUT_BE32(skb, RTA_PREFSRC, rt->rt_src); |
2683 | 2684 | ||
2684 | if (rt->rt_dst != rt->rt_gateway) | 2685 | if (rt->rt_dst != rt->rt_gateway) |
2685 | NLA_PUT_U32(skb, RTA_GATEWAY, rt->rt_gateway); | 2686 | NLA_PUT_BE32(skb, RTA_GATEWAY, rt->rt_gateway); |
2686 | 2687 | ||
2687 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) | 2688 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) |
2688 | goto nla_put_failure; | 2689 | goto nla_put_failure; |
@@ -2706,7 +2707,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2706 | 2707 | ||
2707 | if (rt->fl.iif) { | 2708 | if (rt->fl.iif) { |
2708 | #ifdef CONFIG_IP_MROUTE | 2709 | #ifdef CONFIG_IP_MROUTE |
2709 | u32 dst = rt->rt_dst; | 2710 | __be32 dst = rt->rt_dst; |
2710 | 2711 | ||
2711 | if (MULTICAST(dst) && !LOCAL_MCAST(dst) && | 2712 | if (MULTICAST(dst) && !LOCAL_MCAST(dst) && |
2712 | ipv4_devconf.mc_forwarding) { | 2713 | ipv4_devconf.mc_forwarding) { |
@@ -2740,7 +2741,9 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2740 | struct rtmsg *rtm; | 2741 | struct rtmsg *rtm; |
2741 | struct nlattr *tb[RTA_MAX+1]; | 2742 | struct nlattr *tb[RTA_MAX+1]; |
2742 | struct rtable *rt = NULL; | 2743 | struct rtable *rt = NULL; |
2743 | u32 dst, src, iif; | 2744 | __be32 dst = 0; |
2745 | __be32 src = 0; | ||
2746 | u32 iif; | ||
2744 | int err; | 2747 | int err; |
2745 | struct sk_buff *skb; | 2748 | struct sk_buff *skb; |
2746 | 2749 | ||
@@ -2765,8 +2768,8 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2765 | skb->nh.iph->protocol = IPPROTO_ICMP; | 2768 | skb->nh.iph->protocol = IPPROTO_ICMP; |
2766 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); | 2769 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); |
2767 | 2770 | ||
2768 | src = tb[RTA_SRC] ? nla_get_u32(tb[RTA_SRC]) : 0; | 2771 | src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0; |
2769 | dst = tb[RTA_DST] ? nla_get_u32(tb[RTA_DST]) : 0; | 2772 | dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0; |
2770 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; | 2773 | iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; |
2771 | 2774 | ||
2772 | if (iif) { | 2775 | if (iif) { |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index b3def0df14fb..3f884cea14ff 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -935,7 +935,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
935 | const struct inet_connection_sock *icsk = inet_csk(sk); | 935 | const struct inet_connection_sock *icsk = inet_csk(sk); |
936 | struct tcp_sock *tp = tcp_sk(sk); | 936 | struct tcp_sock *tp = tcp_sk(sk); |
937 | unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; | 937 | unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; |
938 | struct tcp_sack_block *sp = (struct tcp_sack_block *)(ptr+2); | 938 | struct tcp_sack_block_wire *sp = (struct tcp_sack_block_wire *)(ptr+2); |
939 | int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; | 939 | int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; |
940 | int reord = tp->packets_out; | 940 | int reord = tp->packets_out; |
941 | int prior_fackets; | 941 | int prior_fackets; |
@@ -2239,13 +2239,12 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, | |||
2239 | return acked; | 2239 | return acked; |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | static u32 tcp_usrtt(const struct sk_buff *skb) | 2242 | static u32 tcp_usrtt(struct timeval *tv) |
2243 | { | 2243 | { |
2244 | struct timeval tv, now; | 2244 | struct timeval now; |
2245 | 2245 | ||
2246 | do_gettimeofday(&now); | 2246 | do_gettimeofday(&now); |
2247 | skb_get_timestamp(skb, &tv); | 2247 | return (now.tv_sec - tv->tv_sec) * 1000000 + (now.tv_usec - tv->tv_usec); |
2248 | return (now.tv_sec - tv.tv_sec) * 1000000 + (now.tv_usec - tv.tv_usec); | ||
2249 | } | 2248 | } |
2250 | 2249 | ||
2251 | /* Remove acknowledged frames from the retransmission queue. */ | 2250 | /* Remove acknowledged frames from the retransmission queue. */ |
@@ -2260,6 +2259,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2260 | u32 pkts_acked = 0; | 2259 | u32 pkts_acked = 0; |
2261 | void (*rtt_sample)(struct sock *sk, u32 usrtt) | 2260 | void (*rtt_sample)(struct sock *sk, u32 usrtt) |
2262 | = icsk->icsk_ca_ops->rtt_sample; | 2261 | = icsk->icsk_ca_ops->rtt_sample; |
2262 | struct timeval tv; | ||
2263 | 2263 | ||
2264 | while ((skb = skb_peek(&sk->sk_write_queue)) && | 2264 | while ((skb = skb_peek(&sk->sk_write_queue)) && |
2265 | skb != sk->sk_send_head) { | 2265 | skb != sk->sk_send_head) { |
@@ -2308,8 +2308,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2308 | seq_rtt = -1; | 2308 | seq_rtt = -1; |
2309 | } else if (seq_rtt < 0) { | 2309 | } else if (seq_rtt < 0) { |
2310 | seq_rtt = now - scb->when; | 2310 | seq_rtt = now - scb->when; |
2311 | if (rtt_sample) | 2311 | skb_get_timestamp(skb, &tv); |
2312 | (*rtt_sample)(sk, tcp_usrtt(skb)); | ||
2313 | } | 2312 | } |
2314 | if (sacked & TCPCB_SACKED_ACKED) | 2313 | if (sacked & TCPCB_SACKED_ACKED) |
2315 | tp->sacked_out -= tcp_skb_pcount(skb); | 2314 | tp->sacked_out -= tcp_skb_pcount(skb); |
@@ -2322,8 +2321,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2322 | } | 2321 | } |
2323 | } else if (seq_rtt < 0) { | 2322 | } else if (seq_rtt < 0) { |
2324 | seq_rtt = now - scb->when; | 2323 | seq_rtt = now - scb->when; |
2325 | if (rtt_sample) | 2324 | skb_get_timestamp(skb, &tv); |
2326 | (*rtt_sample)(sk, tcp_usrtt(skb)); | ||
2327 | } | 2325 | } |
2328 | tcp_dec_pcount_approx(&tp->fackets_out, skb); | 2326 | tcp_dec_pcount_approx(&tp->fackets_out, skb); |
2329 | tcp_packets_out_dec(tp, skb); | 2327 | tcp_packets_out_dec(tp, skb); |
@@ -2335,6 +2333,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2335 | if (acked&FLAG_ACKED) { | 2333 | if (acked&FLAG_ACKED) { |
2336 | tcp_ack_update_rtt(sk, acked, seq_rtt); | 2334 | tcp_ack_update_rtt(sk, acked, seq_rtt); |
2337 | tcp_ack_packets_out(sk, tp); | 2335 | tcp_ack_packets_out(sk, tp); |
2336 | if (rtt_sample && !(acked & FLAG_RETRANS_DATA_ACKED)) | ||
2337 | (*rtt_sample)(sk, tcp_usrtt(&tv)); | ||
2338 | 2338 | ||
2339 | if (icsk->icsk_ca_ops->pkts_acked) | 2339 | if (icsk->icsk_ca_ops->pkts_acked) |
2340 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); | 2340 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); |
@@ -2629,7 +2629,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
2629 | switch(opcode) { | 2629 | switch(opcode) { |
2630 | case TCPOPT_MSS: | 2630 | case TCPOPT_MSS: |
2631 | if(opsize==TCPOLEN_MSS && th->syn && !estab) { | 2631 | if(opsize==TCPOLEN_MSS && th->syn && !estab) { |
2632 | u16 in_mss = ntohs(get_unaligned((__u16 *)ptr)); | 2632 | u16 in_mss = ntohs(get_unaligned((__be16 *)ptr)); |
2633 | if (in_mss) { | 2633 | if (in_mss) { |
2634 | if (opt_rx->user_mss && opt_rx->user_mss < in_mss) | 2634 | if (opt_rx->user_mss && opt_rx->user_mss < in_mss) |
2635 | in_mss = opt_rx->user_mss; | 2635 | in_mss = opt_rx->user_mss; |
@@ -2657,8 +2657,8 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
2657 | if ((estab && opt_rx->tstamp_ok) || | 2657 | if ((estab && opt_rx->tstamp_ok) || |
2658 | (!estab && sysctl_tcp_timestamps)) { | 2658 | (!estab && sysctl_tcp_timestamps)) { |
2659 | opt_rx->saw_tstamp = 1; | 2659 | opt_rx->saw_tstamp = 1; |
2660 | opt_rx->rcv_tsval = ntohl(get_unaligned((__u32 *)ptr)); | 2660 | opt_rx->rcv_tsval = ntohl(get_unaligned((__be32 *)ptr)); |
2661 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__u32 *)(ptr+4))); | 2661 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__be32 *)(ptr+4))); |
2662 | } | 2662 | } |
2663 | } | 2663 | } |
2664 | break; | 2664 | break; |
@@ -2695,8 +2695,8 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, | |||
2695 | return 0; | 2695 | return 0; |
2696 | } else if (tp->rx_opt.tstamp_ok && | 2696 | } else if (tp->rx_opt.tstamp_ok && |
2697 | th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) { | 2697 | th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) { |
2698 | __u32 *ptr = (__u32 *)(th + 1); | 2698 | __be32 *ptr = (__be32 *)(th + 1); |
2699 | if (*ptr == ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 2699 | if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
2700 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { | 2700 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { |
2701 | tp->rx_opt.saw_tstamp = 1; | 2701 | tp->rx_opt.saw_tstamp = 1; |
2702 | ++ptr; | 2702 | ++ptr; |
@@ -3911,10 +3911,10 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
3911 | 3911 | ||
3912 | /* Check timestamp */ | 3912 | /* Check timestamp */ |
3913 | if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) { | 3913 | if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) { |
3914 | __u32 *ptr = (__u32 *)(th + 1); | 3914 | __be32 *ptr = (__be32 *)(th + 1); |
3915 | 3915 | ||
3916 | /* No? Slow path! */ | 3916 | /* No? Slow path! */ |
3917 | if (*ptr != ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 3917 | if (*ptr != htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
3918 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) | 3918 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) |
3919 | goto slow_path; | 3919 | goto slow_path; |
3920 | 3920 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 39b179856082..c83938b8fcb1 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -159,7 +159,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
159 | struct tcp_sock *tp = tcp_sk(sk); | 159 | struct tcp_sock *tp = tcp_sk(sk); |
160 | struct sockaddr_in *usin = (struct sockaddr_in *)uaddr; | 160 | struct sockaddr_in *usin = (struct sockaddr_in *)uaddr; |
161 | struct rtable *rt; | 161 | struct rtable *rt; |
162 | u32 daddr, nexthop; | 162 | __be32 daddr, nexthop; |
163 | int tmp; | 163 | int tmp; |
164 | int err; | 164 | int err; |
165 | 165 | ||
@@ -734,8 +734,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
734 | struct inet_request_sock *ireq; | 734 | struct inet_request_sock *ireq; |
735 | struct tcp_options_received tmp_opt; | 735 | struct tcp_options_received tmp_opt; |
736 | struct request_sock *req; | 736 | struct request_sock *req; |
737 | __u32 saddr = skb->nh.iph->saddr; | 737 | __be32 saddr = skb->nh.iph->saddr; |
738 | __u32 daddr = skb->nh.iph->daddr; | 738 | __be32 daddr = skb->nh.iph->daddr; |
739 | __u32 isn = TCP_SKB_CB(skb)->when; | 739 | __u32 isn = TCP_SKB_CB(skb)->when; |
740 | struct dst_entry *dst = NULL; | 740 | struct dst_entry *dst = NULL; |
741 | #ifdef CONFIG_SYN_COOKIES | 741 | #ifdef CONFIG_SYN_COOKIES |
@@ -1763,7 +1763,7 @@ static void get_tcp4_sock(struct sock *sp, char *tmpbuf, int i) | |||
1763 | 1763 | ||
1764 | static void get_timewait4_sock(struct inet_timewait_sock *tw, char *tmpbuf, int i) | 1764 | static void get_timewait4_sock(struct inet_timewait_sock *tw, char *tmpbuf, int i) |
1765 | { | 1765 | { |
1766 | unsigned int dest, src; | 1766 | __be32 dest, src; |
1767 | __u16 destp, srcp; | 1767 | __u16 destp, srcp; |
1768 | int ttd = tw->tw_ttd - jiffies; | 1768 | int ttd = tw->tw_ttd - jiffies; |
1769 | 1769 | ||
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c index 308fb7e071c5..f0ebaf0e21cb 100644 --- a/net/ipv4/tcp_lp.c +++ b/net/ipv4/tcp_lp.c | |||
@@ -31,8 +31,6 @@ | |||
31 | * Hung Hing Lun, Mike <hlhung3i@gmail.com> | 31 | * Hung Hing Lun, Mike <hlhung3i@gmail.com> |
32 | * SourceForge project page: | 32 | * SourceForge project page: |
33 | * http://tcp-lp-mod.sourceforge.net/ | 33 | * http://tcp-lp-mod.sourceforge.net/ |
34 | * | ||
35 | * Version: $Id: tcp_lp.c,v 1.24 2006/09/05 20:22:53 hswong3i Exp $ | ||
36 | */ | 34 | */ |
37 | 35 | ||
38 | #include <linux/module.h> | 36 | #include <linux/module.h> |
@@ -164,7 +162,7 @@ static u32 tcp_lp_remote_hz_estimator(struct sock *sk) | |||
164 | 162 | ||
165 | out: | 163 | out: |
166 | /* record time for successful remote HZ calc */ | 164 | /* record time for successful remote HZ calc */ |
167 | if (rhz > 0) | 165 | if ((rhz >> 6) > 0) |
168 | lp->flag |= LP_VALID_RHZ; | 166 | lp->flag |= LP_VALID_RHZ; |
169 | else | 167 | else |
170 | lp->flag &= ~LP_VALID_RHZ; | 168 | lp->flag &= ~LP_VALID_RHZ; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 061edfae0c29..9a253faefc81 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -269,7 +269,7 @@ static u16 tcp_select_window(struct sock *sk) | |||
269 | return new_win; | 269 | return new_win; |
270 | } | 270 | } |
271 | 271 | ||
272 | static void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, | 272 | static void tcp_build_and_update_options(__be32 *ptr, struct tcp_sock *tp, |
273 | __u32 tstamp) | 273 | __u32 tstamp) |
274 | { | 274 | { |
275 | if (tp->rx_opt.tstamp_ok) { | 275 | if (tp->rx_opt.tstamp_ok) { |
@@ -305,7 +305,7 @@ static void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, | |||
305 | * MAX_SYN_SIZE to match the new maximum number of options that you | 305 | * MAX_SYN_SIZE to match the new maximum number of options that you |
306 | * can generate. | 306 | * can generate. |
307 | */ | 307 | */ |
308 | static void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, | 308 | static void tcp_syn_build_options(__be32 *ptr, int mss, int ts, int sack, |
309 | int offer_wscale, int wscale, __u32 tstamp, | 309 | int offer_wscale, int wscale, __u32 tstamp, |
310 | __u32 ts_recent) | 310 | __u32 ts_recent) |
311 | { | 311 | { |
@@ -424,7 +424,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
424 | th->dest = inet->dport; | 424 | th->dest = inet->dport; |
425 | th->seq = htonl(tcb->seq); | 425 | th->seq = htonl(tcb->seq); |
426 | th->ack_seq = htonl(tp->rcv_nxt); | 426 | th->ack_seq = htonl(tp->rcv_nxt); |
427 | *(((__u16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | | 427 | *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | |
428 | tcb->flags); | 428 | tcb->flags); |
429 | 429 | ||
430 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { | 430 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { |
@@ -445,7 +445,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
445 | } | 445 | } |
446 | 446 | ||
447 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { | 447 | if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { |
448 | tcp_syn_build_options((__u32 *)(th + 1), | 448 | tcp_syn_build_options((__be32 *)(th + 1), |
449 | tcp_advertise_mss(sk), | 449 | tcp_advertise_mss(sk), |
450 | (sysctl_flags & SYSCTL_FLAG_TSTAMPS), | 450 | (sysctl_flags & SYSCTL_FLAG_TSTAMPS), |
451 | (sysctl_flags & SYSCTL_FLAG_SACK), | 451 | (sysctl_flags & SYSCTL_FLAG_SACK), |
@@ -454,7 +454,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
454 | tcb->when, | 454 | tcb->when, |
455 | tp->rx_opt.ts_recent); | 455 | tp->rx_opt.ts_recent); |
456 | } else { | 456 | } else { |
457 | tcp_build_and_update_options((__u32 *)(th + 1), | 457 | tcp_build_and_update_options((__be32 *)(th + 1), |
458 | tp, tcb->when); | 458 | tp, tcb->when); |
459 | TCP_ECN_send(sk, tp, skb, tcp_header_size); | 459 | TCP_ECN_send(sk, tp, skb, tcp_header_size); |
460 | } | 460 | } |
@@ -2070,7 +2070,7 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2070 | th->window = htons(req->rcv_wnd); | 2070 | th->window = htons(req->rcv_wnd); |
2071 | 2071 | ||
2072 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 2072 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
2073 | tcp_syn_build_options((__u32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok, | 2073 | tcp_syn_build_options((__be32 *)(th + 1), dst_metric(dst, RTAX_ADVMSS), ireq->tstamp_ok, |
2074 | ireq->sack_ok, ireq->wscale_ok, ireq->rcv_wscale, | 2074 | ireq->sack_ok, ireq->wscale_ok, ireq->rcv_wscale, |
2075 | TCP_SKB_CB(skb)->when, | 2075 | TCP_SKB_CB(skb)->when, |
2076 | req->ts_recent); | 2076 | req->ts_recent); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 77e265d7bb8f..6d6142f9c478 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -243,8 +243,8 @@ static void udp_v4_unhash(struct sock *sk) | |||
243 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try | 243 | /* UDP is nearly always wildcards out the wazoo, it makes no sense to try |
244 | * harder than this. -DaveM | 244 | * harder than this. -DaveM |
245 | */ | 245 | */ |
246 | static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, | 246 | static struct sock *udp_v4_lookup_longway(__be32 saddr, __be16 sport, |
247 | u32 daddr, u16 dport, int dif) | 247 | __be32 daddr, __be16 dport, int dif) |
248 | { | 248 | { |
249 | struct sock *sk, *result = NULL; | 249 | struct sock *sk, *result = NULL; |
250 | struct hlist_node *node; | 250 | struct hlist_node *node; |
@@ -288,8 +288,8 @@ static struct sock *udp_v4_lookup_longway(u32 saddr, u16 sport, | |||
288 | return result; | 288 | return result; |
289 | } | 289 | } |
290 | 290 | ||
291 | static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, | 291 | static __inline__ struct sock *udp_v4_lookup(__be32 saddr, __be16 sport, |
292 | u32 daddr, u16 dport, int dif) | 292 | __be32 daddr, __be16 dport, int dif) |
293 | { | 293 | { |
294 | struct sock *sk; | 294 | struct sock *sk; |
295 | 295 | ||
@@ -302,8 +302,8 @@ static __inline__ struct sock *udp_v4_lookup(u32 saddr, u16 sport, | |||
302 | } | 302 | } |
303 | 303 | ||
304 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, | 304 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, |
305 | u16 loc_port, u32 loc_addr, | 305 | __be16 loc_port, __be32 loc_addr, |
306 | u16 rmt_port, u32 rmt_addr, | 306 | __be16 rmt_port, __be32 rmt_addr, |
307 | int dif) | 307 | int dif) |
308 | { | 308 | { |
309 | struct hlist_node *node; | 309 | struct hlist_node *node; |
@@ -498,7 +498,7 @@ out: | |||
498 | } | 498 | } |
499 | 499 | ||
500 | 500 | ||
501 | static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr, unsigned long daddr, unsigned long base) | 501 | static unsigned short udp_check(struct udphdr *uh, int len, __be32 saddr, __be32 daddr, unsigned long base) |
502 | { | 502 | { |
503 | return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base)); | 503 | return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base)); |
504 | } | 504 | } |
@@ -513,8 +513,8 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
513 | struct rtable *rt = NULL; | 513 | struct rtable *rt = NULL; |
514 | int free = 0; | 514 | int free = 0; |
515 | int connected = 0; | 515 | int connected = 0; |
516 | u32 daddr, faddr, saddr; | 516 | __be32 daddr, faddr, saddr; |
517 | u16 dport; | 517 | __be16 dport; |
518 | u8 tos; | 518 | u8 tos; |
519 | int err; | 519 | int err; |
520 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; | 520 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; |
@@ -931,7 +931,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) | |||
931 | int iphlen, len; | 931 | int iphlen, len; |
932 | 932 | ||
933 | __u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr); | 933 | __u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr); |
934 | __u32 *udpdata32 = (__u32 *)udpdata; | 934 | __be32 *udpdata32 = (__be32 *)udpdata; |
935 | __u16 encap_type = up->encap_type; | 935 | __u16 encap_type = up->encap_type; |
936 | 936 | ||
937 | /* if we're overly short, let UDP handle it */ | 937 | /* if we're overly short, let UDP handle it */ |
@@ -1080,7 +1080,7 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
1080 | * so we don't need to lock the hashes. | 1080 | * so we don't need to lock the hashes. |
1081 | */ | 1081 | */ |
1082 | static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, | 1082 | static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, |
1083 | u32 saddr, u32 daddr) | 1083 | __be32 saddr, __be32 daddr) |
1084 | { | 1084 | { |
1085 | struct sock *sk; | 1085 | struct sock *sk; |
1086 | int dif; | 1086 | int dif; |
@@ -1121,7 +1121,7 @@ static int udp_v4_mcast_deliver(struct sk_buff *skb, struct udphdr *uh, | |||
1121 | * including udp header and folding it to skb->csum. | 1121 | * including udp header and folding it to skb->csum. |
1122 | */ | 1122 | */ |
1123 | static void udp_checksum_init(struct sk_buff *skb, struct udphdr *uh, | 1123 | static void udp_checksum_init(struct sk_buff *skb, struct udphdr *uh, |
1124 | unsigned short ulen, u32 saddr, u32 daddr) | 1124 | unsigned short ulen, __be32 saddr, __be32 daddr) |
1125 | { | 1125 | { |
1126 | if (uh->check == 0) { | 1126 | if (uh->check == 0) { |
1127 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1127 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1146,8 +1146,8 @@ int udp_rcv(struct sk_buff *skb) | |||
1146 | struct udphdr *uh; | 1146 | struct udphdr *uh; |
1147 | unsigned short ulen; | 1147 | unsigned short ulen; |
1148 | struct rtable *rt = (struct rtable*)skb->dst; | 1148 | struct rtable *rt = (struct rtable*)skb->dst; |
1149 | u32 saddr = skb->nh.iph->saddr; | 1149 | __be32 saddr = skb->nh.iph->saddr; |
1150 | u32 daddr = skb->nh.iph->daddr; | 1150 | __be32 daddr = skb->nh.iph->daddr; |
1151 | int len = skb->len; | 1151 | int len = skb->len; |
1152 | 1152 | ||
1153 | /* | 1153 | /* |
@@ -1563,8 +1563,8 @@ void udp_proc_unregister(struct udp_seq_afinfo *afinfo) | |||
1563 | static void udp4_format_sock(struct sock *sp, char *tmpbuf, int bucket) | 1563 | static void udp4_format_sock(struct sock *sp, char *tmpbuf, int bucket) |
1564 | { | 1564 | { |
1565 | struct inet_sock *inet = inet_sk(sp); | 1565 | struct inet_sock *inet = inet_sk(sp); |
1566 | unsigned int dest = inet->daddr; | 1566 | __be32 dest = inet->daddr; |
1567 | unsigned int src = inet->rcv_saddr; | 1567 | __be32 src = inet->rcv_saddr; |
1568 | __u16 destp = ntohs(inet->dport); | 1568 | __u16 destp = ntohs(inet->dport); |
1569 | __u16 srcp = ntohs(inet->sport); | 1569 | __u16 srcp = ntohs(inet->sport); |
1570 | 1570 | ||
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 040e8475f295..8655d038364c 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -23,7 +23,7 @@ int xfrm4_rcv(struct sk_buff *skb) | |||
23 | 23 | ||
24 | EXPORT_SYMBOL(xfrm4_rcv); | 24 | EXPORT_SYMBOL(xfrm4_rcv); |
25 | 25 | ||
26 | static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) | 26 | static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq) |
27 | { | 27 | { |
28 | switch (nexthdr) { | 28 | switch (nexthdr) { |
29 | case IPPROTO_IPIP: | 29 | case IPPROTO_IPIP: |
@@ -55,7 +55,7 @@ drop: | |||
55 | int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | 55 | int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) |
56 | { | 56 | { |
57 | int err; | 57 | int err; |
58 | u32 spi, seq; | 58 | __be32 spi, seq; |
59 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; | 59 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; |
60 | struct xfrm_state *x; | 60 | struct xfrm_state *x; |
61 | int xfrm_nr = 0; | 61 | int xfrm_nr = 0; |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index eabcd27b1767..7a7a00147e55 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -221,7 +221,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
221 | 221 | ||
222 | case IPPROTO_ESP: | 222 | case IPPROTO_ESP: |
223 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 223 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
224 | u32 *ehdr = (u32 *)xprth; | 224 | __be32 *ehdr = (__be32 *)xprth; |
225 | 225 | ||
226 | fl->fl_ipsec_spi = ehdr[0]; | 226 | fl->fl_ipsec_spi = ehdr[0]; |
227 | } | 227 | } |
@@ -229,7 +229,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
229 | 229 | ||
230 | case IPPROTO_AH: | 230 | case IPPROTO_AH: |
231 | if (pskb_may_pull(skb, xprth + 8 - skb->data)) { | 231 | if (pskb_may_pull(skb, xprth + 8 - skb->data)) { |
232 | u32 *ah_hdr = (u32*)xprth; | 232 | __be32 *ah_hdr = (__be32*)xprth; |
233 | 233 | ||
234 | fl->fl_ipsec_spi = ah_hdr[1]; | 234 | fl->fl_ipsec_spi = ah_hdr[1]; |
235 | } | 235 | } |
@@ -237,7 +237,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) | |||
237 | 237 | ||
238 | case IPPROTO_COMP: | 238 | case IPPROTO_COMP: |
239 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 239 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
240 | u16 *ipcomp_hdr = (u16 *)xprth; | 240 | __be16 *ipcomp_hdr = (__be16 *)xprth; |
241 | 241 | ||
242 | fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); | 242 | fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); |
243 | } | 243 | } |
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index fe2034494d08..3cc3df0c6ece 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
@@ -29,9 +29,9 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl, | |||
29 | x->sel.daddr.a4 = fl->fl4_dst; | 29 | x->sel.daddr.a4 = fl->fl4_dst; |
30 | x->sel.saddr.a4 = fl->fl4_src; | 30 | x->sel.saddr.a4 = fl->fl4_src; |
31 | x->sel.dport = xfrm_flowi_dport(fl); | 31 | x->sel.dport = xfrm_flowi_dport(fl); |
32 | x->sel.dport_mask = ~0; | 32 | x->sel.dport_mask = htons(0xffff); |
33 | x->sel.sport = xfrm_flowi_sport(fl); | 33 | x->sel.sport = xfrm_flowi_sport(fl); |
34 | x->sel.sport_mask = ~0; | 34 | x->sel.sport_mask = htons(0xffff); |
35 | x->sel.prefixlen_d = 32; | 35 | x->sel.prefixlen_d = 32; |
36 | x->sel.prefixlen_s = 32; | 36 | x->sel.prefixlen_s = 32; |
37 | x->sel.proto = fl->proto; | 37 | x->sel.proto = fl->proto; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index c18676352397..e03c33b2465b 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1258,8 +1258,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) | |||
1258 | { | 1258 | { |
1259 | const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; | 1259 | const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; |
1260 | const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); | 1260 | const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); |
1261 | u32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr; | 1261 | __be32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr; |
1262 | u32 sk2_rcv_saddr = inet_rcv_saddr(sk2); | 1262 | __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); |
1263 | int sk_ipv6only = ipv6_only_sock(sk); | 1263 | int sk_ipv6only = ipv6_only_sock(sk); |
1264 | int sk2_ipv6only = inet_v6_ipv6only(sk2); | 1264 | int sk2_ipv6only = inet_v6_ipv6only(sk2); |
1265 | int addr_type = ipv6_addr_type(sk_rcv_saddr6); | 1265 | int addr_type = ipv6_addr_type(sk_rcv_saddr6); |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index bf6e8aff19d4..e94eccb99707 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -246,7 +246,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
246 | struct sock *sk = sock->sk; | 246 | struct sock *sk = sock->sk; |
247 | struct inet_sock *inet = inet_sk(sk); | 247 | struct inet_sock *inet = inet_sk(sk); |
248 | struct ipv6_pinfo *np = inet6_sk(sk); | 248 | struct ipv6_pinfo *np = inet6_sk(sk); |
249 | __u32 v4addr = 0; | 249 | __be32 v4addr = 0; |
250 | unsigned short snum; | 250 | unsigned short snum; |
251 | int addr_type = 0; | 251 | int addr_type = 0; |
252 | int err = 0; | 252 | int err = 0; |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index d2f3fc990bfa..8accd1fbeeda 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -64,7 +64,7 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
64 | { | 64 | { |
65 | struct sock *sk; | 65 | struct sock *sk; |
66 | const struct hlist_node *node; | 66 | const struct hlist_node *node; |
67 | const __u32 ports = INET_COMBINED_PORTS(sport, hnum); | 67 | const __portpair ports = INET_COMBINED_PORTS(sport, hnum); |
68 | /* Optimize here for direct hit, only listening connections can | 68 | /* Optimize here for direct hit, only listening connections can |
69 | * have wildcards anyways. | 69 | * have wildcards anyways. |
70 | */ | 70 | */ |
@@ -82,7 +82,7 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
82 | sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) { | 82 | sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) { |
83 | const struct inet_timewait_sock *tw = inet_twsk(sk); | 83 | const struct inet_timewait_sock *tw = inet_twsk(sk); |
84 | 84 | ||
85 | if(*((__u32 *)&(tw->tw_dport)) == ports && | 85 | if(*((__portpair *)&(tw->tw_dport)) == ports && |
86 | sk->sk_family == PF_INET6) { | 86 | sk->sk_family == PF_INET6) { |
87 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); | 87 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
88 | 88 | ||
@@ -171,7 +171,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
171 | const struct in6_addr *daddr = &np->rcv_saddr; | 171 | const struct in6_addr *daddr = &np->rcv_saddr; |
172 | const struct in6_addr *saddr = &np->daddr; | 172 | const struct in6_addr *saddr = &np->daddr; |
173 | const int dif = sk->sk_bound_dev_if; | 173 | const int dif = sk->sk_bound_dev_if; |
174 | const u32 ports = INET_COMBINED_PORTS(inet->dport, lport); | 174 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
175 | const unsigned int hash = inet6_ehashfn(daddr, inet->num, saddr, | 175 | const unsigned int hash = inet6_ehashfn(daddr, inet->num, saddr, |
176 | inet->dport); | 176 | inet->dport); |
177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
@@ -188,7 +188,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
188 | 188 | ||
189 | tw = inet_twsk(sk2); | 189 | tw = inet_twsk(sk2); |
190 | 190 | ||
191 | if(*((__u32 *)&(tw->tw_dport)) == ports && | 191 | if(*((__portpair *)&(tw->tw_dport)) == ports && |
192 | sk2->sk_family == PF_INET6 && | 192 | sk2->sk_family == PF_INET6 && |
193 | ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && | 193 | ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && |
194 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && | 194 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index ad9c6e824e62..a2860e35efd7 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -178,7 +178,7 @@ out_ok: | |||
178 | static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 178 | static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
179 | int type, int code, int offset, __u32 info) | 179 | int type, int code, int offset, __u32 info) |
180 | { | 180 | { |
181 | u32 spi; | 181 | __be32 spi; |
182 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; | 182 | struct ipv6hdr *iph = (struct ipv6hdr*)skb->data; |
183 | struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset); | 183 | struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset); |
184 | struct xfrm_state *x; | 184 | struct xfrm_state *x; |
@@ -234,7 +234,7 @@ static int ipcomp6_tunnel_attach(struct xfrm_state *x) | |||
234 | { | 234 | { |
235 | int err = 0; | 235 | int err = 0; |
236 | struct xfrm_state *t = NULL; | 236 | struct xfrm_state *t = NULL; |
237 | u32 spi; | 237 | __be32 spi; |
238 | 238 | ||
239 | spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&x->props.saddr); | 239 | spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&x->props.saddr); |
240 | if (spi) | 240 | if (spi) |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 4f3bb7fcc8b5..de6b91981b30 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -123,6 +123,9 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features) | |||
123 | struct ipv6hdr *ipv6h; | 123 | struct ipv6hdr *ipv6h; |
124 | struct inet6_protocol *ops; | 124 | struct inet6_protocol *ops; |
125 | 125 | ||
126 | if (!(features & NETIF_F_HW_CSUM)) | ||
127 | features &= ~NETIF_F_SG; | ||
128 | |||
126 | if (unlikely(skb_shinfo(skb)->gso_type & | 129 | if (unlikely(skb_shinfo(skb)->gso_type & |
127 | ~(SKB_GSO_UDP | | 130 | ~(SKB_GSO_UDP | |
128 | SKB_GSO_DODGY | | 131 | SKB_GSO_DODGY | |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 2546fc9f0a78..3b6575478fcc 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1237,7 +1237,7 @@ process: | |||
1237 | 1237 | ||
1238 | skb->dev = NULL; | 1238 | skb->dev = NULL; |
1239 | 1239 | ||
1240 | bh_lock_sock(sk); | 1240 | bh_lock_sock_nested(sk); |
1241 | ret = 0; | 1241 | ret = 0; |
1242 | if (!sock_owned_by_user(sk)) { | 1242 | if (!sock_owned_by_user(sk)) { |
1243 | #ifdef CONFIG_NET_DMA | 1243 | #ifdef CONFIG_NET_DMA |
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index a40a05789013..5c8b7a568800 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -16,10 +16,10 @@ | |||
16 | #include <net/ipv6.h> | 16 | #include <net/ipv6.h> |
17 | #include <net/xfrm.h> | 17 | #include <net/xfrm.h> |
18 | 18 | ||
19 | int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi) | 19 | int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi) |
20 | { | 20 | { |
21 | int err; | 21 | int err; |
22 | u32 seq; | 22 | __be32 seq; |
23 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; | 23 | struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; |
24 | struct xfrm_state *x; | 24 | struct xfrm_state *x; |
25 | int xfrm_nr = 0; | 25 | int xfrm_nr = 0; |
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c index 711bfafb2472..9ddaa9d41539 100644 --- a/net/ipv6/xfrm6_state.c +++ b/net/ipv6/xfrm6_state.c | |||
@@ -29,9 +29,9 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl, | |||
29 | ipv6_addr_copy((struct in6_addr *)&x->sel.daddr, &fl->fl6_dst); | 29 | ipv6_addr_copy((struct in6_addr *)&x->sel.daddr, &fl->fl6_dst); |
30 | ipv6_addr_copy((struct in6_addr *)&x->sel.saddr, &fl->fl6_src); | 30 | ipv6_addr_copy((struct in6_addr *)&x->sel.saddr, &fl->fl6_src); |
31 | x->sel.dport = xfrm_flowi_dport(fl); | 31 | x->sel.dport = xfrm_flowi_dport(fl); |
32 | x->sel.dport_mask = ~0; | 32 | x->sel.dport_mask = htons(0xffff); |
33 | x->sel.sport = xfrm_flowi_sport(fl); | 33 | x->sel.sport = xfrm_flowi_sport(fl); |
34 | x->sel.sport_mask = ~0; | 34 | x->sel.sport_mask = htons(0xffff); |
35 | x->sel.prefixlen_d = 128; | 35 | x->sel.prefixlen_d = 128; |
36 | x->sel.prefixlen_s = 128; | 36 | x->sel.prefixlen_s = 128; |
37 | x->sel.proto = fl->proto; | 37 | x->sel.proto = fl->proto; |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 59685ee8f700..7af227bb1551 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -258,7 +258,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
258 | static int xfrm6_tunnel_rcv(struct sk_buff *skb) | 258 | static int xfrm6_tunnel_rcv(struct sk_buff *skb) |
259 | { | 259 | { |
260 | struct ipv6hdr *iph = skb->nh.ipv6h; | 260 | struct ipv6hdr *iph = skb->nh.ipv6h; |
261 | u32 spi; | 261 | __be32 spi; |
262 | 262 | ||
263 | spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr); | 263 | spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr); |
264 | return xfrm6_rcv_spi(skb, spi); | 264 | return xfrm6_rcv_spi(skb, spi); |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 17699eeb64d7..7e1aea89ef05 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -132,13 +132,14 @@ static void irda_disconnect_indication(void *instance, void *sap, | |||
132 | 132 | ||
133 | /* Prevent race conditions with irda_release() and irda_shutdown() */ | 133 | /* Prevent race conditions with irda_release() and irda_shutdown() */ |
134 | if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { | 134 | if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { |
135 | lock_sock(sk); | ||
135 | sk->sk_state = TCP_CLOSE; | 136 | sk->sk_state = TCP_CLOSE; |
136 | sk->sk_err = ECONNRESET; | 137 | sk->sk_err = ECONNRESET; |
137 | sk->sk_shutdown |= SEND_SHUTDOWN; | 138 | sk->sk_shutdown |= SEND_SHUTDOWN; |
138 | 139 | ||
139 | sk->sk_state_change(sk); | 140 | sk->sk_state_change(sk); |
140 | /* Uh-oh... Should use sock_orphan ? */ | 141 | sock_orphan(sk); |
141 | sock_set_flag(sk, SOCK_DEAD); | 142 | release_sock(sk); |
142 | 143 | ||
143 | /* Close our TSAP. | 144 | /* Close our TSAP. |
144 | * If we leave it open, IrLMP put it back into the list of | 145 | * If we leave it open, IrLMP put it back into the list of |
@@ -308,7 +309,8 @@ static void irda_connect_response(struct irda_sock *self) | |||
308 | 309 | ||
309 | IRDA_ASSERT(self != NULL, return;); | 310 | IRDA_ASSERT(self != NULL, return;); |
310 | 311 | ||
311 | skb = alloc_skb(64, GFP_ATOMIC); | 312 | skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, |
313 | GFP_ATOMIC); | ||
312 | if (skb == NULL) { | 314 | if (skb == NULL) { |
313 | IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n", | 315 | IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n", |
314 | __FUNCTION__); | 316 | __FUNCTION__); |
@@ -1212,6 +1214,7 @@ static int irda_release(struct socket *sock) | |||
1212 | if (sk == NULL) | 1214 | if (sk == NULL) |
1213 | return 0; | 1215 | return 0; |
1214 | 1216 | ||
1217 | lock_sock(sk); | ||
1215 | sk->sk_state = TCP_CLOSE; | 1218 | sk->sk_state = TCP_CLOSE; |
1216 | sk->sk_shutdown |= SEND_SHUTDOWN; | 1219 | sk->sk_shutdown |= SEND_SHUTDOWN; |
1217 | sk->sk_state_change(sk); | 1220 | sk->sk_state_change(sk); |
@@ -1221,6 +1224,7 @@ static int irda_release(struct socket *sock) | |||
1221 | 1224 | ||
1222 | sock_orphan(sk); | 1225 | sock_orphan(sk); |
1223 | sock->sk = NULL; | 1226 | sock->sk = NULL; |
1227 | release_sock(sk); | ||
1224 | 1228 | ||
1225 | /* Purge queues (see sock_init_data()) */ | 1229 | /* Purge queues (see sock_init_data()) */ |
1226 | skb_queue_purge(&sk->sk_receive_queue); | 1230 | skb_queue_purge(&sk->sk_receive_queue); |
@@ -1353,6 +1357,7 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1353 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__); | 1357 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__); |
1354 | 1358 | ||
1355 | IRDA_ASSERT(self != NULL, return -1;); | 1359 | IRDA_ASSERT(self != NULL, return -1;); |
1360 | IRDA_ASSERT(!sock_error(sk), return -1;); | ||
1356 | 1361 | ||
1357 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1362 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
1358 | flags & MSG_DONTWAIT, &err); | 1363 | flags & MSG_DONTWAIT, &err); |
@@ -1405,6 +1410,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1405 | IRDA_DEBUG(3, "%s()\n", __FUNCTION__); | 1410 | IRDA_DEBUG(3, "%s()\n", __FUNCTION__); |
1406 | 1411 | ||
1407 | IRDA_ASSERT(self != NULL, return -1;); | 1412 | IRDA_ASSERT(self != NULL, return -1;); |
1413 | IRDA_ASSERT(!sock_error(sk), return -1;); | ||
1408 | 1414 | ||
1409 | if (sock->flags & __SO_ACCEPTCON) | 1415 | if (sock->flags & __SO_ACCEPTCON) |
1410 | return(-EINVAL); | 1416 | return(-EINVAL); |
diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c index 959874b6451f..c8e0d89ee11f 100644 --- a/net/irda/ircomm/ircomm_lmp.c +++ b/net/irda/ircomm/ircomm_lmp.c | |||
@@ -81,7 +81,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self, | |||
81 | 81 | ||
82 | /* Any userdata supplied? */ | 82 | /* Any userdata supplied? */ |
83 | if (userdata == NULL) { | 83 | if (userdata == NULL) { |
84 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 84 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
85 | if (!tx_skb) | 85 | if (!tx_skb) |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | 87 | ||
@@ -115,7 +115,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self, | |||
115 | IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); | 115 | IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); |
116 | 116 | ||
117 | if (!userdata) { | 117 | if (!userdata) { |
118 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 118 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
119 | if (!tx_skb) | 119 | if (!tx_skb) |
120 | return -ENOMEM; | 120 | return -ENOMEM; |
121 | 121 | ||
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 61128aa05b40..415cf4eec23b 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
@@ -345,10 +345,11 @@ static void iriap_disconnect_request(struct iriap_cb *self) | |||
345 | IRDA_ASSERT(self != NULL, return;); | 345 | IRDA_ASSERT(self != NULL, return;); |
346 | IRDA_ASSERT(self->magic == IAS_MAGIC, return;); | 346 | IRDA_ASSERT(self->magic == IAS_MAGIC, return;); |
347 | 347 | ||
348 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 348 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
349 | if (tx_skb == NULL) { | 349 | if (tx_skb == NULL) { |
350 | IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", | 350 | IRDA_DEBUG(0, |
351 | __FUNCTION__, 64); | 351 | "%s(), Could not allocate an sk_buff of length %d\n", |
352 | __FUNCTION__, LMP_MAX_HEADER); | ||
352 | return; | 353 | return; |
353 | } | 354 | } |
354 | 355 | ||
@@ -701,7 +702,7 @@ void iriap_send_ack(struct iriap_cb *self) | |||
701 | IRDA_ASSERT(self != NULL, return;); | 702 | IRDA_ASSERT(self != NULL, return;); |
702 | IRDA_ASSERT(self->magic == IAS_MAGIC, return;); | 703 | IRDA_ASSERT(self->magic == IAS_MAGIC, return;); |
703 | 704 | ||
704 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 705 | tx_skb = alloc_skb(LMP_MAX_HEADER + 1, GFP_ATOMIC); |
705 | if (!tx_skb) | 706 | if (!tx_skb) |
706 | return; | 707 | return; |
707 | 708 | ||
diff --git a/net/irda/iriap_event.c b/net/irda/iriap_event.c index da17395df05a..99b18dc7a0b7 100644 --- a/net/irda/iriap_event.c +++ b/net/irda/iriap_event.c | |||
@@ -365,7 +365,7 @@ static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event, | |||
365 | 365 | ||
366 | switch (event) { | 366 | switch (event) { |
367 | case IAP_LM_CONNECT_INDICATION: | 367 | case IAP_LM_CONNECT_INDICATION: |
368 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 368 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
369 | if (tx_skb == NULL) { | 369 | if (tx_skb == NULL) { |
370 | IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__); | 370 | IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__); |
371 | return; | 371 | return; |
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 7dd0a2fe1d20..9b962f247714 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c | |||
@@ -636,7 +636,8 @@ void irlan_get_provider_info(struct irlan_cb *self) | |||
636 | IRDA_ASSERT(self != NULL, return;); | 636 | IRDA_ASSERT(self != NULL, return;); |
637 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 637 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
638 | 638 | ||
639 | skb = alloc_skb(64, GFP_ATOMIC); | 639 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER, |
640 | GFP_ATOMIC); | ||
640 | if (!skb) | 641 | if (!skb) |
641 | return; | 642 | return; |
642 | 643 | ||
@@ -668,7 +669,10 @@ void irlan_open_data_channel(struct irlan_cb *self) | |||
668 | IRDA_ASSERT(self != NULL, return;); | 669 | IRDA_ASSERT(self != NULL, return;); |
669 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 670 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
670 | 671 | ||
671 | skb = alloc_skb(64, GFP_ATOMIC); | 672 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
673 | IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + | ||
674 | IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), | ||
675 | GFP_ATOMIC); | ||
672 | if (!skb) | 676 | if (!skb) |
673 | return; | 677 | return; |
674 | 678 | ||
@@ -704,7 +708,9 @@ void irlan_close_data_channel(struct irlan_cb *self) | |||
704 | if (self->client.tsap_ctrl == NULL) | 708 | if (self->client.tsap_ctrl == NULL) |
705 | return; | 709 | return; |
706 | 710 | ||
707 | skb = alloc_skb(64, GFP_ATOMIC); | 711 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
712 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN"), | ||
713 | GFP_ATOMIC); | ||
708 | if (!skb) | 714 | if (!skb) |
709 | return; | 715 | return; |
710 | 716 | ||
@@ -715,7 +721,7 @@ void irlan_close_data_channel(struct irlan_cb *self) | |||
715 | 721 | ||
716 | /* Build frame */ | 722 | /* Build frame */ |
717 | frame[0] = CMD_CLOSE_DATA_CHAN; | 723 | frame[0] = CMD_CLOSE_DATA_CHAN; |
718 | frame[1] = 0x01; /* Two parameters */ | 724 | frame[1] = 0x01; /* One parameter */ |
719 | 725 | ||
720 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); | 726 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); |
721 | 727 | ||
@@ -739,7 +745,11 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) | |||
739 | IRDA_ASSERT(self != NULL, return;); | 745 | IRDA_ASSERT(self != NULL, return;); |
740 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 746 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
741 | 747 | ||
742 | skb = alloc_skb(128, GFP_ATOMIC); | 748 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
749 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | ||
750 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + | ||
751 | IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"), | ||
752 | GFP_ATOMIC); | ||
743 | if (!skb) | 753 | if (!skb) |
744 | return; | 754 | return; |
745 | 755 | ||
@@ -777,7 +787,12 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) | |||
777 | IRDA_ASSERT(self != NULL, return;); | 787 | IRDA_ASSERT(self != NULL, return;); |
778 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 788 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
779 | 789 | ||
780 | skb = alloc_skb(128, GFP_ATOMIC); | 790 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
791 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | ||
792 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + | ||
793 | /* We may waste one byte here...*/ | ||
794 | IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"), | ||
795 | GFP_ATOMIC); | ||
781 | if (!skb) | 796 | if (!skb) |
782 | return; | 797 | return; |
783 | 798 | ||
@@ -816,7 +831,12 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) | |||
816 | IRDA_ASSERT(self != NULL, return;); | 831 | IRDA_ASSERT(self != NULL, return;); |
817 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 832 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
818 | 833 | ||
819 | skb = alloc_skb(128, GFP_ATOMIC); | 834 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
835 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | ||
836 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") + | ||
837 | /* We may waste one byte here...*/ | ||
838 | IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "NONE"), | ||
839 | GFP_ATOMIC); | ||
820 | if (!skb) | 840 | if (!skb) |
821 | return; | 841 | return; |
822 | 842 | ||
@@ -856,7 +876,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) | |||
856 | IRDA_ASSERT(self != NULL, return;); | 876 | IRDA_ASSERT(self != NULL, return;); |
857 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 877 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
858 | 878 | ||
859 | skb = alloc_skb(128, GFP_ATOMIC); | 879 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
880 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | ||
881 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + | ||
882 | IRLAN_STRING_PARAMETER_LEN("FILTER_OPERATION", | ||
883 | "DYNAMIC"), | ||
884 | GFP_ATOMIC); | ||
860 | if (!skb) | 885 | if (!skb) |
861 | return; | 886 | return; |
862 | 887 | ||
@@ -891,7 +916,10 @@ void irlan_get_media_char(struct irlan_cb *self) | |||
891 | IRDA_ASSERT(self != NULL, return;); | 916 | IRDA_ASSERT(self != NULL, return;); |
892 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 917 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
893 | 918 | ||
894 | skb = alloc_skb(64, GFP_ATOMIC); | 919 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
920 | IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), | ||
921 | GFP_ATOMIC); | ||
922 | |||
895 | if (!skb) | 923 | if (!skb) |
896 | return; | 924 | return; |
897 | 925 | ||
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c index 9c0df86044d7..58efde919667 100644 --- a/net/irda/irlan/irlan_provider.c +++ b/net/irda/irlan/irlan_provider.c | |||
@@ -296,7 +296,14 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, | |||
296 | IRDA_ASSERT(self != NULL, return;); | 296 | IRDA_ASSERT(self != NULL, return;); |
297 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 297 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
298 | 298 | ||
299 | skb = alloc_skb(128, GFP_ATOMIC); | 299 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
300 | /* Bigger param length comes from CMD_GET_MEDIA_CHAR */ | ||
301 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + | ||
302 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BORADCAST") + | ||
303 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") + | ||
304 | IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "HOSTED"), | ||
305 | GFP_ATOMIC); | ||
306 | |||
300 | if (!skb) | 307 | if (!skb) |
301 | return; | 308 | return; |
302 | 309 | ||
@@ -354,8 +361,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, | |||
354 | } else | 361 | } else |
355 | skb->data[1] = 0x02; /* 2 parameters */ | 362 | skb->data[1] = 0x02; /* 2 parameters */ |
356 | irlan_insert_byte_param(skb, "DATA_CHAN", self->stsap_sel_data); | 363 | irlan_insert_byte_param(skb, "DATA_CHAN", self->stsap_sel_data); |
357 | irlan_insert_array_param(skb, "RECONNECT_KEY", "LINUX RULES!", | 364 | irlan_insert_string_param(skb, "RECONNECT_KEY", "LINUX RULES!"); |
358 | 12); | ||
359 | break; | 365 | break; |
360 | case CMD_FILTER_OPERATION: | 366 | case CMD_FILTER_OPERATION: |
361 | irlan_filter_request(self, skb); | 367 | irlan_filter_request(self, skb); |
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index ccb983bf0f4a..dba349c832d0 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c | |||
@@ -117,7 +117,9 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos) | |||
117 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); | 117 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); |
118 | 118 | ||
119 | /* Allocate frame */ | 119 | /* Allocate frame */ |
120 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 120 | tx_skb = alloc_skb(sizeof(struct snrm_frame) + |
121 | IRLAP_NEGOCIATION_PARAMS_LEN, | ||
122 | GFP_ATOMIC); | ||
121 | if (!tx_skb) | 123 | if (!tx_skb) |
122 | return; | 124 | return; |
123 | 125 | ||
@@ -136,7 +138,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos) | |||
136 | * If we are establishing a connection then insert QoS paramerters | 138 | * If we are establishing a connection then insert QoS paramerters |
137 | */ | 139 | */ |
138 | if (qos) { | 140 | if (qos) { |
139 | skb_put(tx_skb, 9); /* 21 left */ | 141 | skb_put(tx_skb, 9); /* 25 left */ |
140 | frame->saddr = cpu_to_le32(self->saddr); | 142 | frame->saddr = cpu_to_le32(self->saddr); |
141 | frame->daddr = cpu_to_le32(self->daddr); | 143 | frame->daddr = cpu_to_le32(self->daddr); |
142 | 144 | ||
@@ -210,7 +212,9 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos) | |||
210 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); | 212 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); |
211 | 213 | ||
212 | /* Allocate frame */ | 214 | /* Allocate frame */ |
213 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 215 | tx_skb = alloc_skb(sizeof(struct ua_frame) + |
216 | IRLAP_NEGOCIATION_PARAMS_LEN, | ||
217 | GFP_ATOMIC); | ||
214 | if (!tx_skb) | 218 | if (!tx_skb) |
215 | return; | 219 | return; |
216 | 220 | ||
@@ -245,23 +249,23 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos) | |||
245 | void irlap_send_dm_frame( struct irlap_cb *self) | 249 | void irlap_send_dm_frame( struct irlap_cb *self) |
246 | { | 250 | { |
247 | struct sk_buff *tx_skb = NULL; | 251 | struct sk_buff *tx_skb = NULL; |
248 | __u8 *frame; | 252 | struct dm_frame *frame; |
249 | 253 | ||
250 | IRDA_ASSERT(self != NULL, return;); | 254 | IRDA_ASSERT(self != NULL, return;); |
251 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); | 255 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); |
252 | 256 | ||
253 | tx_skb = alloc_skb(32, GFP_ATOMIC); | 257 | tx_skb = alloc_skb(sizeof(struct dm_frame), GFP_ATOMIC); |
254 | if (!tx_skb) | 258 | if (!tx_skb) |
255 | return; | 259 | return; |
256 | 260 | ||
257 | frame = skb_put(tx_skb, 2); | 261 | frame = (struct dm_frame *)skb_put(tx_skb, 2); |
258 | 262 | ||
259 | if (self->state == LAP_NDM) | 263 | if (self->state == LAP_NDM) |
260 | frame[0] = CBROADCAST; | 264 | frame->caddr = CBROADCAST; |
261 | else | 265 | else |
262 | frame[0] = self->caddr; | 266 | frame->caddr = self->caddr; |
263 | 267 | ||
264 | frame[1] = DM_RSP | PF_BIT; | 268 | frame->control = DM_RSP | PF_BIT; |
265 | 269 | ||
266 | irlap_queue_xmit(self, tx_skb); | 270 | irlap_queue_xmit(self, tx_skb); |
267 | } | 271 | } |
@@ -275,21 +279,21 @@ void irlap_send_dm_frame( struct irlap_cb *self) | |||
275 | void irlap_send_disc_frame(struct irlap_cb *self) | 279 | void irlap_send_disc_frame(struct irlap_cb *self) |
276 | { | 280 | { |
277 | struct sk_buff *tx_skb = NULL; | 281 | struct sk_buff *tx_skb = NULL; |
278 | __u8 *frame; | 282 | struct disc_frame *frame; |
279 | 283 | ||
280 | IRDA_DEBUG(3, "%s()\n", __FUNCTION__); | 284 | IRDA_DEBUG(3, "%s()\n", __FUNCTION__); |
281 | 285 | ||
282 | IRDA_ASSERT(self != NULL, return;); | 286 | IRDA_ASSERT(self != NULL, return;); |
283 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); | 287 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); |
284 | 288 | ||
285 | tx_skb = alloc_skb(16, GFP_ATOMIC); | 289 | tx_skb = alloc_skb(sizeof(struct disc_frame), GFP_ATOMIC); |
286 | if (!tx_skb) | 290 | if (!tx_skb) |
287 | return; | 291 | return; |
288 | 292 | ||
289 | frame = skb_put(tx_skb, 2); | 293 | frame = (struct disc_frame *)skb_put(tx_skb, 2); |
290 | 294 | ||
291 | frame[0] = self->caddr | CMD_FRAME; | 295 | frame->caddr = self->caddr | CMD_FRAME; |
292 | frame[1] = DISC_CMD | PF_BIT; | 296 | frame->control = DISC_CMD | PF_BIT; |
293 | 297 | ||
294 | irlap_queue_xmit(self, tx_skb); | 298 | irlap_queue_xmit(self, tx_skb); |
295 | } | 299 | } |
@@ -315,7 +319,8 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s, | |||
315 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); | 319 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); |
316 | IRDA_ASSERT(discovery != NULL, return;); | 320 | IRDA_ASSERT(discovery != NULL, return;); |
317 | 321 | ||
318 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 322 | tx_skb = alloc_skb(sizeof(struct xid_frame) + IRLAP_DISCOVERY_INFO_LEN, |
323 | GFP_ATOMIC); | ||
319 | if (!tx_skb) | 324 | if (!tx_skb) |
320 | return; | 325 | return; |
321 | 326 | ||
@@ -573,18 +578,18 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, | |||
573 | void irlap_send_rr_frame(struct irlap_cb *self, int command) | 578 | void irlap_send_rr_frame(struct irlap_cb *self, int command) |
574 | { | 579 | { |
575 | struct sk_buff *tx_skb; | 580 | struct sk_buff *tx_skb; |
576 | __u8 *frame; | 581 | struct rr_frame *frame; |
577 | 582 | ||
578 | tx_skb = alloc_skb(16, GFP_ATOMIC); | 583 | tx_skb = alloc_skb(sizeof(struct rr_frame), GFP_ATOMIC); |
579 | if (!tx_skb) | 584 | if (!tx_skb) |
580 | return; | 585 | return; |
581 | 586 | ||
582 | frame = skb_put(tx_skb, 2); | 587 | frame = (struct rr_frame *)skb_put(tx_skb, 2); |
583 | 588 | ||
584 | frame[0] = self->caddr; | 589 | frame->caddr = self->caddr; |
585 | frame[0] |= (command) ? CMD_FRAME : 0; | 590 | frame->caddr |= (command) ? CMD_FRAME : 0; |
586 | 591 | ||
587 | frame[1] = RR | PF_BIT | (self->vr << 5); | 592 | frame->control = RR | PF_BIT | (self->vr << 5); |
588 | 593 | ||
589 | irlap_queue_xmit(self, tx_skb); | 594 | irlap_queue_xmit(self, tx_skb); |
590 | } | 595 | } |
@@ -598,16 +603,16 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command) | |||
598 | void irlap_send_rd_frame(struct irlap_cb *self) | 603 | void irlap_send_rd_frame(struct irlap_cb *self) |
599 | { | 604 | { |
600 | struct sk_buff *tx_skb; | 605 | struct sk_buff *tx_skb; |
601 | __u8 *frame; | 606 | struct rd_frame *frame; |
602 | 607 | ||
603 | tx_skb = alloc_skb(16, GFP_ATOMIC); | 608 | tx_skb = alloc_skb(sizeof(struct rd_frame), GFP_ATOMIC); |
604 | if (!tx_skb) | 609 | if (!tx_skb) |
605 | return; | 610 | return; |
606 | 611 | ||
607 | frame = skb_put(tx_skb, 2); | 612 | frame = (struct rd_frame *)skb_put(tx_skb, 2); |
608 | 613 | ||
609 | frame[0] = self->caddr; | 614 | frame->caddr = self->caddr; |
610 | frame[1] = RD_RSP | PF_BIT; | 615 | frame->caddr = RD_RSP | PF_BIT; |
611 | 616 | ||
612 | irlap_queue_xmit(self, tx_skb); | 617 | irlap_queue_xmit(self, tx_skb); |
613 | } | 618 | } |
@@ -1214,7 +1219,7 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr, | |||
1214 | struct test_frame *frame; | 1219 | struct test_frame *frame; |
1215 | __u8 *info; | 1220 | __u8 *info; |
1216 | 1221 | ||
1217 | tx_skb = alloc_skb(cmd->len+sizeof(struct test_frame), GFP_ATOMIC); | 1222 | tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC); |
1218 | if (!tx_skb) | 1223 | if (!tx_skb) |
1219 | return; | 1224 | return; |
1220 | 1225 | ||
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index c440913dee14..5073261b9d0c 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c | |||
@@ -392,7 +392,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel, | |||
392 | 392 | ||
393 | /* Any userdata? */ | 393 | /* Any userdata? */ |
394 | if (tx_skb == NULL) { | 394 | if (tx_skb == NULL) { |
395 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 395 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
396 | if (!tx_skb) | 396 | if (!tx_skb) |
397 | return -ENOMEM; | 397 | return -ENOMEM; |
398 | 398 | ||
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 42acf1cde737..3c2e70b77df1 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -804,12 +804,12 @@ static inline void irttp_give_credit(struct tsap_cb *self) | |||
804 | self->send_credit, self->avail_credit, self->remote_credit); | 804 | self->send_credit, self->avail_credit, self->remote_credit); |
805 | 805 | ||
806 | /* Give credit to peer */ | 806 | /* Give credit to peer */ |
807 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 807 | tx_skb = alloc_skb(TTP_MAX_HEADER, GFP_ATOMIC); |
808 | if (!tx_skb) | 808 | if (!tx_skb) |
809 | return; | 809 | return; |
810 | 810 | ||
811 | /* Reserve space for LMP, and LAP header */ | 811 | /* Reserve space for LMP, and LAP header */ |
812 | skb_reserve(tx_skb, self->max_header_size); | 812 | skb_reserve(tx_skb, LMP_MAX_HEADER); |
813 | 813 | ||
814 | /* | 814 | /* |
815 | * Since we can transmit and receive frames concurrently, | 815 | * Since we can transmit and receive frames concurrently, |
@@ -1093,7 +1093,8 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, | |||
1093 | 1093 | ||
1094 | /* Any userdata supplied? */ | 1094 | /* Any userdata supplied? */ |
1095 | if (userdata == NULL) { | 1095 | if (userdata == NULL) { |
1096 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 1096 | tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, |
1097 | GFP_ATOMIC); | ||
1097 | if (!tx_skb) | 1098 | if (!tx_skb) |
1098 | return -ENOMEM; | 1099 | return -ENOMEM; |
1099 | 1100 | ||
@@ -1341,7 +1342,8 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, | |||
1341 | 1342 | ||
1342 | /* Any userdata supplied? */ | 1343 | /* Any userdata supplied? */ |
1343 | if (userdata == NULL) { | 1344 | if (userdata == NULL) { |
1344 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 1345 | tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, |
1346 | GFP_ATOMIC); | ||
1345 | if (!tx_skb) | 1347 | if (!tx_skb) |
1346 | return -ENOMEM; | 1348 | return -ENOMEM; |
1347 | 1349 | ||
@@ -1540,14 +1542,14 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata, | |||
1540 | 1542 | ||
1541 | if (!userdata) { | 1543 | if (!userdata) { |
1542 | struct sk_buff *tx_skb; | 1544 | struct sk_buff *tx_skb; |
1543 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 1545 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
1544 | if (!tx_skb) | 1546 | if (!tx_skb) |
1545 | return -ENOMEM; | 1547 | return -ENOMEM; |
1546 | 1548 | ||
1547 | /* | 1549 | /* |
1548 | * Reserve space for MUX and LAP header | 1550 | * Reserve space for MUX and LAP header |
1549 | */ | 1551 | */ |
1550 | skb_reserve(tx_skb, TTP_MAX_HEADER); | 1552 | skb_reserve(tx_skb, LMP_MAX_HEADER); |
1551 | 1553 | ||
1552 | userdata = tx_skb; | 1554 | userdata = tx_skb; |
1553 | } | 1555 | } |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 83b443ddc72f..ff98e70b0931 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -2140,7 +2140,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h | |||
2140 | xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); | 2140 | xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); |
2141 | xp->selector.sport = ((struct sockaddr_in *)(sa+1))->sin_port; | 2141 | xp->selector.sport = ((struct sockaddr_in *)(sa+1))->sin_port; |
2142 | if (xp->selector.sport) | 2142 | if (xp->selector.sport) |
2143 | xp->selector.sport_mask = ~0; | 2143 | xp->selector.sport_mask = htons(0xffff); |
2144 | 2144 | ||
2145 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], | 2145 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], |
2146 | pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr); | 2146 | pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr); |
@@ -2153,7 +2153,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h | |||
2153 | 2153 | ||
2154 | xp->selector.dport = ((struct sockaddr_in *)(sa+1))->sin_port; | 2154 | xp->selector.dport = ((struct sockaddr_in *)(sa+1))->sin_port; |
2155 | if (xp->selector.dport) | 2155 | if (xp->selector.dport) |
2156 | xp->selector.dport_mask = ~0; | 2156 | xp->selector.dport_mask = htons(0xffff); |
2157 | 2157 | ||
2158 | sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; | 2158 | sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; |
2159 | if (sec_ctx != NULL) { | 2159 | if (sec_ctx != NULL) { |
@@ -2243,7 +2243,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg | |||
2243 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); | 2243 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); |
2244 | sel.sport = ((struct sockaddr_in *)(sa+1))->sin_port; | 2244 | sel.sport = ((struct sockaddr_in *)(sa+1))->sin_port; |
2245 | if (sel.sport) | 2245 | if (sel.sport) |
2246 | sel.sport_mask = ~0; | 2246 | sel.sport_mask = htons(0xffff); |
2247 | 2247 | ||
2248 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], | 2248 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], |
2249 | pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); | 2249 | pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); |
@@ -2251,7 +2251,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg | |||
2251 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); | 2251 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); |
2252 | sel.dport = ((struct sockaddr_in *)(sa+1))->sin_port; | 2252 | sel.dport = ((struct sockaddr_in *)(sa+1))->sin_port; |
2253 | if (sel.dport) | 2253 | if (sel.dport) |
2254 | sel.dport_mask = ~0; | 2254 | sel.dport_mask = htons(0xffff); |
2255 | 2255 | ||
2256 | sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; | 2256 | sec_ctx = (struct sadb_x_sec_ctx *) ext_hdrs[SADB_X_EXT_SEC_CTX-1]; |
2257 | memset(&tmp, 0, sizeof(struct xfrm_policy)); | 2257 | memset(&tmp, 0, sizeof(struct xfrm_policy)); |
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index 4125a55f469f..09986ca962a6 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/socket.h> | 32 | #include <linux/socket.h> |
33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
34 | #include <linux/skbuff.h> | 34 | #include <linux/skbuff.h> |
35 | #include <linux/audit.h> | ||
35 | #include <net/sock.h> | 36 | #include <net/sock.h> |
36 | #include <net/netlink.h> | 37 | #include <net/netlink.h> |
37 | #include <net/genetlink.h> | 38 | #include <net/genetlink.h> |
@@ -162,8 +163,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info) | |||
162 | int nla_a_rem; | 163 | int nla_a_rem; |
163 | int nla_b_rem; | 164 | int nla_b_rem; |
164 | 165 | ||
165 | if (!info->attrs[NLBL_CIPSOV4_A_DOI] || | 166 | if (!info->attrs[NLBL_CIPSOV4_A_TAGLST] || |
166 | !info->attrs[NLBL_CIPSOV4_A_TAGLST] || | ||
167 | !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST]) | 167 | !info->attrs[NLBL_CIPSOV4_A_MLSLVLLST]) |
168 | return -EINVAL; | 168 | return -EINVAL; |
169 | 169 | ||
@@ -344,8 +344,7 @@ static int netlbl_cipsov4_add_pass(struct genl_info *info) | |||
344 | int ret_val; | 344 | int ret_val; |
345 | struct cipso_v4_doi *doi_def = NULL; | 345 | struct cipso_v4_doi *doi_def = NULL; |
346 | 346 | ||
347 | if (!info->attrs[NLBL_CIPSOV4_A_DOI] || | 347 | if (!info->attrs[NLBL_CIPSOV4_A_TAGLST]) |
348 | !info->attrs[NLBL_CIPSOV4_A_TAGLST]) | ||
349 | return -EINVAL; | 348 | return -EINVAL; |
350 | 349 | ||
351 | doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL); | 350 | doi_def = kmalloc(sizeof(*doi_def), GFP_KERNEL); |
@@ -381,21 +380,35 @@ static int netlbl_cipsov4_add(struct sk_buff *skb, struct genl_info *info) | |||
381 | 380 | ||
382 | { | 381 | { |
383 | int ret_val = -EINVAL; | 382 | int ret_val = -EINVAL; |
384 | u32 map_type; | 383 | u32 type; |
384 | u32 doi; | ||
385 | const char *type_str = "(unknown)"; | ||
386 | struct audit_buffer *audit_buf; | ||
385 | 387 | ||
386 | if (!info->attrs[NLBL_CIPSOV4_A_MTYPE]) | 388 | if (!info->attrs[NLBL_CIPSOV4_A_DOI] || |
389 | !info->attrs[NLBL_CIPSOV4_A_MTYPE]) | ||
387 | return -EINVAL; | 390 | return -EINVAL; |
388 | 391 | ||
389 | map_type = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_MTYPE]); | 392 | type = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_MTYPE]); |
390 | switch (map_type) { | 393 | switch (type) { |
391 | case CIPSO_V4_MAP_STD: | 394 | case CIPSO_V4_MAP_STD: |
395 | type_str = "std"; | ||
392 | ret_val = netlbl_cipsov4_add_std(info); | 396 | ret_val = netlbl_cipsov4_add_std(info); |
393 | break; | 397 | break; |
394 | case CIPSO_V4_MAP_PASS: | 398 | case CIPSO_V4_MAP_PASS: |
399 | type_str = "pass"; | ||
395 | ret_val = netlbl_cipsov4_add_pass(info); | 400 | ret_val = netlbl_cipsov4_add_pass(info); |
396 | break; | 401 | break; |
397 | } | 402 | } |
398 | 403 | ||
404 | if (ret_val == 0) { | ||
405 | doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]); | ||
406 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_CIPSOV4_ADD, | ||
407 | NETLINK_CB(skb).sid); | ||
408 | audit_log_format(audit_buf, " doi=%u type=%s", doi, type_str); | ||
409 | audit_log_end(audit_buf); | ||
410 | } | ||
411 | |||
399 | return ret_val; | 412 | return ret_val; |
400 | } | 413 | } |
401 | 414 | ||
@@ -653,11 +666,21 @@ static int netlbl_cipsov4_listall(struct sk_buff *skb, | |||
653 | static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info) | 666 | static int netlbl_cipsov4_remove(struct sk_buff *skb, struct genl_info *info) |
654 | { | 667 | { |
655 | int ret_val = -EINVAL; | 668 | int ret_val = -EINVAL; |
656 | u32 doi; | 669 | u32 doi = 0; |
670 | struct audit_buffer *audit_buf; | ||
657 | 671 | ||
658 | if (info->attrs[NLBL_CIPSOV4_A_DOI]) { | 672 | if (info->attrs[NLBL_CIPSOV4_A_DOI]) { |
659 | doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]); | 673 | doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]); |
660 | ret_val = cipso_v4_doi_remove(doi, netlbl_cipsov4_doi_free); | 674 | ret_val = cipso_v4_doi_remove(doi, |
675 | NETLINK_CB(skb).sid, | ||
676 | netlbl_cipsov4_doi_free); | ||
677 | } | ||
678 | |||
679 | if (ret_val == 0) { | ||
680 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_CIPSOV4_DEL, | ||
681 | NETLINK_CB(skb).sid); | ||
682 | audit_log_format(audit_buf, " doi=%u", doi); | ||
683 | audit_log_end(audit_buf); | ||
661 | } | 684 | } |
662 | 685 | ||
663 | return ret_val; | 686 | return ret_val; |
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c index f56d7a8ac7b7..d64e2ae3b129 100644 --- a/net/netlabel/netlabel_domainhash.c +++ b/net/netlabel/netlabel_domainhash.c | |||
@@ -35,12 +35,14 @@ | |||
35 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/string.h> | 37 | #include <linux/string.h> |
38 | #include <linux/audit.h> | ||
38 | #include <net/netlabel.h> | 39 | #include <net/netlabel.h> |
39 | #include <net/cipso_ipv4.h> | 40 | #include <net/cipso_ipv4.h> |
40 | #include <asm/bug.h> | 41 | #include <asm/bug.h> |
41 | 42 | ||
42 | #include "netlabel_mgmt.h" | 43 | #include "netlabel_mgmt.h" |
43 | #include "netlabel_domainhash.h" | 44 | #include "netlabel_domainhash.h" |
45 | #include "netlabel_user.h" | ||
44 | 46 | ||
45 | struct netlbl_domhsh_tbl { | 47 | struct netlbl_domhsh_tbl { |
46 | struct list_head *tbl; | 48 | struct list_head *tbl; |
@@ -186,6 +188,7 @@ int netlbl_domhsh_init(u32 size) | |||
186 | /** | 188 | /** |
187 | * netlbl_domhsh_add - Adds a entry to the domain hash table | 189 | * netlbl_domhsh_add - Adds a entry to the domain hash table |
188 | * @entry: the entry to add | 190 | * @entry: the entry to add |
191 | * @audit_secid: the LSM secid to use in the audit message | ||
189 | * | 192 | * |
190 | * Description: | 193 | * Description: |
191 | * Adds a new entry to the domain hash table and handles any updates to the | 194 | * Adds a new entry to the domain hash table and handles any updates to the |
@@ -193,10 +196,12 @@ int netlbl_domhsh_init(u32 size) | |||
193 | * negative on failure. | 196 | * negative on failure. |
194 | * | 197 | * |
195 | */ | 198 | */ |
196 | int netlbl_domhsh_add(struct netlbl_dom_map *entry) | 199 | int netlbl_domhsh_add(struct netlbl_dom_map *entry, u32 audit_secid) |
197 | { | 200 | { |
198 | int ret_val; | 201 | int ret_val; |
199 | u32 bkt; | 202 | u32 bkt; |
203 | struct audit_buffer *audit_buf; | ||
204 | char *audit_domain; | ||
200 | 205 | ||
201 | switch (entry->type) { | 206 | switch (entry->type) { |
202 | case NETLBL_NLTYPE_UNLABELED: | 207 | case NETLBL_NLTYPE_UNLABELED: |
@@ -236,6 +241,26 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry) | |||
236 | spin_unlock(&netlbl_domhsh_def_lock); | 241 | spin_unlock(&netlbl_domhsh_def_lock); |
237 | } else | 242 | } else |
238 | ret_val = -EINVAL; | 243 | ret_val = -EINVAL; |
244 | if (ret_val == 0) { | ||
245 | if (entry->domain != NULL) | ||
246 | audit_domain = entry->domain; | ||
247 | else | ||
248 | audit_domain = "(default)"; | ||
249 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_ADD, | ||
250 | audit_secid); | ||
251 | audit_log_format(audit_buf, " domain=%s", audit_domain); | ||
252 | switch (entry->type) { | ||
253 | case NETLBL_NLTYPE_UNLABELED: | ||
254 | audit_log_format(audit_buf, " protocol=unlbl"); | ||
255 | break; | ||
256 | case NETLBL_NLTYPE_CIPSOV4: | ||
257 | audit_log_format(audit_buf, | ||
258 | " protocol=cipsov4 doi=%u", | ||
259 | entry->type_def.cipsov4->doi); | ||
260 | break; | ||
261 | } | ||
262 | audit_log_end(audit_buf); | ||
263 | } | ||
239 | rcu_read_unlock(); | 264 | rcu_read_unlock(); |
240 | 265 | ||
241 | if (ret_val != 0) { | 266 | if (ret_val != 0) { |
@@ -254,6 +279,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry) | |||
254 | /** | 279 | /** |
255 | * netlbl_domhsh_add_default - Adds the default entry to the domain hash table | 280 | * netlbl_domhsh_add_default - Adds the default entry to the domain hash table |
256 | * @entry: the entry to add | 281 | * @entry: the entry to add |
282 | * @audit_secid: the LSM secid to use in the audit message | ||
257 | * | 283 | * |
258 | * Description: | 284 | * Description: |
259 | * Adds a new default entry to the domain hash table and handles any updates | 285 | * Adds a new default entry to the domain hash table and handles any updates |
@@ -261,14 +287,15 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry) | |||
261 | * negative on failure. | 287 | * negative on failure. |
262 | * | 288 | * |
263 | */ | 289 | */ |
264 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry) | 290 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry, u32 audit_secid) |
265 | { | 291 | { |
266 | return netlbl_domhsh_add(entry); | 292 | return netlbl_domhsh_add(entry, audit_secid); |
267 | } | 293 | } |
268 | 294 | ||
269 | /** | 295 | /** |
270 | * netlbl_domhsh_remove - Removes an entry from the domain hash table | 296 | * netlbl_domhsh_remove - Removes an entry from the domain hash table |
271 | * @domain: the domain to remove | 297 | * @domain: the domain to remove |
298 | * @audit_secid: the LSM secid to use in the audit message | ||
272 | * | 299 | * |
273 | * Description: | 300 | * Description: |
274 | * Removes an entry from the domain hash table and handles any updates to the | 301 | * Removes an entry from the domain hash table and handles any updates to the |
@@ -276,10 +303,12 @@ int netlbl_domhsh_add_default(struct netlbl_dom_map *entry) | |||
276 | * negative on failure. | 303 | * negative on failure. |
277 | * | 304 | * |
278 | */ | 305 | */ |
279 | int netlbl_domhsh_remove(const char *domain) | 306 | int netlbl_domhsh_remove(const char *domain, u32 audit_secid) |
280 | { | 307 | { |
281 | int ret_val = -ENOENT; | 308 | int ret_val = -ENOENT; |
282 | struct netlbl_dom_map *entry; | 309 | struct netlbl_dom_map *entry; |
310 | struct audit_buffer *audit_buf; | ||
311 | char *audit_domain; | ||
283 | 312 | ||
284 | rcu_read_lock(); | 313 | rcu_read_lock(); |
285 | if (domain != NULL) | 314 | if (domain != NULL) |
@@ -316,8 +345,18 @@ int netlbl_domhsh_remove(const char *domain) | |||
316 | ret_val = -ENOENT; | 345 | ret_val = -ENOENT; |
317 | spin_unlock(&netlbl_domhsh_def_lock); | 346 | spin_unlock(&netlbl_domhsh_def_lock); |
318 | } | 347 | } |
319 | if (ret_val == 0) | 348 | if (ret_val == 0) { |
349 | if (entry->domain != NULL) | ||
350 | audit_domain = entry->domain; | ||
351 | else | ||
352 | audit_domain = "(default)"; | ||
353 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL, | ||
354 | audit_secid); | ||
355 | audit_log_format(audit_buf, " domain=%s", audit_domain); | ||
356 | audit_log_end(audit_buf); | ||
357 | |||
320 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); | 358 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); |
359 | } | ||
321 | 360 | ||
322 | remove_return: | 361 | remove_return: |
323 | rcu_read_unlock(); | 362 | rcu_read_unlock(); |
@@ -326,6 +365,7 @@ remove_return: | |||
326 | 365 | ||
327 | /** | 366 | /** |
328 | * netlbl_domhsh_remove_default - Removes the default entry from the table | 367 | * netlbl_domhsh_remove_default - Removes the default entry from the table |
368 | * @audit_secid: the LSM secid to use in the audit message | ||
329 | * | 369 | * |
330 | * Description: | 370 | * Description: |
331 | * Removes/resets the default entry for the domain hash table and handles any | 371 | * Removes/resets the default entry for the domain hash table and handles any |
@@ -333,9 +373,9 @@ remove_return: | |||
333 | * success, non-zero on failure. | 373 | * success, non-zero on failure. |
334 | * | 374 | * |
335 | */ | 375 | */ |
336 | int netlbl_domhsh_remove_default(void) | 376 | int netlbl_domhsh_remove_default(u32 audit_secid) |
337 | { | 377 | { |
338 | return netlbl_domhsh_remove(NULL); | 378 | return netlbl_domhsh_remove(NULL, audit_secid); |
339 | } | 379 | } |
340 | 380 | ||
341 | /** | 381 | /** |
diff --git a/net/netlabel/netlabel_domainhash.h b/net/netlabel/netlabel_domainhash.h index 02af72a7877c..d50f13cacdca 100644 --- a/net/netlabel/netlabel_domainhash.h +++ b/net/netlabel/netlabel_domainhash.h | |||
@@ -57,9 +57,9 @@ struct netlbl_dom_map { | |||
57 | int netlbl_domhsh_init(u32 size); | 57 | int netlbl_domhsh_init(u32 size); |
58 | 58 | ||
59 | /* Manipulate the domain hash table */ | 59 | /* Manipulate the domain hash table */ |
60 | int netlbl_domhsh_add(struct netlbl_dom_map *entry); | 60 | int netlbl_domhsh_add(struct netlbl_dom_map *entry, u32 audit_secid); |
61 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry); | 61 | int netlbl_domhsh_add_default(struct netlbl_dom_map *entry, u32 audit_secid); |
62 | int netlbl_domhsh_remove_default(void); | 62 | int netlbl_domhsh_remove_default(u32 audit_secid); |
63 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); | 63 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); |
64 | int netlbl_domhsh_walk(u32 *skip_bkt, | 64 | int netlbl_domhsh_walk(u32 *skip_bkt, |
65 | u32 *skip_chain, | 65 | u32 *skip_chain, |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index 8626c9f678eb..0ac314f18ad1 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -108,7 +108,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info) | |||
108 | 108 | ||
109 | switch (entry->type) { | 109 | switch (entry->type) { |
110 | case NETLBL_NLTYPE_UNLABELED: | 110 | case NETLBL_NLTYPE_UNLABELED: |
111 | ret_val = netlbl_domhsh_add(entry); | 111 | ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid); |
112 | break; | 112 | break; |
113 | case NETLBL_NLTYPE_CIPSOV4: | 113 | case NETLBL_NLTYPE_CIPSOV4: |
114 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) | 114 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) |
@@ -125,7 +125,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info) | |||
125 | rcu_read_unlock(); | 125 | rcu_read_unlock(); |
126 | goto add_failure; | 126 | goto add_failure; |
127 | } | 127 | } |
128 | ret_val = netlbl_domhsh_add(entry); | 128 | ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid); |
129 | rcu_read_unlock(); | 129 | rcu_read_unlock(); |
130 | break; | 130 | break; |
131 | default: | 131 | default: |
@@ -161,7 +161,7 @@ static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info) | |||
161 | return -EINVAL; | 161 | return -EINVAL; |
162 | 162 | ||
163 | domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]); | 163 | domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]); |
164 | return netlbl_domhsh_remove(domain); | 164 | return netlbl_domhsh_remove(domain, NETLINK_CB(skb).sid); |
165 | } | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
@@ -277,7 +277,8 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info) | |||
277 | 277 | ||
278 | switch (entry->type) { | 278 | switch (entry->type) { |
279 | case NETLBL_NLTYPE_UNLABELED: | 279 | case NETLBL_NLTYPE_UNLABELED: |
280 | ret_val = netlbl_domhsh_add_default(entry); | 280 | ret_val = netlbl_domhsh_add_default(entry, |
281 | NETLINK_CB(skb).sid); | ||
281 | break; | 282 | break; |
282 | case NETLBL_NLTYPE_CIPSOV4: | 283 | case NETLBL_NLTYPE_CIPSOV4: |
283 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) | 284 | if (!info->attrs[NLBL_MGMT_A_CV4DOI]) |
@@ -294,7 +295,8 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info) | |||
294 | rcu_read_unlock(); | 295 | rcu_read_unlock(); |
295 | goto adddef_failure; | 296 | goto adddef_failure; |
296 | } | 297 | } |
297 | ret_val = netlbl_domhsh_add_default(entry); | 298 | ret_val = netlbl_domhsh_add_default(entry, |
299 | NETLINK_CB(skb).sid); | ||
298 | rcu_read_unlock(); | 300 | rcu_read_unlock(); |
299 | break; | 301 | break; |
300 | default: | 302 | default: |
@@ -322,7 +324,7 @@ adddef_failure: | |||
322 | */ | 324 | */ |
323 | static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info) | 325 | static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info) |
324 | { | 326 | { |
325 | return netlbl_domhsh_remove_default(); | 327 | return netlbl_domhsh_remove_default(NETLINK_CB(skb).sid); |
326 | } | 328 | } |
327 | 329 | ||
328 | /** | 330 | /** |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 440f5c4e1e2d..ab36675fee8c 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -64,6 +64,27 @@ static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Helper Functions | ||
68 | */ | ||
69 | |||
70 | /** | ||
71 | * netlbl_unlabel_acceptflg_set - Set the unlabeled accept flag | ||
72 | * @value: desired value | ||
73 | * @audit_secid: the LSM secid to use in the audit message | ||
74 | * | ||
75 | * Description: | ||
76 | * Set the value of the unlabeled accept flag to @value. | ||
77 | * | ||
78 | */ | ||
79 | static void netlbl_unlabel_acceptflg_set(u8 value, u32 audit_secid) | ||
80 | { | ||
81 | atomic_set(&netlabel_unlabel_accept_flg, value); | ||
82 | netlbl_audit_nomsg((value ? | ||
83 | AUDIT_MAC_UNLBL_ACCEPT : AUDIT_MAC_UNLBL_DENY), | ||
84 | audit_secid); | ||
85 | } | ||
86 | |||
87 | /* | ||
67 | * NetLabel Command Handlers | 88 | * NetLabel Command Handlers |
68 | */ | 89 | */ |
69 | 90 | ||
@@ -79,18 +100,18 @@ static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = { | |||
79 | */ | 100 | */ |
80 | static int netlbl_unlabel_accept(struct sk_buff *skb, struct genl_info *info) | 101 | static int netlbl_unlabel_accept(struct sk_buff *skb, struct genl_info *info) |
81 | { | 102 | { |
82 | int ret_val = -EINVAL; | ||
83 | u8 value; | 103 | u8 value; |
84 | 104 | ||
85 | if (info->attrs[NLBL_UNLABEL_A_ACPTFLG]) { | 105 | if (info->attrs[NLBL_UNLABEL_A_ACPTFLG]) { |
86 | value = nla_get_u8(info->attrs[NLBL_UNLABEL_A_ACPTFLG]); | 106 | value = nla_get_u8(info->attrs[NLBL_UNLABEL_A_ACPTFLG]); |
87 | if (value == 1 || value == 0) { | 107 | if (value == 1 || value == 0) { |
88 | atomic_set(&netlabel_unlabel_accept_flg, value); | 108 | netlbl_unlabel_acceptflg_set(value, |
89 | ret_val = 0; | 109 | NETLINK_CB(skb).sid); |
110 | return 0; | ||
90 | } | 111 | } |
91 | } | 112 | } |
92 | 113 | ||
93 | return ret_val; | 114 | return -EINVAL; |
94 | } | 115 | } |
95 | 116 | ||
96 | /** | 117 | /** |
@@ -229,16 +250,19 @@ int netlbl_unlabel_defconf(void) | |||
229 | { | 250 | { |
230 | int ret_val; | 251 | int ret_val; |
231 | struct netlbl_dom_map *entry; | 252 | struct netlbl_dom_map *entry; |
253 | u32 secid; | ||
254 | |||
255 | security_task_getsecid(current, &secid); | ||
232 | 256 | ||
233 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 257 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
234 | if (entry == NULL) | 258 | if (entry == NULL) |
235 | return -ENOMEM; | 259 | return -ENOMEM; |
236 | entry->type = NETLBL_NLTYPE_UNLABELED; | 260 | entry->type = NETLBL_NLTYPE_UNLABELED; |
237 | ret_val = netlbl_domhsh_add_default(entry); | 261 | ret_val = netlbl_domhsh_add_default(entry, secid); |
238 | if (ret_val != 0) | 262 | if (ret_val != 0) |
239 | return ret_val; | 263 | return ret_val; |
240 | 264 | ||
241 | atomic_set(&netlabel_unlabel_accept_flg, 1); | 265 | netlbl_unlabel_acceptflg_set(1, secid); |
242 | 266 | ||
243 | return 0; | 267 | return 0; |
244 | } | 268 | } |
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c index eeb7d768d2bb..c2343af584cb 100644 --- a/net/netlabel/netlabel_user.c +++ b/net/netlabel/netlabel_user.c | |||
@@ -32,6 +32,9 @@ | |||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/socket.h> | 34 | #include <linux/socket.h> |
35 | #include <linux/audit.h> | ||
36 | #include <linux/tty.h> | ||
37 | #include <linux/security.h> | ||
35 | #include <net/sock.h> | 38 | #include <net/sock.h> |
36 | #include <net/netlink.h> | 39 | #include <net/netlink.h> |
37 | #include <net/genetlink.h> | 40 | #include <net/genetlink.h> |
@@ -74,3 +77,91 @@ int netlbl_netlink_init(void) | |||
74 | 77 | ||
75 | return 0; | 78 | return 0; |
76 | } | 79 | } |
80 | |||
81 | /* | ||
82 | * NetLabel Audit Functions | ||
83 | */ | ||
84 | |||
85 | /** | ||
86 | * netlbl_audit_start_common - Start an audit message | ||
87 | * @type: audit message type | ||
88 | * @secid: LSM context ID | ||
89 | * | ||
90 | * Description: | ||
91 | * Start an audit message using the type specified in @type and fill the audit | ||
92 | * message with some fields common to all NetLabel audit messages. Returns | ||
93 | * a pointer to the audit buffer on success, NULL on failure. | ||
94 | * | ||
95 | */ | ||
96 | struct audit_buffer *netlbl_audit_start_common(int type, u32 secid) | ||
97 | { | ||
98 | struct audit_context *audit_ctx = current->audit_context; | ||
99 | struct audit_buffer *audit_buf; | ||
100 | uid_t audit_loginuid; | ||
101 | const char *audit_tty; | ||
102 | char audit_comm[sizeof(current->comm)]; | ||
103 | struct vm_area_struct *vma; | ||
104 | char *secctx; | ||
105 | u32 secctx_len; | ||
106 | |||
107 | audit_buf = audit_log_start(audit_ctx, GFP_ATOMIC, type); | ||
108 | if (audit_buf == NULL) | ||
109 | return NULL; | ||
110 | |||
111 | audit_loginuid = audit_get_loginuid(audit_ctx); | ||
112 | if (current->signal && | ||
113 | current->signal->tty && | ||
114 | current->signal->tty->name) | ||
115 | audit_tty = current->signal->tty->name; | ||
116 | else | ||
117 | audit_tty = "(none)"; | ||
118 | get_task_comm(audit_comm, current); | ||
119 | |||
120 | audit_log_format(audit_buf, | ||
121 | "netlabel: auid=%u uid=%u tty=%s pid=%d", | ||
122 | audit_loginuid, | ||
123 | current->uid, | ||
124 | audit_tty, | ||
125 | current->pid); | ||
126 | audit_log_format(audit_buf, " comm="); | ||
127 | audit_log_untrustedstring(audit_buf, audit_comm); | ||
128 | if (current->mm) { | ||
129 | down_read(¤t->mm->mmap_sem); | ||
130 | vma = current->mm->mmap; | ||
131 | while (vma) { | ||
132 | if ((vma->vm_flags & VM_EXECUTABLE) && | ||
133 | vma->vm_file) { | ||
134 | audit_log_d_path(audit_buf, | ||
135 | " exe=", | ||
136 | vma->vm_file->f_dentry, | ||
137 | vma->vm_file->f_vfsmnt); | ||
138 | break; | ||
139 | } | ||
140 | vma = vma->vm_next; | ||
141 | } | ||
142 | up_read(¤t->mm->mmap_sem); | ||
143 | } | ||
144 | |||
145 | if (secid != 0 && | ||
146 | security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) | ||
147 | audit_log_format(audit_buf, " subj=%s", secctx); | ||
148 | |||
149 | return audit_buf; | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * netlbl_audit_nomsg - Send an audit message without additional text | ||
154 | * @type: audit message type | ||
155 | * @secid: LSM context ID | ||
156 | * | ||
157 | * Description: | ||
158 | * Send an audit message with only the common NetLabel audit fields. | ||
159 | * | ||
160 | */ | ||
161 | void netlbl_audit_nomsg(int type, u32 secid) | ||
162 | { | ||
163 | struct audit_buffer *audit_buf; | ||
164 | |||
165 | audit_buf = netlbl_audit_start_common(type, secid); | ||
166 | audit_log_end(audit_buf); | ||
167 | } | ||
diff --git a/net/netlabel/netlabel_user.h b/net/netlabel/netlabel_user.h index 3f9386b917df..ab840acfc964 100644 --- a/net/netlabel/netlabel_user.h +++ b/net/netlabel/netlabel_user.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
36 | #include <linux/capability.h> | 36 | #include <linux/capability.h> |
37 | #include <linux/audit.h> | ||
37 | #include <net/netlink.h> | 38 | #include <net/netlink.h> |
38 | #include <net/genetlink.h> | 39 | #include <net/genetlink.h> |
39 | #include <net/netlabel.h> | 40 | #include <net/netlabel.h> |
@@ -75,4 +76,9 @@ static inline void *netlbl_netlink_hdr_put(struct sk_buff *skb, | |||
75 | 76 | ||
76 | int netlbl_netlink_init(void); | 77 | int netlbl_netlink_init(void); |
77 | 78 | ||
79 | /* NetLabel Audit Functions */ | ||
80 | |||
81 | struct audit_buffer *netlbl_audit_start_common(int type, u32 secid); | ||
82 | void netlbl_audit_nomsg(int type, u32 secid); | ||
83 | |||
78 | #endif | 84 | #endif |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 7e14f14058e9..37a184021647 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -401,7 +401,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
401 | if ((dev = dev_get_by_index(tcm->tcm_ifindex)) == NULL) | 401 | if ((dev = dev_get_by_index(tcm->tcm_ifindex)) == NULL) |
402 | return skb->len; | 402 | return skb->len; |
403 | 403 | ||
404 | read_lock_bh(&qdisc_tree_lock); | 404 | read_lock(&qdisc_tree_lock); |
405 | if (!tcm->tcm_parent) | 405 | if (!tcm->tcm_parent) |
406 | q = dev->qdisc_sleeping; | 406 | q = dev->qdisc_sleeping; |
407 | else | 407 | else |
@@ -458,7 +458,7 @@ errout: | |||
458 | if (cl) | 458 | if (cl) |
459 | cops->put(q, cl); | 459 | cops->put(q, cl); |
460 | out: | 460 | out: |
461 | read_unlock_bh(&qdisc_tree_lock); | 461 | read_unlock(&qdisc_tree_lock); |
462 | dev_put(dev); | 462 | dev_put(dev); |
463 | return skb->len; | 463 | return skb->len; |
464 | } | 464 | } |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 86cac49a0531..09fda68c8b39 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -194,7 +194,7 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
194 | if (handle) | 194 | if (handle) |
195 | f->handle = handle; | 195 | f->handle = handle; |
196 | else { | 196 | else { |
197 | int i = 0x80000000; | 197 | unsigned int i = 0x80000000; |
198 | do { | 198 | do { |
199 | if (++head->hgenerator == 0x7FFFFFFF) | 199 | if (++head->hgenerator == 0x7FFFFFFF) |
200 | head->hgenerator = 1; | 200 | head->hgenerator = 1; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index a19eff12cf78..0b6489291140 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -195,14 +195,14 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) | |||
195 | { | 195 | { |
196 | struct Qdisc *q; | 196 | struct Qdisc *q; |
197 | 197 | ||
198 | read_lock_bh(&qdisc_tree_lock); | 198 | read_lock(&qdisc_tree_lock); |
199 | list_for_each_entry(q, &dev->qdisc_list, list) { | 199 | list_for_each_entry(q, &dev->qdisc_list, list) { |
200 | if (q->handle == handle) { | 200 | if (q->handle == handle) { |
201 | read_unlock_bh(&qdisc_tree_lock); | 201 | read_unlock(&qdisc_tree_lock); |
202 | return q; | 202 | return q; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | read_unlock_bh(&qdisc_tree_lock); | 205 | read_unlock(&qdisc_tree_lock); |
206 | return NULL; | 206 | return NULL; |
207 | } | 207 | } |
208 | 208 | ||
@@ -837,7 +837,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) | |||
837 | continue; | 837 | continue; |
838 | if (idx > s_idx) | 838 | if (idx > s_idx) |
839 | s_q_idx = 0; | 839 | s_q_idx = 0; |
840 | read_lock_bh(&qdisc_tree_lock); | 840 | read_lock(&qdisc_tree_lock); |
841 | q_idx = 0; | 841 | q_idx = 0; |
842 | list_for_each_entry(q, &dev->qdisc_list, list) { | 842 | list_for_each_entry(q, &dev->qdisc_list, list) { |
843 | if (q_idx < s_q_idx) { | 843 | if (q_idx < s_q_idx) { |
@@ -846,12 +846,12 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) | |||
846 | } | 846 | } |
847 | if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, | 847 | if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, |
848 | cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { | 848 | cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { |
849 | read_unlock_bh(&qdisc_tree_lock); | 849 | read_unlock(&qdisc_tree_lock); |
850 | goto done; | 850 | goto done; |
851 | } | 851 | } |
852 | q_idx++; | 852 | q_idx++; |
853 | } | 853 | } |
854 | read_unlock_bh(&qdisc_tree_lock); | 854 | read_unlock(&qdisc_tree_lock); |
855 | } | 855 | } |
856 | 856 | ||
857 | done: | 857 | done: |
@@ -1074,7 +1074,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | |||
1074 | s_t = cb->args[0]; | 1074 | s_t = cb->args[0]; |
1075 | t = 0; | 1075 | t = 0; |
1076 | 1076 | ||
1077 | read_lock_bh(&qdisc_tree_lock); | 1077 | read_lock(&qdisc_tree_lock); |
1078 | list_for_each_entry(q, &dev->qdisc_list, list) { | 1078 | list_for_each_entry(q, &dev->qdisc_list, list) { |
1079 | if (t < s_t || !q->ops->cl_ops || | 1079 | if (t < s_t || !q->ops->cl_ops || |
1080 | (tcm->tcm_parent && | 1080 | (tcm->tcm_parent && |
@@ -1096,7 +1096,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | |||
1096 | break; | 1096 | break; |
1097 | t++; | 1097 | t++; |
1098 | } | 1098 | } |
1099 | read_unlock_bh(&qdisc_tree_lock); | 1099 | read_unlock(&qdisc_tree_lock); |
1100 | 1100 | ||
1101 | cb->args[0] = t; | 1101 | cb->args[0] = t; |
1102 | 1102 | ||
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 6f9151899795..88c6a99ce53c 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -45,11 +45,10 @@ | |||
45 | The idea is the following: | 45 | The idea is the following: |
46 | - enqueue, dequeue are serialized via top level device | 46 | - enqueue, dequeue are serialized via top level device |
47 | spinlock dev->queue_lock. | 47 | spinlock dev->queue_lock. |
48 | - tree walking is protected by read_lock_bh(qdisc_tree_lock) | 48 | - tree walking is protected by read_lock(qdisc_tree_lock) |
49 | and this lock is used only in process context. | 49 | and this lock is used only in process context. |
50 | - updates to tree are made under rtnl semaphore or | 50 | - updates to tree are made only under rtnl semaphore, |
51 | from softirq context (__qdisc_destroy rcu-callback) | 51 | hence this lock may be made without local bh disabling. |
52 | hence this lock needs local bh disabling. | ||
53 | 52 | ||
54 | qdisc_tree_lock must be grabbed BEFORE dev->queue_lock! | 53 | qdisc_tree_lock must be grabbed BEFORE dev->queue_lock! |
55 | */ | 54 | */ |
@@ -57,14 +56,14 @@ DEFINE_RWLOCK(qdisc_tree_lock); | |||
57 | 56 | ||
58 | void qdisc_lock_tree(struct net_device *dev) | 57 | void qdisc_lock_tree(struct net_device *dev) |
59 | { | 58 | { |
60 | write_lock_bh(&qdisc_tree_lock); | 59 | write_lock(&qdisc_tree_lock); |
61 | spin_lock_bh(&dev->queue_lock); | 60 | spin_lock_bh(&dev->queue_lock); |
62 | } | 61 | } |
63 | 62 | ||
64 | void qdisc_unlock_tree(struct net_device *dev) | 63 | void qdisc_unlock_tree(struct net_device *dev) |
65 | { | 64 | { |
66 | spin_unlock_bh(&dev->queue_lock); | 65 | spin_unlock_bh(&dev->queue_lock); |
67 | write_unlock_bh(&qdisc_tree_lock); | 66 | write_unlock(&qdisc_tree_lock); |
68 | } | 67 | } |
69 | 68 | ||
70 | /* | 69 | /* |
@@ -483,20 +482,6 @@ void qdisc_reset(struct Qdisc *qdisc) | |||
483 | static void __qdisc_destroy(struct rcu_head *head) | 482 | static void __qdisc_destroy(struct rcu_head *head) |
484 | { | 483 | { |
485 | struct Qdisc *qdisc = container_of(head, struct Qdisc, q_rcu); | 484 | struct Qdisc *qdisc = container_of(head, struct Qdisc, q_rcu); |
486 | struct Qdisc_ops *ops = qdisc->ops; | ||
487 | |||
488 | #ifdef CONFIG_NET_ESTIMATOR | ||
489 | gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est); | ||
490 | #endif | ||
491 | write_lock(&qdisc_tree_lock); | ||
492 | if (ops->reset) | ||
493 | ops->reset(qdisc); | ||
494 | if (ops->destroy) | ||
495 | ops->destroy(qdisc); | ||
496 | write_unlock(&qdisc_tree_lock); | ||
497 | module_put(ops->owner); | ||
498 | |||
499 | dev_put(qdisc->dev); | ||
500 | kfree((char *) qdisc - qdisc->padded); | 485 | kfree((char *) qdisc - qdisc->padded); |
501 | } | 486 | } |
502 | 487 | ||
@@ -504,32 +489,23 @@ static void __qdisc_destroy(struct rcu_head *head) | |||
504 | 489 | ||
505 | void qdisc_destroy(struct Qdisc *qdisc) | 490 | void qdisc_destroy(struct Qdisc *qdisc) |
506 | { | 491 | { |
507 | struct list_head cql = LIST_HEAD_INIT(cql); | 492 | struct Qdisc_ops *ops = qdisc->ops; |
508 | struct Qdisc *cq, *q, *n; | ||
509 | 493 | ||
510 | if (qdisc->flags & TCQ_F_BUILTIN || | 494 | if (qdisc->flags & TCQ_F_BUILTIN || |
511 | !atomic_dec_and_test(&qdisc->refcnt)) | 495 | !atomic_dec_and_test(&qdisc->refcnt)) |
512 | return; | 496 | return; |
513 | 497 | ||
514 | if (!list_empty(&qdisc->list)) { | 498 | list_del(&qdisc->list); |
515 | if (qdisc->ops->cl_ops == NULL) | 499 | #ifdef CONFIG_NET_ESTIMATOR |
516 | list_del(&qdisc->list); | 500 | gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est); |
517 | else | 501 | #endif |
518 | list_move(&qdisc->list, &cql); | 502 | if (ops->reset) |
519 | } | 503 | ops->reset(qdisc); |
520 | 504 | if (ops->destroy) | |
521 | /* unlink inner qdiscs from dev->qdisc_list immediately */ | 505 | ops->destroy(qdisc); |
522 | list_for_each_entry(cq, &cql, list) | ||
523 | list_for_each_entry_safe(q, n, &qdisc->dev->qdisc_list, list) | ||
524 | if (TC_H_MAJ(q->parent) == TC_H_MAJ(cq->handle)) { | ||
525 | if (q->ops->cl_ops == NULL) | ||
526 | list_del_init(&q->list); | ||
527 | else | ||
528 | list_move_tail(&q->list, &cql); | ||
529 | } | ||
530 | list_for_each_entry_safe(cq, n, &cql, list) | ||
531 | list_del_init(&cq->list); | ||
532 | 506 | ||
507 | module_put(ops->owner); | ||
508 | dev_put(qdisc->dev); | ||
533 | call_rcu(&qdisc->q_rcu, __qdisc_destroy); | 509 | call_rcu(&qdisc->q_rcu, __qdisc_destroy); |
534 | } | 510 | } |
535 | 511 | ||
@@ -549,15 +525,15 @@ void dev_activate(struct net_device *dev) | |||
549 | printk(KERN_INFO "%s: activation failed\n", dev->name); | 525 | printk(KERN_INFO "%s: activation failed\n", dev->name); |
550 | return; | 526 | return; |
551 | } | 527 | } |
552 | write_lock_bh(&qdisc_tree_lock); | 528 | write_lock(&qdisc_tree_lock); |
553 | list_add_tail(&qdisc->list, &dev->qdisc_list); | 529 | list_add_tail(&qdisc->list, &dev->qdisc_list); |
554 | write_unlock_bh(&qdisc_tree_lock); | 530 | write_unlock(&qdisc_tree_lock); |
555 | } else { | 531 | } else { |
556 | qdisc = &noqueue_qdisc; | 532 | qdisc = &noqueue_qdisc; |
557 | } | 533 | } |
558 | write_lock_bh(&qdisc_tree_lock); | 534 | write_lock(&qdisc_tree_lock); |
559 | dev->qdisc_sleeping = qdisc; | 535 | dev->qdisc_sleeping = qdisc; |
560 | write_unlock_bh(&qdisc_tree_lock); | 536 | write_unlock(&qdisc_tree_lock); |
561 | } | 537 | } |
562 | 538 | ||
563 | if (!netif_carrier_ok(dev)) | 539 | if (!netif_carrier_ok(dev)) |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index bb3ddd4784b1..6c058e3660c0 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(struct htb_sched *q, | |||
391 | /* If this triggers, it is a bug in this code, but it need not be fatal */ | 391 | /* If this triggers, it is a bug in this code, but it need not be fatal */ |
392 | static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root) | 392 | static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root) |
393 | { | 393 | { |
394 | if (RB_EMPTY_NODE(rb)) { | 394 | if (!RB_EMPTY_NODE(rb)) { |
395 | WARN_ON(1); | 395 | WARN_ON(1); |
396 | } else { | 396 | } else { |
397 | rb_erase(rb, root); | 397 | rb_erase(rb, root); |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 55163af3dcaf..993ff1a5d945 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -331,8 +331,8 @@ rpcauth_unbindcred(struct rpc_task *task) | |||
331 | task->tk_msg.rpc_cred = NULL; | 331 | task->tk_msg.rpc_cred = NULL; |
332 | } | 332 | } |
333 | 333 | ||
334 | u32 * | 334 | __be32 * |
335 | rpcauth_marshcred(struct rpc_task *task, u32 *p) | 335 | rpcauth_marshcred(struct rpc_task *task, __be32 *p) |
336 | { | 336 | { |
337 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 337 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
338 | 338 | ||
@@ -342,8 +342,8 @@ rpcauth_marshcred(struct rpc_task *task, u32 *p) | |||
342 | return cred->cr_ops->crmarshal(task, p); | 342 | return cred->cr_ops->crmarshal(task, p); |
343 | } | 343 | } |
344 | 344 | ||
345 | u32 * | 345 | __be32 * |
346 | rpcauth_checkverf(struct rpc_task *task, u32 *p) | 346 | rpcauth_checkverf(struct rpc_task *task, __be32 *p) |
347 | { | 347 | { |
348 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 348 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
349 | 349 | ||
@@ -355,7 +355,7 @@ rpcauth_checkverf(struct rpc_task *task, u32 *p) | |||
355 | 355 | ||
356 | int | 356 | int |
357 | rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, | 357 | rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, |
358 | u32 *data, void *obj) | 358 | __be32 *data, void *obj) |
359 | { | 359 | { |
360 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 360 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
361 | 361 | ||
@@ -369,7 +369,7 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, | |||
369 | 369 | ||
370 | int | 370 | int |
371 | rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, | 371 | rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, |
372 | u32 *data, void *obj) | 372 | __be32 *data, void *obj) |
373 | { | 373 | { |
374 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 374 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
375 | 375 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 6eed3e166ba3..a6ed2d22a6e6 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -826,14 +826,14 @@ out: | |||
826 | * Marshal credentials. | 826 | * Marshal credentials. |
827 | * Maybe we should keep a cached credential for performance reasons. | 827 | * Maybe we should keep a cached credential for performance reasons. |
828 | */ | 828 | */ |
829 | static u32 * | 829 | static __be32 * |
830 | gss_marshal(struct rpc_task *task, u32 *p) | 830 | gss_marshal(struct rpc_task *task, __be32 *p) |
831 | { | 831 | { |
832 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 832 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
833 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 833 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
834 | gc_base); | 834 | gc_base); |
835 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 835 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
836 | u32 *cred_len; | 836 | __be32 *cred_len; |
837 | struct rpc_rqst *req = task->tk_rqstp; | 837 | struct rpc_rqst *req = task->tk_rqstp; |
838 | u32 maj_stat = 0; | 838 | u32 maj_stat = 0; |
839 | struct xdr_netobj mic; | 839 | struct xdr_netobj mic; |
@@ -894,12 +894,12 @@ gss_refresh(struct rpc_task *task) | |||
894 | return 0; | 894 | return 0; |
895 | } | 895 | } |
896 | 896 | ||
897 | static u32 * | 897 | static __be32 * |
898 | gss_validate(struct rpc_task *task, u32 *p) | 898 | gss_validate(struct rpc_task *task, __be32 *p) |
899 | { | 899 | { |
900 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 900 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
901 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 901 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
902 | u32 seq; | 902 | __be32 seq; |
903 | struct kvec iov; | 903 | struct kvec iov; |
904 | struct xdr_buf verf_buf; | 904 | struct xdr_buf verf_buf; |
905 | struct xdr_netobj mic; | 905 | struct xdr_netobj mic; |
@@ -940,13 +940,14 @@ out_bad: | |||
940 | 940 | ||
941 | static inline int | 941 | static inline int |
942 | gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 942 | gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
943 | kxdrproc_t encode, struct rpc_rqst *rqstp, u32 *p, void *obj) | 943 | kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj) |
944 | { | 944 | { |
945 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; | 945 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; |
946 | struct xdr_buf integ_buf; | 946 | struct xdr_buf integ_buf; |
947 | u32 *integ_len = NULL; | 947 | __be32 *integ_len = NULL; |
948 | struct xdr_netobj mic; | 948 | struct xdr_netobj mic; |
949 | u32 offset, *q; | 949 | u32 offset; |
950 | __be32 *q; | ||
950 | struct kvec *iov; | 951 | struct kvec *iov; |
951 | u32 maj_stat = 0; | 952 | u32 maj_stat = 0; |
952 | int status = -EIO; | 953 | int status = -EIO; |
@@ -1032,13 +1033,13 @@ out: | |||
1032 | 1033 | ||
1033 | static inline int | 1034 | static inline int |
1034 | gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1035 | gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
1035 | kxdrproc_t encode, struct rpc_rqst *rqstp, u32 *p, void *obj) | 1036 | kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj) |
1036 | { | 1037 | { |
1037 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; | 1038 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; |
1038 | u32 offset; | 1039 | u32 offset; |
1039 | u32 maj_stat; | 1040 | u32 maj_stat; |
1040 | int status; | 1041 | int status; |
1041 | u32 *opaque_len; | 1042 | __be32 *opaque_len; |
1042 | struct page **inpages; | 1043 | struct page **inpages; |
1043 | int first; | 1044 | int first; |
1044 | int pad; | 1045 | int pad; |
@@ -1095,7 +1096,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1095 | 1096 | ||
1096 | static int | 1097 | static int |
1097 | gss_wrap_req(struct rpc_task *task, | 1098 | gss_wrap_req(struct rpc_task *task, |
1098 | kxdrproc_t encode, void *rqstp, u32 *p, void *obj) | 1099 | kxdrproc_t encode, void *rqstp, __be32 *p, void *obj) |
1099 | { | 1100 | { |
1100 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 1101 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
1101 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 1102 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
@@ -1132,7 +1133,7 @@ out: | |||
1132 | 1133 | ||
1133 | static inline int | 1134 | static inline int |
1134 | gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1135 | gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
1135 | struct rpc_rqst *rqstp, u32 **p) | 1136 | struct rpc_rqst *rqstp, __be32 **p) |
1136 | { | 1137 | { |
1137 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; | 1138 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; |
1138 | struct xdr_buf integ_buf; | 1139 | struct xdr_buf integ_buf; |
@@ -1169,7 +1170,7 @@ gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1169 | 1170 | ||
1170 | static inline int | 1171 | static inline int |
1171 | gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1172 | gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
1172 | struct rpc_rqst *rqstp, u32 **p) | 1173 | struct rpc_rqst *rqstp, __be32 **p) |
1173 | { | 1174 | { |
1174 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; | 1175 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; |
1175 | u32 offset; | 1176 | u32 offset; |
@@ -1198,13 +1199,13 @@ gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1198 | 1199 | ||
1199 | static int | 1200 | static int |
1200 | gss_unwrap_resp(struct rpc_task *task, | 1201 | gss_unwrap_resp(struct rpc_task *task, |
1201 | kxdrproc_t decode, void *rqstp, u32 *p, void *obj) | 1202 | kxdrproc_t decode, void *rqstp, __be32 *p, void *obj) |
1202 | { | 1203 | { |
1203 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 1204 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
1204 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 1205 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
1205 | gc_base); | 1206 | gc_base); |
1206 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 1207 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
1207 | u32 *savedp = p; | 1208 | __be32 *savedp = p; |
1208 | struct kvec *head = ((struct rpc_rqst *)rqstp)->rq_rcv_buf.head; | 1209 | struct kvec *head = ((struct rpc_rqst *)rqstp)->rq_rcv_buf.head; |
1209 | int savedlen = head->iov_len; | 1210 | int savedlen = head->iov_len; |
1210 | int status = -EIO; | 1211 | int status = -EIO; |
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c index 2f312164d6d5..08601ee4cd73 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seal.c +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c | |||
@@ -115,7 +115,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text, | |||
115 | krb5_hdr = ptr - 2; | 115 | krb5_hdr = ptr - 2; |
116 | msg_start = krb5_hdr + 24; | 116 | msg_start = krb5_hdr + 24; |
117 | 117 | ||
118 | *(u16 *)(krb5_hdr + 2) = htons(ctx->signalg); | 118 | *(__be16 *)(krb5_hdr + 2) = htons(ctx->signalg); |
119 | memset(krb5_hdr + 4, 0xff, 4); | 119 | memset(krb5_hdr + 4, 0xff, 4); |
120 | 120 | ||
121 | if (make_checksum(checksum_type, krb5_hdr, 8, text, 0, &md5cksum)) | 121 | if (make_checksum(checksum_type, krb5_hdr, 8, text, 0, &md5cksum)) |
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c index f179415d0c38..cc45c1605f80 100644 --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c | |||
@@ -177,9 +177,9 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset, | |||
177 | msg_start = krb5_hdr + 24; | 177 | msg_start = krb5_hdr + 24; |
178 | /* XXXJBF: */ BUG_ON(buf->head[0].iov_base + offset + headlen != msg_start + blocksize); | 178 | /* XXXJBF: */ BUG_ON(buf->head[0].iov_base + offset + headlen != msg_start + blocksize); |
179 | 179 | ||
180 | *(u16 *)(krb5_hdr + 2) = htons(kctx->signalg); | 180 | *(__be16 *)(krb5_hdr + 2) = htons(kctx->signalg); |
181 | memset(krb5_hdr + 4, 0xff, 4); | 181 | memset(krb5_hdr + 4, 0xff, 4); |
182 | *(u16 *)(krb5_hdr + 4) = htons(kctx->sealalg); | 182 | *(__be16 *)(krb5_hdr + 4) = htons(kctx->sealalg); |
183 | 183 | ||
184 | make_confounder(msg_start, blocksize); | 184 | make_confounder(msg_start, blocksize); |
185 | 185 | ||
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 94217ec9e2dd..638c0b576203 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -607,7 +607,7 @@ svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o) | |||
607 | 607 | ||
608 | if (argv->iov_len < 4) | 608 | if (argv->iov_len < 4) |
609 | return -1; | 609 | return -1; |
610 | o->len = ntohl(svc_getu32(argv)); | 610 | o->len = svc_getnl(argv); |
611 | l = round_up_to_quad(o->len); | 611 | l = round_up_to_quad(o->len); |
612 | if (argv->iov_len < l) | 612 | if (argv->iov_len < l) |
613 | return -1; | 613 | return -1; |
@@ -620,17 +620,17 @@ svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o) | |||
620 | static inline int | 620 | static inline int |
621 | svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) | 621 | svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) |
622 | { | 622 | { |
623 | u32 *p; | 623 | u8 *p; |
624 | 624 | ||
625 | if (resv->iov_len + 4 > PAGE_SIZE) | 625 | if (resv->iov_len + 4 > PAGE_SIZE) |
626 | return -1; | 626 | return -1; |
627 | svc_putu32(resv, htonl(o->len)); | 627 | svc_putnl(resv, o->len); |
628 | p = resv->iov_base + resv->iov_len; | 628 | p = resv->iov_base + resv->iov_len; |
629 | resv->iov_len += round_up_to_quad(o->len); | 629 | resv->iov_len += round_up_to_quad(o->len); |
630 | if (resv->iov_len > PAGE_SIZE) | 630 | if (resv->iov_len > PAGE_SIZE) |
631 | return -1; | 631 | return -1; |
632 | memcpy(p, o->data, o->len); | 632 | memcpy(p, o->data, o->len); |
633 | memset((u8 *)p + o->len, 0, round_up_to_quad(o->len) - o->len); | 633 | memset(p + o->len, 0, round_up_to_quad(o->len) - o->len); |
634 | return 0; | 634 | return 0; |
635 | } | 635 | } |
636 | 636 | ||
@@ -640,7 +640,7 @@ svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) | |||
640 | */ | 640 | */ |
641 | static int | 641 | static int |
642 | gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, | 642 | gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, |
643 | u32 *rpcstart, struct rpc_gss_wire_cred *gc, u32 *authp) | 643 | __be32 *rpcstart, struct rpc_gss_wire_cred *gc, __be32 *authp) |
644 | { | 644 | { |
645 | struct gss_ctx *ctx_id = rsci->mechctx; | 645 | struct gss_ctx *ctx_id = rsci->mechctx; |
646 | struct xdr_buf rpchdr; | 646 | struct xdr_buf rpchdr; |
@@ -657,7 +657,7 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, | |||
657 | *authp = rpc_autherr_badverf; | 657 | *authp = rpc_autherr_badverf; |
658 | if (argv->iov_len < 4) | 658 | if (argv->iov_len < 4) |
659 | return SVC_DENIED; | 659 | return SVC_DENIED; |
660 | flavor = ntohl(svc_getu32(argv)); | 660 | flavor = svc_getnl(argv); |
661 | if (flavor != RPC_AUTH_GSS) | 661 | if (flavor != RPC_AUTH_GSS) |
662 | return SVC_DENIED; | 662 | return SVC_DENIED; |
663 | if (svc_safe_getnetobj(argv, &checksum)) | 663 | if (svc_safe_getnetobj(argv, &checksum)) |
@@ -687,9 +687,9 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, | |||
687 | static int | 687 | static int |
688 | gss_write_null_verf(struct svc_rqst *rqstp) | 688 | gss_write_null_verf(struct svc_rqst *rqstp) |
689 | { | 689 | { |
690 | u32 *p; | 690 | __be32 *p; |
691 | 691 | ||
692 | svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_NULL)); | 692 | svc_putnl(rqstp->rq_res.head, RPC_AUTH_NULL); |
693 | p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len; | 693 | p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len; |
694 | /* don't really need to check if head->iov_len > PAGE_SIZE ... */ | 694 | /* don't really need to check if head->iov_len > PAGE_SIZE ... */ |
695 | *p++ = 0; | 695 | *p++ = 0; |
@@ -701,14 +701,14 @@ gss_write_null_verf(struct svc_rqst *rqstp) | |||
701 | static int | 701 | static int |
702 | gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq) | 702 | gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq) |
703 | { | 703 | { |
704 | u32 xdr_seq; | 704 | __be32 xdr_seq; |
705 | u32 maj_stat; | 705 | u32 maj_stat; |
706 | struct xdr_buf verf_data; | 706 | struct xdr_buf verf_data; |
707 | struct xdr_netobj mic; | 707 | struct xdr_netobj mic; |
708 | u32 *p; | 708 | __be32 *p; |
709 | struct kvec iov; | 709 | struct kvec iov; |
710 | 710 | ||
711 | svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_GSS)); | 711 | svc_putnl(rqstp->rq_res.head, RPC_AUTH_GSS); |
712 | xdr_seq = htonl(seq); | 712 | xdr_seq = htonl(seq); |
713 | 713 | ||
714 | iov.iov_base = &xdr_seq; | 714 | iov.iov_base = &xdr_seq; |
@@ -782,7 +782,7 @@ EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor); | |||
782 | static inline int | 782 | static inline int |
783 | read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj) | 783 | read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj) |
784 | { | 784 | { |
785 | u32 raw; | 785 | __be32 raw; |
786 | int status; | 786 | int status; |
787 | 787 | ||
788 | status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); | 788 | status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); |
@@ -805,7 +805,7 @@ unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx) | |||
805 | struct xdr_netobj mic; | 805 | struct xdr_netobj mic; |
806 | struct xdr_buf integ_buf; | 806 | struct xdr_buf integ_buf; |
807 | 807 | ||
808 | integ_len = ntohl(svc_getu32(&buf->head[0])); | 808 | integ_len = svc_getnl(&buf->head[0]); |
809 | if (integ_len & 3) | 809 | if (integ_len & 3) |
810 | goto out; | 810 | goto out; |
811 | if (integ_len > buf->len) | 811 | if (integ_len > buf->len) |
@@ -825,7 +825,7 @@ unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx) | |||
825 | maj_stat = gss_verify_mic(ctx, &integ_buf, &mic); | 825 | maj_stat = gss_verify_mic(ctx, &integ_buf, &mic); |
826 | if (maj_stat != GSS_S_COMPLETE) | 826 | if (maj_stat != GSS_S_COMPLETE) |
827 | goto out; | 827 | goto out; |
828 | if (ntohl(svc_getu32(&buf->head[0])) != seq) | 828 | if (svc_getnl(&buf->head[0]) != seq) |
829 | goto out; | 829 | goto out; |
830 | stat = 0; | 830 | stat = 0; |
831 | out: | 831 | out: |
@@ -857,7 +857,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs | |||
857 | 857 | ||
858 | rqstp->rq_sendfile_ok = 0; | 858 | rqstp->rq_sendfile_ok = 0; |
859 | 859 | ||
860 | priv_len = ntohl(svc_getu32(&buf->head[0])); | 860 | priv_len = svc_getnl(&buf->head[0]); |
861 | if (rqstp->rq_deferred) { | 861 | if (rqstp->rq_deferred) { |
862 | /* Already decrypted last time through! The sequence number | 862 | /* Already decrypted last time through! The sequence number |
863 | * check at out_seq is unnecessary but harmless: */ | 863 | * check at out_seq is unnecessary but harmless: */ |
@@ -895,7 +895,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs | |||
895 | if (maj_stat != GSS_S_COMPLETE) | 895 | if (maj_stat != GSS_S_COMPLETE) |
896 | return -EINVAL; | 896 | return -EINVAL; |
897 | out_seq: | 897 | out_seq: |
898 | if (ntohl(svc_getu32(&buf->head[0])) != seq) | 898 | if (svc_getnl(&buf->head[0]) != seq) |
899 | return -EINVAL; | 899 | return -EINVAL; |
900 | return 0; | 900 | return 0; |
901 | } | 901 | } |
@@ -905,7 +905,7 @@ struct gss_svc_data { | |||
905 | struct rpc_gss_wire_cred clcred; | 905 | struct rpc_gss_wire_cred clcred; |
906 | /* pointer to the beginning of the procedure-specific results, | 906 | /* pointer to the beginning of the procedure-specific results, |
907 | * which may be encrypted/checksummed in svcauth_gss_release: */ | 907 | * which may be encrypted/checksummed in svcauth_gss_release: */ |
908 | u32 *body_start; | 908 | __be32 *body_start; |
909 | struct rsc *rsci; | 909 | struct rsc *rsci; |
910 | }; | 910 | }; |
911 | 911 | ||
@@ -946,7 +946,7 @@ gss_write_init_verf(struct svc_rqst *rqstp, struct rsi *rsip) | |||
946 | * response here and return SVC_COMPLETE. | 946 | * response here and return SVC_COMPLETE. |
947 | */ | 947 | */ |
948 | static int | 948 | static int |
949 | svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | 949 | svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp) |
950 | { | 950 | { |
951 | struct kvec *argv = &rqstp->rq_arg.head[0]; | 951 | struct kvec *argv = &rqstp->rq_arg.head[0]; |
952 | struct kvec *resv = &rqstp->rq_res.head[0]; | 952 | struct kvec *resv = &rqstp->rq_res.head[0]; |
@@ -956,8 +956,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
956 | struct rpc_gss_wire_cred *gc; | 956 | struct rpc_gss_wire_cred *gc; |
957 | struct rsc *rsci = NULL; | 957 | struct rsc *rsci = NULL; |
958 | struct rsi *rsip, rsikey; | 958 | struct rsi *rsip, rsikey; |
959 | u32 *rpcstart; | 959 | __be32 *rpcstart; |
960 | u32 *reject_stat = resv->iov_base + resv->iov_len; | 960 | __be32 *reject_stat = resv->iov_base + resv->iov_len; |
961 | int ret; | 961 | int ret; |
962 | 962 | ||
963 | dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len); | 963 | dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len); |
@@ -985,12 +985,12 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
985 | 985 | ||
986 | if (argv->iov_len < 5 * 4) | 986 | if (argv->iov_len < 5 * 4) |
987 | goto auth_err; | 987 | goto auth_err; |
988 | crlen = ntohl(svc_getu32(argv)); | 988 | crlen = svc_getnl(argv); |
989 | if (ntohl(svc_getu32(argv)) != RPC_GSS_VERSION) | 989 | if (svc_getnl(argv) != RPC_GSS_VERSION) |
990 | goto auth_err; | 990 | goto auth_err; |
991 | gc->gc_proc = ntohl(svc_getu32(argv)); | 991 | gc->gc_proc = svc_getnl(argv); |
992 | gc->gc_seq = ntohl(svc_getu32(argv)); | 992 | gc->gc_seq = svc_getnl(argv); |
993 | gc->gc_svc = ntohl(svc_getu32(argv)); | 993 | gc->gc_svc = svc_getnl(argv); |
994 | if (svc_safe_getnetobj(argv, &gc->gc_ctx)) | 994 | if (svc_safe_getnetobj(argv, &gc->gc_ctx)) |
995 | goto auth_err; | 995 | goto auth_err; |
996 | if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4) | 996 | if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4) |
@@ -1016,9 +1016,9 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1016 | case RPC_GSS_PROC_CONTINUE_INIT: | 1016 | case RPC_GSS_PROC_CONTINUE_INIT: |
1017 | if (argv->iov_len < 2 * 4) | 1017 | if (argv->iov_len < 2 * 4) |
1018 | goto auth_err; | 1018 | goto auth_err; |
1019 | if (ntohl(svc_getu32(argv)) != RPC_AUTH_NULL) | 1019 | if (svc_getnl(argv) != RPC_AUTH_NULL) |
1020 | goto auth_err; | 1020 | goto auth_err; |
1021 | if (ntohl(svc_getu32(argv)) != 0) | 1021 | if (svc_getnl(argv) != 0) |
1022 | goto auth_err; | 1022 | goto auth_err; |
1023 | break; | 1023 | break; |
1024 | case RPC_GSS_PROC_DATA: | 1024 | case RPC_GSS_PROC_DATA: |
@@ -1076,14 +1076,14 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1076 | goto drop; | 1076 | goto drop; |
1077 | if (resv->iov_len + 4 > PAGE_SIZE) | 1077 | if (resv->iov_len + 4 > PAGE_SIZE) |
1078 | goto drop; | 1078 | goto drop; |
1079 | svc_putu32(resv, rpc_success); | 1079 | svc_putnl(resv, RPC_SUCCESS); |
1080 | if (svc_safe_putnetobj(resv, &rsip->out_handle)) | 1080 | if (svc_safe_putnetobj(resv, &rsip->out_handle)) |
1081 | goto drop; | 1081 | goto drop; |
1082 | if (resv->iov_len + 3 * 4 > PAGE_SIZE) | 1082 | if (resv->iov_len + 3 * 4 > PAGE_SIZE) |
1083 | goto drop; | 1083 | goto drop; |
1084 | svc_putu32(resv, htonl(rsip->major_status)); | 1084 | svc_putnl(resv, rsip->major_status); |
1085 | svc_putu32(resv, htonl(rsip->minor_status)); | 1085 | svc_putnl(resv, rsip->minor_status); |
1086 | svc_putu32(resv, htonl(GSS_SEQ_WIN)); | 1086 | svc_putnl(resv, GSS_SEQ_WIN); |
1087 | if (svc_safe_putnetobj(resv, &rsip->out_token)) | 1087 | if (svc_safe_putnetobj(resv, &rsip->out_token)) |
1088 | goto drop; | 1088 | goto drop; |
1089 | rqstp->rq_client = NULL; | 1089 | rqstp->rq_client = NULL; |
@@ -1093,7 +1093,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1093 | set_bit(CACHE_NEGATIVE, &rsci->h.flags); | 1093 | set_bit(CACHE_NEGATIVE, &rsci->h.flags); |
1094 | if (resv->iov_len + 4 > PAGE_SIZE) | 1094 | if (resv->iov_len + 4 > PAGE_SIZE) |
1095 | goto drop; | 1095 | goto drop; |
1096 | svc_putu32(resv, rpc_success); | 1096 | svc_putnl(resv, RPC_SUCCESS); |
1097 | goto complete; | 1097 | goto complete; |
1098 | case RPC_GSS_PROC_DATA: | 1098 | case RPC_GSS_PROC_DATA: |
1099 | *authp = rpcsec_gsserr_ctxproblem; | 1099 | *authp = rpcsec_gsserr_ctxproblem; |
@@ -1111,8 +1111,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1111 | goto auth_err; | 1111 | goto auth_err; |
1112 | /* placeholders for length and seq. number: */ | 1112 | /* placeholders for length and seq. number: */ |
1113 | svcdata->body_start = resv->iov_base + resv->iov_len; | 1113 | svcdata->body_start = resv->iov_base + resv->iov_len; |
1114 | svc_putu32(resv, 0); | 1114 | svc_putnl(resv, 0); |
1115 | svc_putu32(resv, 0); | 1115 | svc_putnl(resv, 0); |
1116 | break; | 1116 | break; |
1117 | case RPC_GSS_SVC_PRIVACY: | 1117 | case RPC_GSS_SVC_PRIVACY: |
1118 | if (unwrap_priv_data(rqstp, &rqstp->rq_arg, | 1118 | if (unwrap_priv_data(rqstp, &rqstp->rq_arg, |
@@ -1120,8 +1120,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1120 | goto auth_err; | 1120 | goto auth_err; |
1121 | /* placeholders for length and seq. number: */ | 1121 | /* placeholders for length and seq. number: */ |
1122 | svcdata->body_start = resv->iov_base + resv->iov_len; | 1122 | svcdata->body_start = resv->iov_base + resv->iov_len; |
1123 | svc_putu32(resv, 0); | 1123 | svc_putnl(resv, 0); |
1124 | svc_putu32(resv, 0); | 1124 | svc_putnl(resv, 0); |
1125 | break; | 1125 | break; |
1126 | default: | 1126 | default: |
1127 | goto auth_err; | 1127 | goto auth_err; |
@@ -1156,7 +1156,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) | |||
1156 | struct xdr_buf integ_buf; | 1156 | struct xdr_buf integ_buf; |
1157 | struct xdr_netobj mic; | 1157 | struct xdr_netobj mic; |
1158 | struct kvec *resv; | 1158 | struct kvec *resv; |
1159 | u32 *p; | 1159 | __be32 *p; |
1160 | int integ_offset, integ_len; | 1160 | int integ_offset, integ_len; |
1161 | int stat = -EINVAL; | 1161 | int stat = -EINVAL; |
1162 | 1162 | ||
@@ -1199,7 +1199,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) | |||
1199 | mic.data = (u8 *)resv->iov_base + resv->iov_len + 4; | 1199 | mic.data = (u8 *)resv->iov_base + resv->iov_len + 4; |
1200 | if (gss_get_mic(gsd->rsci->mechctx, &integ_buf, &mic)) | 1200 | if (gss_get_mic(gsd->rsci->mechctx, &integ_buf, &mic)) |
1201 | goto out_err; | 1201 | goto out_err; |
1202 | svc_putu32(resv, htonl(mic.len)); | 1202 | svc_putnl(resv, mic.len); |
1203 | memset(mic.data + mic.len, 0, | 1203 | memset(mic.data + mic.len, 0, |
1204 | round_up_to_quad(mic.len) - mic.len); | 1204 | round_up_to_quad(mic.len) - mic.len); |
1205 | resv->iov_len += XDR_QUADLEN(mic.len) << 2; | 1205 | resv->iov_len += XDR_QUADLEN(mic.len) << 2; |
@@ -1219,8 +1219,8 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) | |||
1219 | struct rpc_gss_wire_cred *gc = &gsd->clcred; | 1219 | struct rpc_gss_wire_cred *gc = &gsd->clcred; |
1220 | struct xdr_buf *resbuf = &rqstp->rq_res; | 1220 | struct xdr_buf *resbuf = &rqstp->rq_res; |
1221 | struct page **inpages = NULL; | 1221 | struct page **inpages = NULL; |
1222 | u32 *p; | 1222 | __be32 *p, *len; |
1223 | int offset, *len; | 1223 | int offset; |
1224 | int pad; | 1224 | int pad; |
1225 | 1225 | ||
1226 | p = gsd->body_start; | 1226 | p = gsd->body_start; |
@@ -1264,7 +1264,7 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) | |||
1264 | return -ENOMEM; | 1264 | return -ENOMEM; |
1265 | *len = htonl(resbuf->len - offset); | 1265 | *len = htonl(resbuf->len - offset); |
1266 | pad = 3 - ((resbuf->len - offset - 1)&3); | 1266 | pad = 3 - ((resbuf->len - offset - 1)&3); |
1267 | p = (u32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len); | 1267 | p = (__be32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len); |
1268 | memset(p, 0, pad); | 1268 | memset(p, 0, pad); |
1269 | resbuf->tail[0].iov_len += pad; | 1269 | resbuf->tail[0].iov_len += pad; |
1270 | resbuf->len += pad; | 1270 | resbuf->len += pad; |
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index 2eccffa96ba1..3be257dc32b2 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
@@ -60,8 +60,8 @@ nul_match(struct auth_cred *acred, struct rpc_cred *cred, int taskflags) | |||
60 | /* | 60 | /* |
61 | * Marshal credential. | 61 | * Marshal credential. |
62 | */ | 62 | */ |
63 | static u32 * | 63 | static __be32 * |
64 | nul_marshal(struct rpc_task *task, u32 *p) | 64 | nul_marshal(struct rpc_task *task, __be32 *p) |
65 | { | 65 | { |
66 | *p++ = htonl(RPC_AUTH_NULL); | 66 | *p++ = htonl(RPC_AUTH_NULL); |
67 | *p++ = 0; | 67 | *p++ = 0; |
@@ -81,8 +81,8 @@ nul_refresh(struct rpc_task *task) | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | static u32 * | 84 | static __be32 * |
85 | nul_validate(struct rpc_task *task, u32 *p) | 85 | nul_validate(struct rpc_task *task, __be32 *p) |
86 | { | 86 | { |
87 | rpc_authflavor_t flavor; | 87 | rpc_authflavor_t flavor; |
88 | u32 size; | 88 | u32 size; |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 74c7406a1054..f7f990c9afe2 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -137,12 +137,12 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags) | |||
137 | * Marshal credentials. | 137 | * Marshal credentials. |
138 | * Maybe we should keep a cached credential for performance reasons. | 138 | * Maybe we should keep a cached credential for performance reasons. |
139 | */ | 139 | */ |
140 | static u32 * | 140 | static __be32 * |
141 | unx_marshal(struct rpc_task *task, u32 *p) | 141 | unx_marshal(struct rpc_task *task, __be32 *p) |
142 | { | 142 | { |
143 | struct rpc_clnt *clnt = task->tk_client; | 143 | struct rpc_clnt *clnt = task->tk_client; |
144 | struct unx_cred *cred = (struct unx_cred *) task->tk_msg.rpc_cred; | 144 | struct unx_cred *cred = (struct unx_cred *) task->tk_msg.rpc_cred; |
145 | u32 *base, *hold; | 145 | __be32 *base, *hold; |
146 | int i; | 146 | int i; |
147 | 147 | ||
148 | *p++ = htonl(RPC_AUTH_UNIX); | 148 | *p++ = htonl(RPC_AUTH_UNIX); |
@@ -178,8 +178,8 @@ unx_refresh(struct rpc_task *task) | |||
178 | return 0; | 178 | return 0; |
179 | } | 179 | } |
180 | 180 | ||
181 | static u32 * | 181 | static __be32 * |
182 | unx_validate(struct rpc_task *task, u32 *p) | 182 | unx_validate(struct rpc_task *task, __be32 *p) |
183 | { | 183 | { |
184 | rpc_authflavor_t flavor; | 184 | rpc_authflavor_t flavor; |
185 | u32 size; | 185 | u32 size; |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 084a0ad5c64e..124ff0ceb55b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -60,8 +60,8 @@ static void call_refreshresult(struct rpc_task *task); | |||
60 | static void call_timeout(struct rpc_task *task); | 60 | static void call_timeout(struct rpc_task *task); |
61 | static void call_connect(struct rpc_task *task); | 61 | static void call_connect(struct rpc_task *task); |
62 | static void call_connect_status(struct rpc_task *task); | 62 | static void call_connect_status(struct rpc_task *task); |
63 | static u32 * call_header(struct rpc_task *task); | 63 | static __be32 * call_header(struct rpc_task *task); |
64 | static u32 * call_verify(struct rpc_task *task); | 64 | static __be32 * call_verify(struct rpc_task *task); |
65 | 65 | ||
66 | 66 | ||
67 | static int | 67 | static int |
@@ -782,7 +782,7 @@ call_encode(struct rpc_task *task) | |||
782 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; | 782 | struct xdr_buf *rcvbuf = &req->rq_rcv_buf; |
783 | unsigned int bufsiz; | 783 | unsigned int bufsiz; |
784 | kxdrproc_t encode; | 784 | kxdrproc_t encode; |
785 | u32 *p; | 785 | __be32 *p; |
786 | 786 | ||
787 | dprintk("RPC: %4d call_encode (status %d)\n", | 787 | dprintk("RPC: %4d call_encode (status %d)\n", |
788 | task->tk_pid, task->tk_status); | 788 | task->tk_pid, task->tk_status); |
@@ -1100,7 +1100,7 @@ call_decode(struct rpc_task *task) | |||
1100 | struct rpc_clnt *clnt = task->tk_client; | 1100 | struct rpc_clnt *clnt = task->tk_client; |
1101 | struct rpc_rqst *req = task->tk_rqstp; | 1101 | struct rpc_rqst *req = task->tk_rqstp; |
1102 | kxdrproc_t decode = task->tk_msg.rpc_proc->p_decode; | 1102 | kxdrproc_t decode = task->tk_msg.rpc_proc->p_decode; |
1103 | u32 *p; | 1103 | __be32 *p; |
1104 | 1104 | ||
1105 | dprintk("RPC: %4d call_decode (status %d)\n", | 1105 | dprintk("RPC: %4d call_decode (status %d)\n", |
1106 | task->tk_pid, task->tk_status); | 1106 | task->tk_pid, task->tk_status); |
@@ -1197,12 +1197,12 @@ call_refreshresult(struct rpc_task *task) | |||
1197 | /* | 1197 | /* |
1198 | * Call header serialization | 1198 | * Call header serialization |
1199 | */ | 1199 | */ |
1200 | static u32 * | 1200 | static __be32 * |
1201 | call_header(struct rpc_task *task) | 1201 | call_header(struct rpc_task *task) |
1202 | { | 1202 | { |
1203 | struct rpc_clnt *clnt = task->tk_client; | 1203 | struct rpc_clnt *clnt = task->tk_client; |
1204 | struct rpc_rqst *req = task->tk_rqstp; | 1204 | struct rpc_rqst *req = task->tk_rqstp; |
1205 | u32 *p = req->rq_svec[0].iov_base; | 1205 | __be32 *p = req->rq_svec[0].iov_base; |
1206 | 1206 | ||
1207 | /* FIXME: check buffer size? */ | 1207 | /* FIXME: check buffer size? */ |
1208 | 1208 | ||
@@ -1221,12 +1221,13 @@ call_header(struct rpc_task *task) | |||
1221 | /* | 1221 | /* |
1222 | * Reply header verification | 1222 | * Reply header verification |
1223 | */ | 1223 | */ |
1224 | static u32 * | 1224 | static __be32 * |
1225 | call_verify(struct rpc_task *task) | 1225 | call_verify(struct rpc_task *task) |
1226 | { | 1226 | { |
1227 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; | 1227 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; |
1228 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; | 1228 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; |
1229 | u32 *p = iov->iov_base, n; | 1229 | __be32 *p = iov->iov_base; |
1230 | u32 n; | ||
1230 | int error = -EACCES; | 1231 | int error = -EACCES; |
1231 | 1232 | ||
1232 | if ((task->tk_rqstp->rq_rcv_buf.len & 3) != 0) { | 1233 | if ((task->tk_rqstp->rq_rcv_buf.len & 3) != 0) { |
@@ -1303,7 +1304,7 @@ call_verify(struct rpc_task *task) | |||
1303 | printk(KERN_WARNING "call_verify: auth check failed\n"); | 1304 | printk(KERN_WARNING "call_verify: auth check failed\n"); |
1304 | goto out_garbage; /* bad verifier, retry */ | 1305 | goto out_garbage; /* bad verifier, retry */ |
1305 | } | 1306 | } |
1306 | len = p - (u32 *)iov->iov_base - 1; | 1307 | len = p - (__be32 *)iov->iov_base - 1; |
1307 | if (len < 0) | 1308 | if (len < 0) |
1308 | goto out_overflow; | 1309 | goto out_overflow; |
1309 | switch ((n = ntohl(*p++))) { | 1310 | switch ((n = ntohl(*p++))) { |
@@ -1358,12 +1359,12 @@ out_overflow: | |||
1358 | goto out_garbage; | 1359 | goto out_garbage; |
1359 | } | 1360 | } |
1360 | 1361 | ||
1361 | static int rpcproc_encode_null(void *rqstp, u32 *data, void *obj) | 1362 | static int rpcproc_encode_null(void *rqstp, __be32 *data, void *obj) |
1362 | { | 1363 | { |
1363 | return 0; | 1364 | return 0; |
1364 | } | 1365 | } |
1365 | 1366 | ||
1366 | static int rpcproc_decode_null(void *rqstp, u32 *data, void *obj) | 1367 | static int rpcproc_decode_null(void *rqstp, __be32 *data, void *obj) |
1367 | { | 1368 | { |
1368 | return 0; | 1369 | return 0; |
1369 | } | 1370 | } |
diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c index c04609d3476a..919d5ba7ca0a 100644 --- a/net/sunrpc/pmap_clnt.c +++ b/net/sunrpc/pmap_clnt.c | |||
@@ -300,7 +300,7 @@ static struct rpc_clnt *pmap_create(char *hostname, struct sockaddr_in *srvaddr, | |||
300 | /* | 300 | /* |
301 | * XDR encode/decode functions for PMAP | 301 | * XDR encode/decode functions for PMAP |
302 | */ | 302 | */ |
303 | static int xdr_encode_mapping(struct rpc_rqst *req, u32 *p, struct portmap_args *map) | 303 | static int xdr_encode_mapping(struct rpc_rqst *req, __be32 *p, struct portmap_args *map) |
304 | { | 304 | { |
305 | dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n", | 305 | dprintk("RPC: xdr_encode_mapping(%u, %u, %u, %u)\n", |
306 | map->pm_prog, map->pm_vers, map->pm_prot, map->pm_port); | 306 | map->pm_prog, map->pm_vers, map->pm_prot, map->pm_port); |
@@ -313,13 +313,13 @@ static int xdr_encode_mapping(struct rpc_rqst *req, u32 *p, struct portmap_args | |||
313 | return 0; | 313 | return 0; |
314 | } | 314 | } |
315 | 315 | ||
316 | static int xdr_decode_port(struct rpc_rqst *req, u32 *p, unsigned short *portp) | 316 | static int xdr_decode_port(struct rpc_rqst *req, __be32 *p, unsigned short *portp) |
317 | { | 317 | { |
318 | *portp = (unsigned short) ntohl(*p++); | 318 | *portp = (unsigned short) ntohl(*p++); |
319 | return 0; | 319 | return 0; |
320 | } | 320 | } |
321 | 321 | ||
322 | static int xdr_decode_bool(struct rpc_rqst *req, u32 *p, unsigned int *boolp) | 322 | static int xdr_decode_bool(struct rpc_rqst *req, __be32 *p, unsigned int *boolp) |
323 | { | 323 | { |
324 | *boolp = (unsigned int) ntohl(*p++); | 324 | *boolp = (unsigned int) ntohl(*p++); |
325 | return 0; | 325 | return 0; |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index b76a227dd3ad..44b8d9d4c18a 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -256,11 +256,11 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
256 | struct kvec * argv = &rqstp->rq_arg.head[0]; | 256 | struct kvec * argv = &rqstp->rq_arg.head[0]; |
257 | struct kvec * resv = &rqstp->rq_res.head[0]; | 257 | struct kvec * resv = &rqstp->rq_res.head[0]; |
258 | kxdrproc_t xdr; | 258 | kxdrproc_t xdr; |
259 | u32 *statp; | 259 | __be32 *statp; |
260 | u32 dir, prog, vers, proc, | 260 | u32 dir, prog, vers, proc; |
261 | auth_stat, rpc_stat; | 261 | __be32 auth_stat, rpc_stat; |
262 | int auth_res; | 262 | int auth_res; |
263 | u32 *accept_statp; | 263 | __be32 *accept_statp; |
264 | 264 | ||
265 | rpc_stat = rpc_success; | 265 | rpc_stat = rpc_success; |
266 | 266 | ||
@@ -284,16 +284,16 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
284 | rqstp->rq_sendfile_ok = 1; | 284 | rqstp->rq_sendfile_ok = 1; |
285 | /* tcp needs a space for the record length... */ | 285 | /* tcp needs a space for the record length... */ |
286 | if (rqstp->rq_prot == IPPROTO_TCP) | 286 | if (rqstp->rq_prot == IPPROTO_TCP) |
287 | svc_putu32(resv, 0); | 287 | svc_putnl(resv, 0); |
288 | 288 | ||
289 | rqstp->rq_xid = svc_getu32(argv); | 289 | rqstp->rq_xid = svc_getu32(argv); |
290 | svc_putu32(resv, rqstp->rq_xid); | 290 | svc_putu32(resv, rqstp->rq_xid); |
291 | 291 | ||
292 | dir = ntohl(svc_getu32(argv)); | 292 | dir = svc_getnl(argv); |
293 | vers = ntohl(svc_getu32(argv)); | 293 | vers = svc_getnl(argv); |
294 | 294 | ||
295 | /* First words of reply: */ | 295 | /* First words of reply: */ |
296 | svc_putu32(resv, xdr_one); /* REPLY */ | 296 | svc_putnl(resv, 1); /* REPLY */ |
297 | 297 | ||
298 | if (dir != 0) /* direction != CALL */ | 298 | if (dir != 0) /* direction != CALL */ |
299 | goto err_bad_dir; | 299 | goto err_bad_dir; |
@@ -303,11 +303,11 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
303 | /* Save position in case we later decide to reject: */ | 303 | /* Save position in case we later decide to reject: */ |
304 | accept_statp = resv->iov_base + resv->iov_len; | 304 | accept_statp = resv->iov_base + resv->iov_len; |
305 | 305 | ||
306 | svc_putu32(resv, xdr_zero); /* ACCEPT */ | 306 | svc_putnl(resv, 0); /* ACCEPT */ |
307 | 307 | ||
308 | rqstp->rq_prog = prog = ntohl(svc_getu32(argv)); /* program number */ | 308 | rqstp->rq_prog = prog = svc_getnl(argv); /* program number */ |
309 | rqstp->rq_vers = vers = ntohl(svc_getu32(argv)); /* version number */ | 309 | rqstp->rq_vers = vers = svc_getnl(argv); /* version number */ |
310 | rqstp->rq_proc = proc = ntohl(svc_getu32(argv)); /* procedure number */ | 310 | rqstp->rq_proc = proc = svc_getnl(argv); /* procedure number */ |
311 | 311 | ||
312 | progp = serv->sv_program; | 312 | progp = serv->sv_program; |
313 | 313 | ||
@@ -361,7 +361,7 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
361 | 361 | ||
362 | /* Build the reply header. */ | 362 | /* Build the reply header. */ |
363 | statp = resv->iov_base +resv->iov_len; | 363 | statp = resv->iov_base +resv->iov_len; |
364 | svc_putu32(resv, rpc_success); /* RPC_SUCCESS */ | 364 | svc_putnl(resv, RPC_SUCCESS); |
365 | 365 | ||
366 | /* Bump per-procedure stats counter */ | 366 | /* Bump per-procedure stats counter */ |
367 | procp->pc_count++; | 367 | procp->pc_count++; |
@@ -439,10 +439,10 @@ err_bad_dir: | |||
439 | 439 | ||
440 | err_bad_rpc: | 440 | err_bad_rpc: |
441 | serv->sv_stats->rpcbadfmt++; | 441 | serv->sv_stats->rpcbadfmt++; |
442 | svc_putu32(resv, xdr_one); /* REJECT */ | 442 | svc_putnl(resv, 1); /* REJECT */ |
443 | svc_putu32(resv, xdr_zero); /* RPC_MISMATCH */ | 443 | svc_putnl(resv, 0); /* RPC_MISMATCH */ |
444 | svc_putu32(resv, xdr_two); /* Only RPCv2 supported */ | 444 | svc_putnl(resv, 2); /* Only RPCv2 supported */ |
445 | svc_putu32(resv, xdr_two); | 445 | svc_putnl(resv, 2); |
446 | goto sendit; | 446 | goto sendit; |
447 | 447 | ||
448 | err_bad_auth: | 448 | err_bad_auth: |
@@ -450,15 +450,15 @@ err_bad_auth: | |||
450 | serv->sv_stats->rpcbadauth++; | 450 | serv->sv_stats->rpcbadauth++; |
451 | /* Restore write pointer to location of accept status: */ | 451 | /* Restore write pointer to location of accept status: */ |
452 | xdr_ressize_check(rqstp, accept_statp); | 452 | xdr_ressize_check(rqstp, accept_statp); |
453 | svc_putu32(resv, xdr_one); /* REJECT */ | 453 | svc_putnl(resv, 1); /* REJECT */ |
454 | svc_putu32(resv, xdr_one); /* AUTH_ERROR */ | 454 | svc_putnl(resv, 1); /* AUTH_ERROR */ |
455 | svc_putu32(resv, auth_stat); /* status */ | 455 | svc_putnl(resv, ntohl(auth_stat)); /* status */ |
456 | goto sendit; | 456 | goto sendit; |
457 | 457 | ||
458 | err_bad_prog: | 458 | err_bad_prog: |
459 | dprintk("svc: unknown program %d\n", prog); | 459 | dprintk("svc: unknown program %d\n", prog); |
460 | serv->sv_stats->rpcbadfmt++; | 460 | serv->sv_stats->rpcbadfmt++; |
461 | svc_putu32(resv, rpc_prog_unavail); | 461 | svc_putnl(resv, RPC_PROG_UNAVAIL); |
462 | goto sendit; | 462 | goto sendit; |
463 | 463 | ||
464 | err_bad_vers: | 464 | err_bad_vers: |
@@ -466,9 +466,9 @@ err_bad_vers: | |||
466 | printk("svc: unknown version (%d)\n", vers); | 466 | printk("svc: unknown version (%d)\n", vers); |
467 | #endif | 467 | #endif |
468 | serv->sv_stats->rpcbadfmt++; | 468 | serv->sv_stats->rpcbadfmt++; |
469 | svc_putu32(resv, rpc_prog_mismatch); | 469 | svc_putnl(resv, RPC_PROG_MISMATCH); |
470 | svc_putu32(resv, htonl(progp->pg_lovers)); | 470 | svc_putnl(resv, progp->pg_lovers); |
471 | svc_putu32(resv, htonl(progp->pg_hivers)); | 471 | svc_putnl(resv, progp->pg_hivers); |
472 | goto sendit; | 472 | goto sendit; |
473 | 473 | ||
474 | err_bad_proc: | 474 | err_bad_proc: |
@@ -476,7 +476,7 @@ err_bad_proc: | |||
476 | printk("svc: unknown procedure (%d)\n", proc); | 476 | printk("svc: unknown procedure (%d)\n", proc); |
477 | #endif | 477 | #endif |
478 | serv->sv_stats->rpcbadfmt++; | 478 | serv->sv_stats->rpcbadfmt++; |
479 | svc_putu32(resv, rpc_proc_unavail); | 479 | svc_putnl(resv, RPC_PROC_UNAVAIL); |
480 | goto sendit; | 480 | goto sendit; |
481 | 481 | ||
482 | err_garbage: | 482 | err_garbage: |
@@ -486,6 +486,6 @@ err_garbage: | |||
486 | rpc_stat = rpc_garbage_args; | 486 | rpc_stat = rpc_garbage_args; |
487 | err_bad: | 487 | err_bad: |
488 | serv->sv_stats->rpcbadfmt++; | 488 | serv->sv_stats->rpcbadfmt++; |
489 | svc_putu32(resv, rpc_stat); | 489 | svc_putnl(resv, ntohl(rpc_stat)); |
490 | goto sendit; | 490 | goto sendit; |
491 | } | 491 | } |
diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c index 5b28c6176806..8f2320aded5c 100644 --- a/net/sunrpc/svcauth.c +++ b/net/sunrpc/svcauth.c | |||
@@ -35,14 +35,14 @@ static struct auth_ops *authtab[RPC_AUTH_MAXFLAVOR] = { | |||
35 | }; | 35 | }; |
36 | 36 | ||
37 | int | 37 | int |
38 | svc_authenticate(struct svc_rqst *rqstp, u32 *authp) | 38 | svc_authenticate(struct svc_rqst *rqstp, __be32 *authp) |
39 | { | 39 | { |
40 | rpc_authflavor_t flavor; | 40 | rpc_authflavor_t flavor; |
41 | struct auth_ops *aops; | 41 | struct auth_ops *aops; |
42 | 42 | ||
43 | *authp = rpc_auth_ok; | 43 | *authp = rpc_auth_ok; |
44 | 44 | ||
45 | flavor = ntohl(svc_getu32(&rqstp->rq_arg.head[0])); | 45 | flavor = svc_getnl(&rqstp->rq_arg.head[0]); |
46 | 46 | ||
47 | dprintk("svc: svc_authenticate (%d)\n", flavor); | 47 | dprintk("svc: svc_authenticate (%d)\n", flavor); |
48 | 48 | ||
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 7e5707e2d6b6..1020d54b01d0 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -145,7 +145,7 @@ static void ip_map_request(struct cache_detail *cd, | |||
145 | { | 145 | { |
146 | char text_addr[20]; | 146 | char text_addr[20]; |
147 | struct ip_map *im = container_of(h, struct ip_map, h); | 147 | struct ip_map *im = container_of(h, struct ip_map, h); |
148 | __u32 addr = im->m_addr.s_addr; | 148 | __be32 addr = im->m_addr.s_addr; |
149 | 149 | ||
150 | snprintf(text_addr, 20, "%u.%u.%u.%u", | 150 | snprintf(text_addr, 20, "%u.%u.%u.%u", |
151 | ntohl(addr) >> 24 & 0xff, | 151 | ntohl(addr) >> 24 & 0xff, |
@@ -249,10 +249,10 @@ static int ip_map_show(struct seq_file *m, | |||
249 | 249 | ||
250 | seq_printf(m, "%s %d.%d.%d.%d %s\n", | 250 | seq_printf(m, "%s %d.%d.%d.%d %s\n", |
251 | im->m_class, | 251 | im->m_class, |
252 | htonl(addr.s_addr) >> 24 & 0xff, | 252 | ntohl(addr.s_addr) >> 24 & 0xff, |
253 | htonl(addr.s_addr) >> 16 & 0xff, | 253 | ntohl(addr.s_addr) >> 16 & 0xff, |
254 | htonl(addr.s_addr) >> 8 & 0xff, | 254 | ntohl(addr.s_addr) >> 8 & 0xff, |
255 | htonl(addr.s_addr) >> 0 & 0xff, | 255 | ntohl(addr.s_addr) >> 0 & 0xff, |
256 | dom | 256 | dom |
257 | ); | 257 | ); |
258 | return 0; | 258 | return 0; |
@@ -410,7 +410,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) | |||
410 | } | 410 | } |
411 | 411 | ||
412 | static int | 412 | static int |
413 | svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp) | 413 | svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp) |
414 | { | 414 | { |
415 | struct kvec *argv = &rqstp->rq_arg.head[0]; | 415 | struct kvec *argv = &rqstp->rq_arg.head[0]; |
416 | struct kvec *resv = &rqstp->rq_res.head[0]; | 416 | struct kvec *resv = &rqstp->rq_res.head[0]; |
@@ -427,7 +427,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp) | |||
427 | *authp = rpc_autherr_badcred; | 427 | *authp = rpc_autherr_badcred; |
428 | return SVC_DENIED; | 428 | return SVC_DENIED; |
429 | } | 429 | } |
430 | if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) { | 430 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
431 | dprintk("svc: bad null verf\n"); | 431 | dprintk("svc: bad null verf\n"); |
432 | *authp = rpc_autherr_badverf; | 432 | *authp = rpc_autherr_badverf; |
433 | return SVC_DENIED; | 433 | return SVC_DENIED; |
@@ -441,8 +441,8 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp) | |||
441 | return SVC_DROP; /* kmalloc failure - client must retry */ | 441 | return SVC_DROP; /* kmalloc failure - client must retry */ |
442 | 442 | ||
443 | /* Put NULL verifier */ | 443 | /* Put NULL verifier */ |
444 | svc_putu32(resv, RPC_AUTH_NULL); | 444 | svc_putnl(resv, RPC_AUTH_NULL); |
445 | svc_putu32(resv, 0); | 445 | svc_putnl(resv, 0); |
446 | 446 | ||
447 | return SVC_OK; | 447 | return SVC_OK; |
448 | } | 448 | } |
@@ -472,7 +472,7 @@ struct auth_ops svcauth_null = { | |||
472 | 472 | ||
473 | 473 | ||
474 | static int | 474 | static int |
475 | svcauth_unix_accept(struct svc_rqst *rqstp, u32 *authp) | 475 | svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp) |
476 | { | 476 | { |
477 | struct kvec *argv = &rqstp->rq_arg.head[0]; | 477 | struct kvec *argv = &rqstp->rq_arg.head[0]; |
478 | struct kvec *resv = &rqstp->rq_res.head[0]; | 478 | struct kvec *resv = &rqstp->rq_res.head[0]; |
@@ -488,31 +488,31 @@ svcauth_unix_accept(struct svc_rqst *rqstp, u32 *authp) | |||
488 | 488 | ||
489 | svc_getu32(argv); /* length */ | 489 | svc_getu32(argv); /* length */ |
490 | svc_getu32(argv); /* time stamp */ | 490 | svc_getu32(argv); /* time stamp */ |
491 | slen = XDR_QUADLEN(ntohl(svc_getu32(argv))); /* machname length */ | 491 | slen = XDR_QUADLEN(svc_getnl(argv)); /* machname length */ |
492 | if (slen > 64 || (len -= (slen + 3)*4) < 0) | 492 | if (slen > 64 || (len -= (slen + 3)*4) < 0) |
493 | goto badcred; | 493 | goto badcred; |
494 | argv->iov_base = (void*)((u32*)argv->iov_base + slen); /* skip machname */ | 494 | argv->iov_base = (void*)((__be32*)argv->iov_base + slen); /* skip machname */ |
495 | argv->iov_len -= slen*4; | 495 | argv->iov_len -= slen*4; |
496 | 496 | ||
497 | cred->cr_uid = ntohl(svc_getu32(argv)); /* uid */ | 497 | cred->cr_uid = svc_getnl(argv); /* uid */ |
498 | cred->cr_gid = ntohl(svc_getu32(argv)); /* gid */ | 498 | cred->cr_gid = svc_getnl(argv); /* gid */ |
499 | slen = ntohl(svc_getu32(argv)); /* gids length */ | 499 | slen = svc_getnl(argv); /* gids length */ |
500 | if (slen > 16 || (len -= (slen + 2)*4) < 0) | 500 | if (slen > 16 || (len -= (slen + 2)*4) < 0) |
501 | goto badcred; | 501 | goto badcred; |
502 | cred->cr_group_info = groups_alloc(slen); | 502 | cred->cr_group_info = groups_alloc(slen); |
503 | if (cred->cr_group_info == NULL) | 503 | if (cred->cr_group_info == NULL) |
504 | return SVC_DROP; | 504 | return SVC_DROP; |
505 | for (i = 0; i < slen; i++) | 505 | for (i = 0; i < slen; i++) |
506 | GROUP_AT(cred->cr_group_info, i) = ntohl(svc_getu32(argv)); | 506 | GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); |
507 | 507 | ||
508 | if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) { | 508 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
509 | *authp = rpc_autherr_badverf; | 509 | *authp = rpc_autherr_badverf; |
510 | return SVC_DENIED; | 510 | return SVC_DENIED; |
511 | } | 511 | } |
512 | 512 | ||
513 | /* Put NULL verifier */ | 513 | /* Put NULL verifier */ |
514 | svc_putu32(resv, RPC_AUTH_NULL); | 514 | svc_putnl(resv, RPC_AUTH_NULL); |
515 | svc_putu32(resv, 0); | 515 | svc_putnl(resv, 0); |
516 | 516 | ||
517 | return SVC_OK; | 517 | return SVC_OK; |
518 | 518 | ||
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 953aff89bcac..5b0fe1b66a23 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1030,7 +1030,7 @@ svc_tcp_sendto(struct svc_rqst *rqstp) | |||
1030 | { | 1030 | { |
1031 | struct xdr_buf *xbufp = &rqstp->rq_res; | 1031 | struct xdr_buf *xbufp = &rqstp->rq_res; |
1032 | int sent; | 1032 | int sent; |
1033 | u32 reclen; | 1033 | __be32 reclen; |
1034 | 1034 | ||
1035 | /* Set up the first element of the reply kvec. | 1035 | /* Set up the first element of the reply kvec. |
1036 | * Any other kvecs that may be in use have been taken | 1036 | * Any other kvecs that may be in use have been taken |
@@ -1393,14 +1393,12 @@ svc_create_socket(struct svc_serv *serv, int protocol, struct sockaddr_in *sin) | |||
1393 | if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0) | 1393 | if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0) |
1394 | return error; | 1394 | return error; |
1395 | 1395 | ||
1396 | if (sin != NULL) { | 1396 | if (type == SOCK_STREAM) |
1397 | if (type == SOCK_STREAM) | 1397 | sock->sk->sk_reuse = 1; /* allow address reuse */ |
1398 | sock->sk->sk_reuse = 1; /* allow address reuse */ | 1398 | error = kernel_bind(sock, (struct sockaddr *) sin, |
1399 | error = kernel_bind(sock, (struct sockaddr *) sin, | 1399 | sizeof(*sin)); |
1400 | sizeof(*sin)); | 1400 | if (error < 0) |
1401 | if (error < 0) | 1401 | goto bummer; |
1402 | goto bummer; | ||
1403 | } | ||
1404 | 1402 | ||
1405 | if (protocol == IPPROTO_TCP) { | 1403 | if (protocol == IPPROTO_TCP) { |
1406 | if ((error = kernel_listen(sock, 64)) < 0) | 1404 | if ((error = kernel_listen(sock, 64)) < 0) |
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 6ac45103a272..9022eb8b37ed 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
@@ -18,8 +18,8 @@ | |||
18 | /* | 18 | /* |
19 | * XDR functions for basic NFS types | 19 | * XDR functions for basic NFS types |
20 | */ | 20 | */ |
21 | u32 * | 21 | __be32 * |
22 | xdr_encode_netobj(u32 *p, const struct xdr_netobj *obj) | 22 | xdr_encode_netobj(__be32 *p, const struct xdr_netobj *obj) |
23 | { | 23 | { |
24 | unsigned int quadlen = XDR_QUADLEN(obj->len); | 24 | unsigned int quadlen = XDR_QUADLEN(obj->len); |
25 | 25 | ||
@@ -29,8 +29,8 @@ xdr_encode_netobj(u32 *p, const struct xdr_netobj *obj) | |||
29 | return p + XDR_QUADLEN(obj->len); | 29 | return p + XDR_QUADLEN(obj->len); |
30 | } | 30 | } |
31 | 31 | ||
32 | u32 * | 32 | __be32 * |
33 | xdr_decode_netobj(u32 *p, struct xdr_netobj *obj) | 33 | xdr_decode_netobj(__be32 *p, struct xdr_netobj *obj) |
34 | { | 34 | { |
35 | unsigned int len; | 35 | unsigned int len; |
36 | 36 | ||
@@ -55,7 +55,7 @@ xdr_decode_netobj(u32 *p, struct xdr_netobj *obj) | |||
55 | * Returns the updated current XDR buffer position | 55 | * Returns the updated current XDR buffer position |
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | u32 *xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int nbytes) | 58 | __be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int nbytes) |
59 | { | 59 | { |
60 | if (likely(nbytes != 0)) { | 60 | if (likely(nbytes != 0)) { |
61 | unsigned int quadlen = XDR_QUADLEN(nbytes); | 61 | unsigned int quadlen = XDR_QUADLEN(nbytes); |
@@ -79,21 +79,21 @@ EXPORT_SYMBOL(xdr_encode_opaque_fixed); | |||
79 | * | 79 | * |
80 | * Returns the updated current XDR buffer position | 80 | * Returns the updated current XDR buffer position |
81 | */ | 81 | */ |
82 | u32 *xdr_encode_opaque(u32 *p, const void *ptr, unsigned int nbytes) | 82 | __be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int nbytes) |
83 | { | 83 | { |
84 | *p++ = htonl(nbytes); | 84 | *p++ = htonl(nbytes); |
85 | return xdr_encode_opaque_fixed(p, ptr, nbytes); | 85 | return xdr_encode_opaque_fixed(p, ptr, nbytes); |
86 | } | 86 | } |
87 | EXPORT_SYMBOL(xdr_encode_opaque); | 87 | EXPORT_SYMBOL(xdr_encode_opaque); |
88 | 88 | ||
89 | u32 * | 89 | __be32 * |
90 | xdr_encode_string(u32 *p, const char *string) | 90 | xdr_encode_string(__be32 *p, const char *string) |
91 | { | 91 | { |
92 | return xdr_encode_array(p, string, strlen(string)); | 92 | return xdr_encode_array(p, string, strlen(string)); |
93 | } | 93 | } |
94 | 94 | ||
95 | u32 * | 95 | __be32 * |
96 | xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen) | 96 | xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen) |
97 | { | 97 | { |
98 | unsigned int len; | 98 | unsigned int len; |
99 | 99 | ||
@@ -432,7 +432,7 @@ xdr_shift_buf(struct xdr_buf *buf, size_t len) | |||
432 | * of the buffer length, and takes care of adjusting the kvec | 432 | * of the buffer length, and takes care of adjusting the kvec |
433 | * length for us. | 433 | * length for us. |
434 | */ | 434 | */ |
435 | void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p) | 435 | void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p) |
436 | { | 436 | { |
437 | struct kvec *iov = buf->head; | 437 | struct kvec *iov = buf->head; |
438 | int scratch_len = buf->buflen - buf->page_len - buf->tail[0].iov_len; | 438 | int scratch_len = buf->buflen - buf->page_len - buf->tail[0].iov_len; |
@@ -440,8 +440,8 @@ void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p) | |||
440 | BUG_ON(scratch_len < 0); | 440 | BUG_ON(scratch_len < 0); |
441 | xdr->buf = buf; | 441 | xdr->buf = buf; |
442 | xdr->iov = iov; | 442 | xdr->iov = iov; |
443 | xdr->p = (uint32_t *)((char *)iov->iov_base + iov->iov_len); | 443 | xdr->p = (__be32 *)((char *)iov->iov_base + iov->iov_len); |
444 | xdr->end = (uint32_t *)((char *)iov->iov_base + scratch_len); | 444 | xdr->end = (__be32 *)((char *)iov->iov_base + scratch_len); |
445 | BUG_ON(iov->iov_len > scratch_len); | 445 | BUG_ON(iov->iov_len > scratch_len); |
446 | 446 | ||
447 | if (p != xdr->p && p != NULL) { | 447 | if (p != xdr->p && p != NULL) { |
@@ -465,10 +465,10 @@ EXPORT_SYMBOL(xdr_init_encode); | |||
465 | * bytes of data. If so, update the total xdr_buf length, and | 465 | * bytes of data. If so, update the total xdr_buf length, and |
466 | * adjust the length of the current kvec. | 466 | * adjust the length of the current kvec. |
467 | */ | 467 | */ |
468 | uint32_t * xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes) | 468 | __be32 * xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes) |
469 | { | 469 | { |
470 | uint32_t *p = xdr->p; | 470 | __be32 *p = xdr->p; |
471 | uint32_t *q; | 471 | __be32 *q; |
472 | 472 | ||
473 | /* align nbytes on the next 32-bit boundary */ | 473 | /* align nbytes on the next 32-bit boundary */ |
474 | nbytes += 3; | 474 | nbytes += 3; |
@@ -524,7 +524,7 @@ EXPORT_SYMBOL(xdr_write_pages); | |||
524 | * @buf: pointer to XDR buffer from which to decode data | 524 | * @buf: pointer to XDR buffer from which to decode data |
525 | * @p: current pointer inside XDR buffer | 525 | * @p: current pointer inside XDR buffer |
526 | */ | 526 | */ |
527 | void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p) | 527 | void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p) |
528 | { | 528 | { |
529 | struct kvec *iov = buf->head; | 529 | struct kvec *iov = buf->head; |
530 | unsigned int len = iov->iov_len; | 530 | unsigned int len = iov->iov_len; |
@@ -534,7 +534,7 @@ void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, uint32_t *p) | |||
534 | xdr->buf = buf; | 534 | xdr->buf = buf; |
535 | xdr->iov = iov; | 535 | xdr->iov = iov; |
536 | xdr->p = p; | 536 | xdr->p = p; |
537 | xdr->end = (uint32_t *)((char *)iov->iov_base + len); | 537 | xdr->end = (__be32 *)((char *)iov->iov_base + len); |
538 | } | 538 | } |
539 | EXPORT_SYMBOL(xdr_init_decode); | 539 | EXPORT_SYMBOL(xdr_init_decode); |
540 | 540 | ||
@@ -548,10 +548,10 @@ EXPORT_SYMBOL(xdr_init_decode); | |||
548 | * If so return the current pointer, then update the current | 548 | * If so return the current pointer, then update the current |
549 | * pointer position. | 549 | * pointer position. |
550 | */ | 550 | */ |
551 | uint32_t * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) | 551 | __be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) |
552 | { | 552 | { |
553 | uint32_t *p = xdr->p; | 553 | __be32 *p = xdr->p; |
554 | uint32_t *q = p + XDR_QUADLEN(nbytes); | 554 | __be32 *q = p + XDR_QUADLEN(nbytes); |
555 | 555 | ||
556 | if (unlikely(q > xdr->end || q < p)) | 556 | if (unlikely(q > xdr->end || q < p)) |
557 | return NULL; | 557 | return NULL; |
@@ -599,8 +599,8 @@ void xdr_read_pages(struct xdr_stream *xdr, unsigned int len) | |||
599 | * Position current pointer at beginning of tail, and | 599 | * Position current pointer at beginning of tail, and |
600 | * set remaining message length. | 600 | * set remaining message length. |
601 | */ | 601 | */ |
602 | xdr->p = (uint32_t *)((char *)iov->iov_base + padding); | 602 | xdr->p = (__be32 *)((char *)iov->iov_base + padding); |
603 | xdr->end = (uint32_t *)((char *)iov->iov_base + end); | 603 | xdr->end = (__be32 *)((char *)iov->iov_base + end); |
604 | } | 604 | } |
605 | EXPORT_SYMBOL(xdr_read_pages); | 605 | EXPORT_SYMBOL(xdr_read_pages); |
606 | 606 | ||
@@ -624,8 +624,8 @@ void xdr_enter_page(struct xdr_stream *xdr, unsigned int len) | |||
624 | */ | 624 | */ |
625 | if (len > PAGE_CACHE_SIZE - xdr->buf->page_base) | 625 | if (len > PAGE_CACHE_SIZE - xdr->buf->page_base) |
626 | len = PAGE_CACHE_SIZE - xdr->buf->page_base; | 626 | len = PAGE_CACHE_SIZE - xdr->buf->page_base; |
627 | xdr->p = (uint32_t *)(kaddr + xdr->buf->page_base); | 627 | xdr->p = (__be32 *)(kaddr + xdr->buf->page_base); |
628 | xdr->end = (uint32_t *)((char *)xdr->p + len); | 628 | xdr->end = (__be32 *)((char *)xdr->p + len); |
629 | } | 629 | } |
630 | EXPORT_SYMBOL(xdr_enter_page); | 630 | EXPORT_SYMBOL(xdr_enter_page); |
631 | 631 | ||
@@ -743,7 +743,7 @@ out: | |||
743 | int | 743 | int |
744 | xdr_decode_word(struct xdr_buf *buf, int base, u32 *obj) | 744 | xdr_decode_word(struct xdr_buf *buf, int base, u32 *obj) |
745 | { | 745 | { |
746 | u32 raw; | 746 | __be32 raw; |
747 | int status; | 747 | int status; |
748 | 748 | ||
749 | status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); | 749 | status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); |
@@ -756,7 +756,7 @@ xdr_decode_word(struct xdr_buf *buf, int base, u32 *obj) | |||
756 | int | 756 | int |
757 | xdr_encode_word(struct xdr_buf *buf, int base, u32 obj) | 757 | xdr_encode_word(struct xdr_buf *buf, int base, u32 obj) |
758 | { | 758 | { |
759 | u32 raw = htonl(obj); | 759 | __be32 raw = htonl(obj); |
760 | 760 | ||
761 | return write_bytes_to_xdr_buf(buf, base, &raw, sizeof(obj)); | 761 | return write_bytes_to_xdr_buf(buf, base, &raw, sizeof(obj)); |
762 | } | 762 | } |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 1f786f68729d..80857470dc11 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -594,7 +594,7 @@ static void xprt_connect_status(struct rpc_task *task) | |||
594 | * @xid: RPC XID of incoming reply | 594 | * @xid: RPC XID of incoming reply |
595 | * | 595 | * |
596 | */ | 596 | */ |
597 | struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid) | 597 | struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) |
598 | { | 598 | { |
599 | struct list_head *pos; | 599 | struct list_head *pos; |
600 | 600 | ||
@@ -801,7 +801,7 @@ void xprt_reserve(struct rpc_task *task) | |||
801 | spin_unlock(&xprt->reserve_lock); | 801 | spin_unlock(&xprt->reserve_lock); |
802 | } | 802 | } |
803 | 803 | ||
804 | static inline u32 xprt_alloc_xid(struct rpc_xprt *xprt) | 804 | static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt) |
805 | { | 805 | { |
806 | return xprt->xid++; | 806 | return xprt->xid++; |
807 | } | 807 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 9b62923a9c06..28100e019225 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -548,7 +548,8 @@ static void xs_udp_data_ready(struct sock *sk, int len) | |||
548 | struct rpc_rqst *rovr; | 548 | struct rpc_rqst *rovr; |
549 | struct sk_buff *skb; | 549 | struct sk_buff *skb; |
550 | int err, repsize, copied; | 550 | int err, repsize, copied; |
551 | u32 _xid, *xp; | 551 | u32 _xid; |
552 | __be32 *xp; | ||
552 | 553 | ||
553 | read_lock(&sk->sk_callback_lock); | 554 | read_lock(&sk->sk_callback_lock); |
554 | dprintk("RPC: xs_udp_data_ready...\n"); | 555 | dprintk("RPC: xs_udp_data_ready...\n"); |
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h index d3abb0b7dc62..6ac4e4f033ac 100644 --- a/net/xfrm/xfrm_hash.h +++ b/net/xfrm/xfrm_hash.h | |||
@@ -58,10 +58,10 @@ static inline unsigned __xfrm_src_hash(xfrm_address_t *saddr, | |||
58 | } | 58 | } |
59 | 59 | ||
60 | static inline unsigned int | 60 | static inline unsigned int |
61 | __xfrm_spi_hash(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family, | 61 | __xfrm_spi_hash(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family, |
62 | unsigned int hmask) | 62 | unsigned int hmask) |
63 | { | 63 | { |
64 | unsigned int h = spi ^ proto; | 64 | unsigned int h = (__force u32)spi ^ proto; |
65 | switch (family) { | 65 | switch (family) { |
66 | case AF_INET: | 66 | case AF_INET: |
67 | h ^= __xfrm4_addr_hash(daddr); | 67 | h ^= __xfrm4_addr_hash(daddr); |
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index dfc90bb1cf1f..e8198a2c785d 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -46,7 +46,7 @@ EXPORT_SYMBOL(secpath_dup); | |||
46 | 46 | ||
47 | /* Fetch spi and seq from ipsec header */ | 47 | /* Fetch spi and seq from ipsec header */ |
48 | 48 | ||
49 | int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) | 49 | int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq) |
50 | { | 50 | { |
51 | int offset, offset_seq; | 51 | int offset, offset_seq; |
52 | 52 | ||
@@ -62,7 +62,7 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) | |||
62 | case IPPROTO_COMP: | 62 | case IPPROTO_COMP: |
63 | if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) | 63 | if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr))) |
64 | return -EINVAL; | 64 | return -EINVAL; |
65 | *spi = htonl(ntohs(*(u16*)(skb->h.raw + 2))); | 65 | *spi = htonl(ntohs(*(__be16*)(skb->h.raw + 2))); |
66 | *seq = 0; | 66 | *seq = 0; |
67 | return 0; | 67 | return 0; |
68 | default: | 68 | default: |
@@ -72,8 +72,8 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq) | |||
72 | if (!pskb_may_pull(skb, 16)) | 72 | if (!pskb_may_pull(skb, 16)) |
73 | return -EINVAL; | 73 | return -EINVAL; |
74 | 74 | ||
75 | *spi = *(u32*)(skb->h.raw + offset); | 75 | *spi = *(__be32*)(skb->h.raw + offset); |
76 | *seq = *(u32*)(skb->h.raw + offset_seq); | 76 | *seq = *(__be32*)(skb->h.raw + offset_seq); |
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | EXPORT_SYMBOL(xfrm_parse_spi); | 79 | EXPORT_SYMBOL(xfrm_parse_spi); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 9f63edd39346..f927b7330f02 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -70,7 +70,7 @@ static inline unsigned int xfrm_src_hash(xfrm_address_t *addr, | |||
70 | } | 70 | } |
71 | 71 | ||
72 | static inline unsigned int | 72 | static inline unsigned int |
73 | xfrm_spi_hash(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family) | 73 | xfrm_spi_hash(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family) |
74 | { | 74 | { |
75 | return __xfrm_spi_hash(daddr, spi, proto, family, xfrm_state_hmask); | 75 | return __xfrm_spi_hash(daddr, spi, proto, family, xfrm_state_hmask); |
76 | } | 76 | } |
@@ -96,9 +96,12 @@ static void xfrm_hash_transfer(struct hlist_head *list, | |||
96 | nhashmask); | 96 | nhashmask); |
97 | hlist_add_head(&x->bysrc, nsrctable+h); | 97 | hlist_add_head(&x->bysrc, nsrctable+h); |
98 | 98 | ||
99 | h = __xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, | 99 | if (x->id.spi) { |
100 | x->props.family, nhashmask); | 100 | h = __xfrm_spi_hash(&x->id.daddr, x->id.spi, |
101 | hlist_add_head(&x->byspi, nspitable+h); | 101 | x->id.proto, x->props.family, |
102 | nhashmask); | ||
103 | hlist_add_head(&x->byspi, nspitable+h); | ||
104 | } | ||
102 | } | 105 | } |
103 | } | 106 | } |
104 | 107 | ||
@@ -421,7 +424,7 @@ xfrm_init_tempsel(struct xfrm_state *x, struct flowi *fl, | |||
421 | return 0; | 424 | return 0; |
422 | } | 425 | } |
423 | 426 | ||
424 | static struct xfrm_state *__xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family) | 427 | static struct xfrm_state *__xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family) |
425 | { | 428 | { |
426 | unsigned int h = xfrm_spi_hash(daddr, spi, proto, family); | 429 | unsigned int h = xfrm_spi_hash(daddr, spi, proto, family); |
427 | struct xfrm_state *x; | 430 | struct xfrm_state *x; |
@@ -622,7 +625,7 @@ static void __xfrm_state_insert(struct xfrm_state *x) | |||
622 | h = xfrm_src_hash(&x->props.saddr, x->props.family); | 625 | h = xfrm_src_hash(&x->props.saddr, x->props.family); |
623 | hlist_add_head(&x->bysrc, xfrm_state_bysrc+h); | 626 | hlist_add_head(&x->bysrc, xfrm_state_bysrc+h); |
624 | 627 | ||
625 | if (xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY)) { | 628 | if (x->id.spi) { |
626 | h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, | 629 | h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, |
627 | x->props.family); | 630 | x->props.family); |
628 | 631 | ||
@@ -916,7 +919,7 @@ err: | |||
916 | EXPORT_SYMBOL(xfrm_state_check); | 919 | EXPORT_SYMBOL(xfrm_state_check); |
917 | 920 | ||
918 | struct xfrm_state * | 921 | struct xfrm_state * |
919 | xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, | 922 | xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, |
920 | unsigned short family) | 923 | unsigned short family) |
921 | { | 924 | { |
922 | struct xfrm_state *x; | 925 | struct xfrm_state *x; |
@@ -1040,7 +1043,7 @@ u32 xfrm_get_acqseq(void) | |||
1040 | EXPORT_SYMBOL(xfrm_get_acqseq); | 1043 | EXPORT_SYMBOL(xfrm_get_acqseq); |
1041 | 1044 | ||
1042 | void | 1045 | void |
1043 | xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi) | 1046 | xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi) |
1044 | { | 1047 | { |
1045 | unsigned int h; | 1048 | unsigned int h; |
1046 | struct xfrm_state *x0; | 1049 | struct xfrm_state *x0; |
@@ -1057,10 +1060,10 @@ xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi) | |||
1057 | x->id.spi = minspi; | 1060 | x->id.spi = minspi; |
1058 | } else { | 1061 | } else { |
1059 | u32 spi = 0; | 1062 | u32 spi = 0; |
1060 | minspi = ntohl(minspi); | 1063 | u32 low = ntohl(minspi); |
1061 | maxspi = ntohl(maxspi); | 1064 | u32 high = ntohl(maxspi); |
1062 | for (h=0; h<maxspi-minspi+1; h++) { | 1065 | for (h=0; h<high-low+1; h++) { |
1063 | spi = minspi + net_random()%(maxspi-minspi+1); | 1066 | spi = low + net_random()%(high-low+1); |
1064 | x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family); | 1067 | x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family); |
1065 | if (x0 == NULL) { | 1068 | if (x0 == NULL) { |
1066 | x->id.spi = htonl(spi); | 1069 | x->id.spi = htonl(spi); |
@@ -1180,11 +1183,10 @@ static void xfrm_replay_timer_handler(unsigned long data) | |||
1180 | spin_unlock(&x->lock); | 1183 | spin_unlock(&x->lock); |
1181 | } | 1184 | } |
1182 | 1185 | ||
1183 | int xfrm_replay_check(struct xfrm_state *x, u32 seq) | 1186 | int xfrm_replay_check(struct xfrm_state *x, __be32 net_seq) |
1184 | { | 1187 | { |
1185 | u32 diff; | 1188 | u32 diff; |
1186 | 1189 | u32 seq = ntohl(net_seq); | |
1187 | seq = ntohl(seq); | ||
1188 | 1190 | ||
1189 | if (unlikely(seq == 0)) | 1191 | if (unlikely(seq == 0)) |
1190 | return -EINVAL; | 1192 | return -EINVAL; |
@@ -1206,11 +1208,10 @@ int xfrm_replay_check(struct xfrm_state *x, u32 seq) | |||
1206 | } | 1208 | } |
1207 | EXPORT_SYMBOL(xfrm_replay_check); | 1209 | EXPORT_SYMBOL(xfrm_replay_check); |
1208 | 1210 | ||
1209 | void xfrm_replay_advance(struct xfrm_state *x, u32 seq) | 1211 | void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq) |
1210 | { | 1212 | { |
1211 | u32 diff; | 1213 | u32 diff; |
1212 | 1214 | u32 seq = ntohl(net_seq); | |
1213 | seq = ntohl(seq); | ||
1214 | 1215 | ||
1215 | if (seq > x->replay.seq) { | 1216 | if (seq > x->replay.seq) { |
1216 | diff = seq - x->replay.seq; | 1217 | diff = seq - x->replay.seq; |