summaryrefslogtreecommitdiffstats
path: root/net/802/psnap.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-01-07 02:33:00 +0000
committer <ralf@linux-mips.org>1997-01-07 02:33:00 +0000
commitbeb116954b9b7f3bb56412b2494b562f02b864b1 (patch)
tree120e997879884e1b9d93b265221b939d2ef1ade1 /net/802/psnap.c
parent908d4681a1dc3792ecafbe64265783a86c4cccb6 (diff)
Import of Linux/MIPS 2.1.14
Diffstat (limited to 'net/802/psnap.c')
-rw-r--r--net/802/psnap.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/net/802/psnap.c b/net/802/psnap.c
index d0186c54e..4f17352ab 100644
--- a/net/802/psnap.c
+++ b/net/802/psnap.c
@@ -10,6 +10,7 @@
* 2 of the License, or (at your option) any later version.
*/
+#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/datalink.h>
@@ -58,7 +59,7 @@ int snap_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
*/
skb->h.raw += 5;
- skb->len -= 5;
+ skb_pull(skb,5);
if (psnap_packet_type.type == 0)
psnap_packet_type.type=htons(ETH_P_SNAP);
return proto->rcvfunc(skb, dev, &psnap_packet_type);
@@ -74,24 +75,27 @@ int snap_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
static void snap_datalink_header(struct datalink_proto *dl, struct sk_buff *skb, unsigned char *dest_node)
{
- struct device *dev = skb->dev;
- unsigned char *rawp;
-
- rawp = skb->data + snap_dl->header_length+dev->hard_header_len;
- memcpy(rawp,dl->type,5);
- skb->h.raw = rawp+5;
+ memcpy(skb_push(skb,5),dl->type,5);
snap_dl->datalink_header(snap_dl, skb, dest_node);
}
/*
* Set up the SNAP layer
*/
+
+static struct symbol_table snap_proto_syms = {
+#include <linux/symtab_begin.h>
+ X(register_snap_client),
+ X(unregister_snap_client),
+#include <linux/symtab_end.h>
+};
void snap_proto_init(struct net_proto *pro)
{
snap_dl=register_8022_client(0xAA, snap_rcv);
if(snap_dl==NULL)
printk("SNAP - unable to register with 802.2\n");
+ register_symtab(&snap_proto_syms);
}
/*
@@ -121,3 +125,31 @@ struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(
return proto;
}
+/*
+ * Unregister SNAP clients. Protocols no longer want to play with us ...
+ */
+
+void unregister_snap_client(unsigned char *desc)
+{
+ struct datalink_proto **clients = &snap_list;
+ struct datalink_proto *tmp;
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+
+ while ((tmp = *clients) != NULL)
+ {
+ if (memcmp(tmp->type,desc,5) == 0)
+ {
+ *clients = tmp->next;
+ kfree_s(tmp, sizeof(struct datalink_proto));
+ break;
+ }
+ else
+ clients = &tmp->next;
+ }
+
+ restore_flags(flags);
+}
+