aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/af_ax25.c113
-rw-r--r--net/ax25/ax25_ds_subr.c2
-rw-r--r--net/ax25/ax25_in.c24
-rw-r--r--net/ax25/ax25_ip.c4
-rw-r--r--net/ax25/ax25_out.c12
-rw-r--r--net/ax25/ax25_subr.c4
6 files changed, 81 insertions, 78 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 1c07c6a50eb8..6ded95272a53 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1127,22 +1127,22 @@ static int __must_check ax25_connect(struct socket *sock,
1127 switch (sk->sk_state) { 1127 switch (sk->sk_state) {
1128 case TCP_SYN_SENT: /* still trying */ 1128 case TCP_SYN_SENT: /* still trying */
1129 err = -EINPROGRESS; 1129 err = -EINPROGRESS;
1130 goto out; 1130 goto out_release;
1131 1131
1132 case TCP_ESTABLISHED: /* connection established */ 1132 case TCP_ESTABLISHED: /* connection established */
1133 sock->state = SS_CONNECTED; 1133 sock->state = SS_CONNECTED;
1134 goto out; 1134 goto out_release;
1135 1135
1136 case TCP_CLOSE: /* connection refused */ 1136 case TCP_CLOSE: /* connection refused */
1137 sock->state = SS_UNCONNECTED; 1137 sock->state = SS_UNCONNECTED;
1138 err = -ECONNREFUSED; 1138 err = -ECONNREFUSED;
1139 goto out; 1139 goto out_release;
1140 } 1140 }
1141 } 1141 }
1142 1142
1143 if (sk->sk_state == TCP_ESTABLISHED && sk->sk_type == SOCK_SEQPACKET) { 1143 if (sk->sk_state == TCP_ESTABLISHED && sk->sk_type == SOCK_SEQPACKET) {
1144 err = -EISCONN; /* No reconnect on a seqpacket socket */ 1144 err = -EISCONN; /* No reconnect on a seqpacket socket */
1145 goto out; 1145 goto out_release;
1146 } 1146 }
1147 1147
1148 sk->sk_state = TCP_CLOSE; 1148 sk->sk_state = TCP_CLOSE;
@@ -1159,12 +1159,12 @@ static int __must_check ax25_connect(struct socket *sock,
1159 /* Valid number of digipeaters ? */ 1159 /* Valid number of digipeaters ? */
1160 if (fsa->fsa_ax25.sax25_ndigis < 1 || fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS) { 1160 if (fsa->fsa_ax25.sax25_ndigis < 1 || fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS) {
1161 err = -EINVAL; 1161 err = -EINVAL;
1162 goto out; 1162 goto out_release;
1163 } 1163 }
1164 1164
1165 if ((digi = kmalloc(sizeof(ax25_digi), GFP_KERNEL)) == NULL) { 1165 if ((digi = kmalloc(sizeof(ax25_digi), GFP_KERNEL)) == NULL) {
1166 err = -ENOBUFS; 1166 err = -ENOBUFS;
1167 goto out; 1167 goto out_release;
1168 } 1168 }
1169 1169
1170 digi->ndigi = fsa->fsa_ax25.sax25_ndigis; 1170 digi->ndigi = fsa->fsa_ax25.sax25_ndigis;
@@ -1194,7 +1194,7 @@ static int __must_check ax25_connect(struct socket *sock,
1194 current->comm); 1194 current->comm);
1195 if ((err = ax25_rt_autobind(ax25, &fsa->fsa_ax25.sax25_call)) < 0) { 1195 if ((err = ax25_rt_autobind(ax25, &fsa->fsa_ax25.sax25_call)) < 0) {
1196 kfree(digi); 1196 kfree(digi);
1197 goto out; 1197 goto out_release;
1198 } 1198 }
1199 1199
1200 ax25_fillin_cb(ax25, ax25->ax25_dev); 1200 ax25_fillin_cb(ax25, ax25->ax25_dev);
@@ -1203,7 +1203,7 @@ static int __must_check ax25_connect(struct socket *sock,
1203 if (ax25->ax25_dev == NULL) { 1203 if (ax25->ax25_dev == NULL) {
1204 kfree(digi); 1204 kfree(digi);
1205 err = -EHOSTUNREACH; 1205 err = -EHOSTUNREACH;
1206 goto out; 1206 goto out_release;
1207 } 1207 }
1208 } 1208 }
1209 1209
@@ -1213,7 +1213,7 @@ static int __must_check ax25_connect(struct socket *sock,
1213 kfree(digi); 1213 kfree(digi);
1214 err = -EADDRINUSE; /* Already such a connection */ 1214 err = -EADDRINUSE; /* Already such a connection */
1215 ax25_cb_put(ax25t); 1215 ax25_cb_put(ax25t);
1216 goto out; 1216 goto out_release;
1217 } 1217 }
1218 1218
1219 ax25->dest_addr = fsa->fsa_ax25.sax25_call; 1219 ax25->dest_addr = fsa->fsa_ax25.sax25_call;
@@ -1223,7 +1223,7 @@ static int __must_check ax25_connect(struct socket *sock,
1223 if (sk->sk_type != SOCK_SEQPACKET) { 1223 if (sk->sk_type != SOCK_SEQPACKET) {
1224 sock->state = SS_CONNECTED; 1224 sock->state = SS_CONNECTED;
1225 sk->sk_state = TCP_ESTABLISHED; 1225 sk->sk_state = TCP_ESTABLISHED;
1226 goto out; 1226 goto out_release;
1227 } 1227 }
1228 1228
1229 /* Move to connecting socket, ax.25 lapb WAIT_UA.. */ 1229 /* Move to connecting socket, ax.25 lapb WAIT_UA.. */
@@ -1255,55 +1255,53 @@ static int __must_check ax25_connect(struct socket *sock,
1255 /* Now the loop */ 1255 /* Now the loop */
1256 if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) { 1256 if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) {
1257 err = -EINPROGRESS; 1257 err = -EINPROGRESS;
1258 goto out; 1258 goto out_release;
1259 } 1259 }
1260 1260
1261 if (sk->sk_state == TCP_SYN_SENT) { 1261 if (sk->sk_state == TCP_SYN_SENT) {
1262 struct task_struct *tsk = current; 1262 DEFINE_WAIT(wait);
1263 DECLARE_WAITQUEUE(wait, tsk);
1264 1263
1265 add_wait_queue(sk->sk_sleep, &wait);
1266 for (;;) { 1264 for (;;) {
1265 prepare_to_wait(sk->sk_sleep, &wait,
1266 TASK_INTERRUPTIBLE);
1267 if (sk->sk_state != TCP_SYN_SENT) 1267 if (sk->sk_state != TCP_SYN_SENT)
1268 break; 1268 break;
1269 set_current_state(TASK_INTERRUPTIBLE); 1269 if (!signal_pending(current)) {
1270 release_sock(sk); 1270 release_sock(sk);
1271 if (!signal_pending(tsk)) {
1272 schedule(); 1271 schedule();
1273 lock_sock(sk); 1272 lock_sock(sk);
1274 continue; 1273 continue;
1275 } 1274 }
1276 current->state = TASK_RUNNING; 1275 err = -ERESTARTSYS;
1277 remove_wait_queue(sk->sk_sleep, &wait); 1276 break;
1278 return -ERESTARTSYS;
1279 } 1277 }
1280 current->state = TASK_RUNNING; 1278 finish_wait(sk->sk_sleep, &wait);
1281 remove_wait_queue(sk->sk_sleep, &wait); 1279
1280 if (err)
1281 goto out_release;
1282 } 1282 }
1283 1283
1284 if (sk->sk_state != TCP_ESTABLISHED) { 1284 if (sk->sk_state != TCP_ESTABLISHED) {
1285 /* Not in ABM, not in WAIT_UA -> failed */ 1285 /* Not in ABM, not in WAIT_UA -> failed */
1286 sock->state = SS_UNCONNECTED; 1286 sock->state = SS_UNCONNECTED;
1287 err = sock_error(sk); /* Always set at this point */ 1287 err = sock_error(sk); /* Always set at this point */
1288 goto out; 1288 goto out_release;
1289 } 1289 }
1290 1290
1291 sock->state = SS_CONNECTED; 1291 sock->state = SS_CONNECTED;
1292 1292
1293 err=0; 1293 err = 0;
1294out: 1294out_release:
1295 release_sock(sk); 1295 release_sock(sk);
1296 1296
1297 return err; 1297 return err;
1298} 1298}
1299 1299
1300
1301static int ax25_accept(struct socket *sock, struct socket *newsock, int flags) 1300static int ax25_accept(struct socket *sock, struct socket *newsock, int flags)
1302{ 1301{
1303 struct task_struct *tsk = current;
1304 DECLARE_WAITQUEUE(wait, tsk);
1305 struct sk_buff *skb; 1302 struct sk_buff *skb;
1306 struct sock *newsk; 1303 struct sock *newsk;
1304 DEFINE_WAIT(wait);
1307 struct sock *sk; 1305 struct sock *sk;
1308 int err = 0; 1306 int err = 0;
1309 1307
@@ -1328,30 +1326,29 @@ static int ax25_accept(struct socket *sock, struct socket *newsock, int flags)
1328 * The read queue this time is holding sockets ready to use 1326 * The read queue this time is holding sockets ready to use
1329 * hooked into the SABM we saved 1327 * hooked into the SABM we saved
1330 */ 1328 */
1331 add_wait_queue(sk->sk_sleep, &wait);
1332 for (;;) { 1329 for (;;) {
1330 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
1333 skb = skb_dequeue(&sk->sk_receive_queue); 1331 skb = skb_dequeue(&sk->sk_receive_queue);
1334 if (skb) 1332 if (skb)
1335 break; 1333 break;
1336 1334
1337 release_sock(sk);
1338 current->state = TASK_INTERRUPTIBLE;
1339 if (flags & O_NONBLOCK) { 1335 if (flags & O_NONBLOCK) {
1340 current->state = TASK_RUNNING; 1336 err = -EWOULDBLOCK;
1341 remove_wait_queue(sk->sk_sleep, &wait); 1337 break;
1342 return -EWOULDBLOCK;
1343 } 1338 }
1344 if (!signal_pending(tsk)) { 1339 if (!signal_pending(current)) {
1340 release_sock(sk);
1345 schedule(); 1341 schedule();
1346 lock_sock(sk); 1342 lock_sock(sk);
1347 continue; 1343 continue;
1348 } 1344 }
1349 current->state = TASK_RUNNING; 1345 err = -ERESTARTSYS;
1350 remove_wait_queue(sk->sk_sleep, &wait); 1346 break;
1351 return -ERESTARTSYS;
1352 } 1347 }
1353 current->state = TASK_RUNNING; 1348 finish_wait(sk->sk_sleep, &wait);
1354 remove_wait_queue(sk->sk_sleep, &wait); 1349
1350 if (err)
1351 goto out;
1355 1352
1356 newsk = skb->sk; 1353 newsk = skb->sk;
1357 newsk->sk_socket = newsock; 1354 newsk->sk_socket = newsock;
@@ -1425,7 +1422,6 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1425 struct sockaddr_ax25 sax; 1422 struct sockaddr_ax25 sax;
1426 struct sk_buff *skb; 1423 struct sk_buff *skb;
1427 ax25_digi dtmp, *dp; 1424 ax25_digi dtmp, *dp;
1428 unsigned char *asmptr;
1429 ax25_cb *ax25; 1425 ax25_cb *ax25;
1430 size_t size; 1426 size_t size;
1431 int lv, err, addr_len = msg->msg_namelen; 1427 int lv, err, addr_len = msg->msg_namelen;
@@ -1548,13 +1544,11 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1548 goto out; 1544 goto out;
1549 } 1545 }
1550 1546
1551 skb->nh.raw = skb->data; 1547 skb_reset_network_header(skb);
1552 1548
1553 /* Add the PID if one is not supplied by the user in the skb */ 1549 /* Add the PID if one is not supplied by the user in the skb */
1554 if (!ax25->pidincl) { 1550 if (!ax25->pidincl)
1555 asmptr = skb_push(skb, 1); 1551 *skb_push(skb, 1) = sk->sk_protocol;
1556 *asmptr = sk->sk_protocol;
1557 }
1558 1552
1559 SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n"); 1553 SOCK_DEBUG(sk, "AX.25: Transmitting buffer\n");
1560 1554
@@ -1573,7 +1567,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1573 goto out; 1567 goto out;
1574 } 1568 }
1575 1569
1576 asmptr = skb_push(skb, 1 + ax25_addr_size(dp)); 1570 skb_push(skb, 1 + ax25_addr_size(dp));
1577 1571
1578 SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp); 1572 SOCK_DEBUG(sk, "Building AX.25 Header (dp=%p).\n", dp);
1579 1573
@@ -1581,17 +1575,17 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1581 SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi); 1575 SOCK_DEBUG(sk, "Num digipeaters=%d\n", dp->ndigi);
1582 1576
1583 /* Build an AX.25 header */ 1577 /* Build an AX.25 header */
1584 asmptr += (lv = ax25_addr_build(asmptr, &ax25->source_addr, 1578 lv = ax25_addr_build(skb->data, &ax25->source_addr, &sax.sax25_call,
1585 &sax.sax25_call, dp, 1579 dp, AX25_COMMAND, AX25_MODULUS);
1586 AX25_COMMAND, AX25_MODULUS));
1587 1580
1588 SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv); 1581 SOCK_DEBUG(sk, "Built header (%d bytes)\n",lv);
1589 1582
1590 skb->h.raw = asmptr; 1583 skb_set_transport_header(skb, lv);
1591 1584
1592 SOCK_DEBUG(sk, "base=%p pos=%p\n", skb->data, asmptr); 1585 SOCK_DEBUG(sk, "base=%p pos=%p\n",
1586 skb->data, skb_transport_header(skb));
1593 1587
1594 *asmptr = AX25_UI; 1588 *skb_transport_header(skb) = AX25_UI;
1595 1589
1596 /* Datagram frames go straight out of the door as UI */ 1590 /* Datagram frames go straight out of the door as UI */
1597 ax25_queue_xmit(skb, ax25->ax25_dev->dev); 1591 ax25_queue_xmit(skb, ax25->ax25_dev->dev);
@@ -1631,8 +1625,8 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
1631 if (!ax25_sk(sk)->pidincl) 1625 if (!ax25_sk(sk)->pidincl)
1632 skb_pull(skb, 1); /* Remove PID */ 1626 skb_pull(skb, 1); /* Remove PID */
1633 1627
1634 skb->h.raw = skb->data; 1628 skb_reset_transport_header(skb);
1635 copied = skb->len; 1629 copied = skb->len;
1636 1630
1637 if (copied > size) { 1631 if (copied > size) {
1638 copied = size; 1632 copied = size;
@@ -1645,9 +1639,10 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
1645 struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name; 1639 struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name;
1646 ax25_digi digi; 1640 ax25_digi digi;
1647 ax25_address src; 1641 ax25_address src;
1642 const unsigned char *mac = skb_mac_header(skb);
1648 1643
1649 ax25_addr_parse(skb->mac.raw+1, skb->data-skb->mac.raw-1, &src, NULL, &digi, NULL, NULL); 1644 ax25_addr_parse(mac + 1, skb->data - mac - 1, &src, NULL,
1650 1645 &digi, NULL, NULL);
1651 sax->sax25_family = AF_AX25; 1646 sax->sax25_family = AF_AX25;
1652 /* We set this correctly, even though we may not let the 1647 /* We set this correctly, even though we may not let the
1653 application know the digi calls further down (because it 1648 application know the digi calls further down (because it
@@ -1711,6 +1706,10 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1711 res = sock_get_timestamp(sk, argp); 1706 res = sock_get_timestamp(sk, argp);
1712 break; 1707 break;
1713 1708
1709 case SIOCGSTAMPNS:
1710 res = sock_get_timestampns(sk, argp);
1711 break;
1712
1714 case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */ 1713 case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */
1715 case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */ 1714 case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */
1716 case SIOCAX25GETUID: { 1715 case SIOCAX25GETUID: {
diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c
index 9569dd3fa466..a49773ff2b92 100644
--- a/net/ax25/ax25_ds_subr.c
+++ b/net/ax25/ax25_ds_subr.c
@@ -136,7 +136,7 @@ static void ax25_kiss_cmd(ax25_dev *ax25_dev, unsigned char cmd, unsigned char p
136 if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL) 136 if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL)
137 return; 137 return;
138 138
139 skb->nh.raw = skb->data; 139 skb_reset_network_header(skb);
140 p = skb_put(skb, 2); 140 p = skb_put(skb, 2);
141 141
142 *p++ = cmd; 142 *p++ = cmd;
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 4a6b26becadc..0ddaff0df217 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -61,12 +61,14 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
61 skb_reserve(skbn, AX25_MAX_HEADER_LEN); 61 skb_reserve(skbn, AX25_MAX_HEADER_LEN);
62 62
63 skbn->dev = ax25->ax25_dev->dev; 63 skbn->dev = ax25->ax25_dev->dev;
64 skbn->h.raw = skbn->data; 64 skb_reset_network_header(skbn);
65 skbn->nh.raw = skbn->data; 65 skb_reset_transport_header(skbn);
66 66
67 /* Copy data from the fragments */ 67 /* Copy data from the fragments */
68 while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) { 68 while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) {
69 memcpy(skb_put(skbn, skbo->len), skbo->data, skbo->len); 69 skb_copy_from_linear_data(skbo,
70 skb_put(skbn, skbo->len),
71 skbo->len);
70 kfree_skb(skbo); 72 kfree_skb(skbo);
71 } 73 }
72 74
@@ -122,8 +124,8 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
122 } 124 }
123 125
124 skb_pull(skb, 1); /* Remove PID */ 126 skb_pull(skb, 1); /* Remove PID */
125 skb->mac.raw = skb->nh.raw; 127 skb_reset_mac_header(skb);
126 skb->nh.raw = skb->data; 128 skb_reset_network_header(skb);
127 skb->dev = ax25->ax25_dev->dev; 129 skb->dev = ax25->ax25_dev->dev;
128 skb->pkt_type = PACKET_HOST; 130 skb->pkt_type = PACKET_HOST;
129 skb->protocol = htons(ETH_P_IP); 131 skb->protocol = htons(ETH_P_IP);
@@ -196,7 +198,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
196 * Process the AX.25/LAPB frame. 198 * Process the AX.25/LAPB frame.
197 */ 199 */
198 200
199 skb->h.raw = skb->data; 201 skb_reset_transport_header(skb);
200 202
201 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { 203 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) {
202 kfree_skb(skb); 204 kfree_skb(skb);
@@ -233,7 +235,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
233 235
234 /* UI frame - bypass LAPB processing */ 236 /* UI frame - bypass LAPB processing */
235 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) { 237 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) {
236 skb->h.raw = skb->data + 2; /* skip control and pid */ 238 skb_set_transport_header(skb, 2); /* skip control and pid */
237 239
238 ax25_send_to_raw(&dest, skb, skb->data[1]); 240 ax25_send_to_raw(&dest, skb, skb->data[1]);
239 241
@@ -246,8 +248,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
246 switch (skb->data[1]) { 248 switch (skb->data[1]) {
247 case AX25_P_IP: 249 case AX25_P_IP:
248 skb_pull(skb,2); /* drop PID/CTRL */ 250 skb_pull(skb,2); /* drop PID/CTRL */
249 skb->h.raw = skb->data; 251 skb_reset_transport_header(skb);
250 skb->nh.raw = skb->data; 252 skb_reset_network_header(skb);
251 skb->dev = dev; 253 skb->dev = dev;
252 skb->pkt_type = PACKET_HOST; 254 skb->pkt_type = PACKET_HOST;
253 skb->protocol = htons(ETH_P_IP); 255 skb->protocol = htons(ETH_P_IP);
@@ -256,8 +258,8 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
256 258
257 case AX25_P_ARP: 259 case AX25_P_ARP:
258 skb_pull(skb,2); 260 skb_pull(skb,2);
259 skb->h.raw = skb->data; 261 skb_reset_transport_header(skb);
260 skb->nh.raw = skb->data; 262 skb_reset_network_header(skb);
261 skb->dev = dev; 263 skb->dev = dev;
262 skb->pkt_type = PACKET_HOST; 264 skb->pkt_type = PACKET_HOST;
263 skb->protocol = htons(ETH_P_ARP); 265 skb->protocol = htons(ETH_P_ARP);
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index 7f818bbcd1c5..930e4918037f 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -121,7 +121,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
121 digipeat = route->digipeat; 121 digipeat = route->digipeat;
122 dev = route->dev; 122 dev = route->dev;
123 ip_mode = route->ip_mode; 123 ip_mode = route->ip_mode;
124 }; 124 }
125 125
126 if (dev == NULL) 126 if (dev == NULL)
127 dev = skb->dev; 127 dev = skb->dev;
@@ -171,7 +171,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
171 src_c = *(ax25_address *)(bp + 8); 171 src_c = *(ax25_address *)(bp + 8);
172 172
173 skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */ 173 skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */
174 ourskb->nh.raw = ourskb->data; 174 skb_reset_network_header(ourskb);
175 175
176 ax25=ax25_send_frame( 176 ax25=ax25_send_frame(
177 ourskb, 177 ourskb,
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 223835092b7a..92b517af7260 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -148,8 +148,9 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
148 148
149 if (ka9qfrag == 1) { 149 if (ka9qfrag == 1) {
150 skb_reserve(skbn, frontlen + 2); 150 skb_reserve(skbn, frontlen + 2);
151 skbn->nh.raw = skbn->data + (skb->nh.raw - skb->data); 151 skb_set_network_header(skbn,
152 memcpy(skb_put(skbn, len), skb->data, len); 152 skb_network_offset(skb));
153 skb_copy_from_linear_data(skb, skb_put(skbn, len), len);
153 p = skb_push(skbn, 2); 154 p = skb_push(skbn, 2);
154 155
155 *p++ = AX25_P_SEGMENT; 156 *p++ = AX25_P_SEGMENT;
@@ -161,8 +162,9 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
161 } 162 }
162 } else { 163 } else {
163 skb_reserve(skbn, frontlen + 1); 164 skb_reserve(skbn, frontlen + 1);
164 skbn->nh.raw = skbn->data + (skb->nh.raw - skb->data); 165 skb_set_network_header(skbn,
165 memcpy(skb_put(skbn, len), skb->data, len); 166 skb_network_offset(skb));
167 skb_copy_from_linear_data(skb, skb_put(skbn, len), len);
166 p = skb_push(skbn, 1); 168 p = skb_push(skbn, 1);
167 *p = AX25_P_TEXT; 169 *p = AX25_P_TEXT;
168 } 170 }
@@ -205,7 +207,7 @@ static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit)
205 if (skb == NULL) 207 if (skb == NULL)
206 return; 208 return;
207 209
208 skb->nh.raw = skb->data; 210 skb_reset_network_header(skb);
209 211
210 if (ax25->modulus == AX25_MODULUS) { 212 if (ax25->modulus == AX25_MODULUS) {
211 frame = skb_push(skb, 1); 213 frame = skb_push(skb, 1);
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index b6c577e3c914..5fe9b2a6697d 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -162,7 +162,7 @@ void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type)
162 162
163 skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len); 163 skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len);
164 164
165 skb->nh.raw = skb->data; 165 skb_reset_network_header(skb);
166 166
167 /* Assume a response - address structure for DTE */ 167 /* Assume a response - address structure for DTE */
168 if (ax25->modulus == AX25_MODULUS) { 168 if (ax25->modulus == AX25_MODULUS) {
@@ -205,7 +205,7 @@ void ax25_return_dm(struct net_device *dev, ax25_address *src, ax25_address *des
205 return; /* Next SABM will get DM'd */ 205 return; /* Next SABM will get DM'd */
206 206
207 skb_reserve(skb, dev->hard_header_len); 207 skb_reserve(skb, dev->hard_header_len);
208 skb->nh.raw = skb->data; 208 skb_reset_network_header(skb);
209 209
210 ax25_digi_invert(digi, &retdigi); 210 ax25_digi_invert(digi, &retdigi);
211 211