patch-2.1.22 linux/net/rose/rose_link.c
Next file: linux/net/rose/rose_out.c
Previous file: linux/net/rose/rose_in.c
Back to the patch index
Back to the overall index
- Lines: 169
- Date:
Sun Jan 19 15:47:29 1997
- Orig file:
v2.1.21/linux/net/rose/rose_link.c
- Orig date:
Thu Jan 2 15:55:29 1997
diff -u --recursive --new-file v2.1.21/linux/net/rose/rose_link.c linux/net/rose/rose_link.c
@@ -49,7 +49,7 @@
static void rose_link_set_timer(struct rose_neigh *neigh)
{
unsigned long flags;
-
+
save_flags(flags);
cli();
del_timer(&neigh->timer);
@@ -66,7 +66,7 @@
static void rose_link_reset_timer(struct rose_neigh *neigh)
{
unsigned long flags;
-
+
save_flags(flags);
cli();
del_timer(&neigh->timer);
@@ -104,6 +104,40 @@
}
/*
+ * Interface to ax25_send_frame. Changes my level 2 callsign depending
+ * on whether we have a global ROSE callsign or use the default port
+ * callsign.
+ */
+static int rose_send_frame(struct sk_buff *skb, struct rose_neigh *neigh)
+{
+ ax25_address *rose_call;
+
+ if (ax25cmp(&rose_callsign, &null_ax25_address) == 0)
+ rose_call = (ax25_address *)neigh->dev->dev_addr;
+ else
+ rose_call = &rose_callsign;
+
+ return ax25_send_frame(skb, rose_call, &neigh->callsign, neigh->digipeat, neigh->dev);
+}
+
+/*
+ * Interface to ax25_link_up. Changes my level 2 callsign depending
+ * on whether we have a global ROSE callsign or use the default port
+ * callsign.
+ */
+static int rose_link_up(struct rose_neigh *neigh)
+{
+ ax25_address *rose_call;
+
+ if (ax25cmp(&rose_callsign, &null_ax25_address) == 0)
+ rose_call = (ax25_address *)neigh->dev->dev_addr;
+ else
+ rose_call = &rose_callsign;
+
+ return ax25_link_up(rose_call, &neigh->callsign, neigh->dev);
+}
+
+/*
* This handles all restart and diagnostic frames.
*/
void rose_link_rx_restart(struct sk_buff *skb, struct rose_neigh *neigh, unsigned short frametype)
@@ -127,7 +161,7 @@
case ROSE_DIAGNOSTIC:
printk(KERN_WARNING "rose: diagnostic #%d\n", skb->data[3]);
break;
-
+
default:
printk(KERN_WARNING "rose: received unknown %02X with LCI 000\n", frametype);
break;
@@ -135,7 +169,7 @@
if (neigh->restarted) {
while ((skbn = skb_dequeue(&neigh->queue)) != NULL)
- if (!ax25_send_frame(skbn, (ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->digipeat, neigh->dev))
+ if (!rose_send_frame(skbn, neigh))
kfree_skb(skbn, FREE_WRITE);
}
}
@@ -159,7 +193,7 @@
dptr = skb_put(skb, ROSE_MIN_LEN + 3);
*dptr++ = AX25_P_ROSE;
- *dptr++ = GFI;
+ *dptr++ = ROSE_GFI;
*dptr++ = 0x00;
*dptr++ = ROSE_RESTART_REQUEST;
*dptr++ = 0x00;
@@ -167,7 +201,7 @@
skb->sk = NULL;
- if (!ax25_send_frame(skb, (ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->digipeat, neigh->dev))
+ if (!rose_send_frame(skb, neigh))
kfree_skb(skb, FREE_WRITE);
}
@@ -190,13 +224,13 @@
dptr = skb_put(skb, ROSE_MIN_LEN + 1);
*dptr++ = AX25_P_ROSE;
- *dptr++ = GFI;
+ *dptr++ = ROSE_GFI;
*dptr++ = 0x00;
*dptr++ = ROSE_RESTART_CONFIRMATION;
skb->sk = NULL;
- if (!ax25_send_frame(skb, (ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->digipeat, neigh->dev))
+ if (!rose_send_frame(skb, neigh))
kfree_skb(skb, FREE_WRITE);
}
@@ -219,14 +253,14 @@
dptr = skb_put(skb, ROSE_MIN_LEN + 2);
*dptr++ = AX25_P_ROSE;
- *dptr++ = GFI;
+ *dptr++ = ROSE_GFI;
*dptr++ = 0x00;
*dptr++ = ROSE_DIAGNOSTIC;
*dptr++ = diag;
skb->sk = NULL;
- if (!ax25_send_frame(skb, (ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->digipeat, neigh->dev))
+ if (!rose_send_frame(skb, neigh))
kfree_skb(skb, FREE_WRITE);
}
@@ -250,7 +284,7 @@
dptr = skb_put(skb, ROSE_MIN_LEN + 3);
*dptr++ = AX25_P_ROSE;
- *dptr++ = ((lci >> 8) & 0x0F) | GFI;
+ *dptr++ = ((lci >> 8) & 0x0F) | ROSE_GFI;
*dptr++ = ((lci >> 0) & 0xFF);
*dptr++ = ROSE_CLEAR_REQUEST;
*dptr++ = cause;
@@ -258,7 +292,7 @@
skb->sk = NULL;
- if (!ax25_send_frame(skb, (ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->digipeat, neigh->dev))
+ if (!rose_send_frame(skb, neigh))
kfree_skb(skb, FREE_WRITE);
}
@@ -271,7 +305,7 @@
return;
#endif
- if (!ax25_link_up((ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->dev))
+ if (!rose_link_up(neigh))
neigh->restarted = 0;
dptr = skb_push(skb, 1);
@@ -280,11 +314,11 @@
skb->arp = 1;
if (neigh->restarted) {
- if (!ax25_send_frame(skb, (ax25_address *)neigh->dev->dev_addr, &neigh->callsign, neigh->digipeat, neigh->dev))
+ if (!rose_send_frame(skb, neigh))
kfree_skb(skb, FREE_WRITE);
} else {
skb_queue_tail(&neigh->queue, skb);
-
+
if (neigh->t0timer == 0) {
rose_transmit_restart_request(neigh);
neigh->t0timer = neigh->t0;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov