Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
766c9363
Commit
766c9363
authored
Jul 18, 2002
by
Arnaldo Carvalho de Melo
Committed by
David S. Miller
Jul 18, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MODULE_LICENSE to p8022.c and psnap.c + CodingStyle cleanups
parent
33185cc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
60 deletions
+53
-60
net/802/p8022.c
net/802/p8022.c
+5
-3
net/802/psnap.c
net/802/psnap.c
+48
-57
No files found.
net/802/p8022.c
View file @
766c9363
...
@@ -25,9 +25,9 @@
...
@@ -25,9 +25,9 @@
#include <net/p8022.h>
#include <net/p8022.h>
extern
void
llc_register_sap
(
unsigned
char
sap
,
extern
void
llc_register_sap
(
unsigned
char
sap
,
int
(
*
rcvfunc
)(
struct
sk_buff
*
,
int
(
*
rcvfunc
)(
struct
sk_buff
*
,
struct
net_device
*
,
struct
net_device
*
,
struct
packet_type
*
));
struct
packet_type
*
));
extern
void
llc_unregister_sap
(
unsigned
char
sap
);
extern
void
llc_unregister_sap
(
unsigned
char
sap
);
static
struct
datalink_proto
*
p8022_list
;
static
struct
datalink_proto
*
p8022_list
;
...
@@ -124,3 +124,5 @@ void unregister_8022_client(unsigned char type)
...
@@ -124,3 +124,5 @@ void unregister_8022_client(unsigned char type)
EXPORT_SYMBOL
(
register_8022_client
);
EXPORT_SYMBOL
(
register_8022_client
);
EXPORT_SYMBOL
(
unregister_8022_client
);
EXPORT_SYMBOL
(
unregister_8022_client
);
MODULE_LICENSE
(
"GPL"
);
net/802/psnap.c
View file @
766c9363
/*
/*
* SNAP data link layer. Derived from 802.2
* SNAP data link layer. Derived from 802.2
*
*
* Alan Cox <Alan.Cox@linux.org>, from the 802.2 layer by Greg Page.
* Alan Cox <Alan.Cox@linux.org>,
* from the 802.2 layer by Greg Page.
* Merged in additions from Greg Page's psnap.c.
* Merged in additions from Greg Page's psnap.c.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -20,50 +21,39 @@
...
@@ -20,50 +21,39 @@
#include <linux/in.h>
#include <linux/in.h>
#include <linux/init.h>
#include <linux/init.h>
static
struct
datalink_proto
*
snap_list
=
NULL
;
static
struct
datalink_proto
*
snap_list
;
static
struct
datalink_proto
*
snap_dl
=
NULL
;
/* 802.2 DL for SNAP */
static
struct
datalink_proto
*
snap_dl
;
/* 802.2 DL for SNAP */
/*
/*
* Find a snap client by matching the 5 bytes.
* Find a snap client by matching the 5 bytes.
*/
*/
static
struct
datalink_proto
*
find_snap_client
(
unsigned
char
*
desc
)
static
struct
datalink_proto
*
find_snap_client
(
unsigned
char
*
desc
)
{
{
struct
datalink_proto
*
proto
;
struct
datalink_proto
*
proto
=
snap_list
;
for
(;
proto
&&
memcmp
(
proto
->
type
,
desc
,
5
);
proto
=
proto
->
next
);
for
(
proto
=
snap_list
;
proto
!=
NULL
&&
memcmp
(
proto
->
type
,
desc
,
5
)
;
proto
=
proto
->
next
);
return
proto
;
return
proto
;
}
}
/*
/*
* A SNAP packet has arrived
* A SNAP packet has arrived
*/
*/
int
snap_rcv
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
,
int
snap_rcv
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
,
struct
packet_type
*
pt
)
struct
packet_type
*
pt
)
{
{
static
struct
packet_type
psnap_packet_type
=
static
struct
packet_type
psnap_packet_type
=
{
{
.
type
=
__constant_htons
(
ETH_P_SNAP
),
0
,
.
func
=
snap_rcv
,
NULL
,
/* All Devices */
snap_rcv
,
NULL
,
NULL
,
};
};
struct
datalink_proto
*
proto
;
struct
datalink_proto
*
proto
=
find_snap_client
(
skb
->
h
.
raw
);
proto
=
find_snap_client
(
skb
->
h
.
raw
);
if
(
proto
!=
NULL
)
{
/*
* Pass the frame on.
*/
skb
->
h
.
raw
+=
5
;
if
(
proto
)
{
/* Pass the frame on. */
skb
->
h
.
raw
+=
5
;
skb
->
nh
.
raw
+=
5
;
skb
->
nh
.
raw
+=
5
;
skb_pull
(
skb
,
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
);
return
proto
->
rcvfunc
(
skb
,
dev
,
&
psnap_packet_type
);
}
}
...
@@ -75,60 +65,62 @@ int snap_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
...
@@ -75,60 +65,62 @@ int snap_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
/*
/*
* Put a SNAP header on a frame and pass to 802.2
* Put a SNAP header on a frame and pass to 802.2
*/
*/
static
void
snap_datalink_header
(
struct
datalink_proto
*
dl
,
static
void
snap_datalink_header
(
struct
datalink_proto
*
dl
,
struct
sk_buff
*
skb
,
unsigned
char
*
dest_node
)
struct
sk_buff
*
skb
,
unsigned
char
*
dest_node
)
{
{
memcpy
(
skb_push
(
skb
,
5
),
dl
->
type
,
5
);
memcpy
(
skb_push
(
skb
,
5
),
dl
->
type
,
5
);
snap_dl
->
datalink_header
(
snap_dl
,
skb
,
dest_node
);
snap_dl
->
datalink_header
(
snap_dl
,
skb
,
dest_node
);
}
}
/*
/*
* Set up the SNAP layer
* Set up the SNAP layer
*/
*/
EXPORT_SYMBOL
(
register_snap_client
);
EXPORT_SYMBOL
(
register_snap_client
);
EXPORT_SYMBOL
(
unregister_snap_client
);
EXPORT_SYMBOL
(
unregister_snap_client
);
static
int
__init
snap_init
(
void
)
static
int
__init
snap_init
(
void
)
{
{
snap_dl
=
register_8022_client
(
0xAA
,
snap_rcv
);
snap_dl
=
register_8022_client
(
0xAA
,
snap_rcv
);
if
(
snap_dl
==
NULL
)
printk
(
"SNAP - unable to register with 802.2
\n
"
);
if
(
!
snap_dl
)
printk
(
KERN_CRIT
"SNAP - unable to register with 802.2
\n
"
);
return
0
;
return
0
;
}
}
module_init
(
snap_init
);
module_init
(
snap_init
);
/*
/*
* Register SNAP clients. We don't yet use this for IP.
* Register SNAP clients. We don't yet use this for IP.
*/
*/
struct
datalink_proto
*
register_snap_client
(
unsigned
char
*
desc
,
struct
datalink_proto
*
register_snap_client
(
unsigned
char
*
desc
,
int
(
*
rcvfunc
)(
struct
sk_buff
*
,
struct
net_device
*
,
struct
packet_type
*
))
int
(
*
rcvfunc
)(
struct
sk_buff
*
,
struct
net_device
*
,
struct
packet_type
*
))
{
{
struct
datalink_proto
*
proto
;
struct
datalink_proto
*
proto
=
NULL
;
if
(
find_snap_client
(
desc
)
!=
NULL
)
if
(
find_snap_client
(
desc
))
return
NULL
;
goto
out
;
proto
=
(
struct
datalink_proto
*
)
kmalloc
(
sizeof
(
*
proto
),
GFP_ATOMIC
);
proto
=
kmalloc
(
sizeof
(
*
proto
),
GFP_ATOMIC
);
if
(
proto
!=
NULL
)
if
(
proto
)
{
{
memcpy
(
proto
->
type
,
desc
,
5
);
memcpy
(
proto
->
type
,
desc
,
5
);
proto
->
type_len
=
5
;
proto
->
type_len
=
5
;
proto
->
rcvfunc
=
rcvfunc
;
proto
->
rcvfunc
=
rcvfunc
;
proto
->
header_length
=
5
+
snap_dl
->
header_length
;
proto
->
header_length
=
5
+
snap_dl
->
header_length
;
proto
->
datalink_header
=
snap_datalink_header
;
proto
->
datalink_header
=
snap_datalink_header
;
proto
->
string_name
=
"SNAP"
;
proto
->
string_name
=
"SNAP"
;
proto
->
next
=
snap_list
;
proto
->
next
=
snap_list
;
snap_list
=
proto
;
snap_list
=
proto
;
}
}
out:
return
proto
;
return
proto
;
}
}
/*
/*
* Unregister SNAP clients. Protocols no longer want to play with us ...
* Unregister SNAP clients. Protocols no longer want to play with us ...
*/
*/
void
unregister_snap_client
(
unsigned
char
*
desc
)
void
unregister_snap_client
(
unsigned
char
*
desc
)
{
{
struct
datalink_proto
**
clients
=
&
snap_list
;
struct
datalink_proto
**
clients
=
&
snap_list
;
...
@@ -138,17 +130,16 @@ void unregister_snap_client(unsigned char *desc)
...
@@ -138,17 +130,16 @@ void unregister_snap_client(unsigned char *desc)
save_flags
(
flags
);
save_flags
(
flags
);
cli
();
cli
();
while
((
tmp
=
*
clients
)
!=
NULL
)
while
((
tmp
=
*
clients
)
!=
NULL
)
{
{
if
(
!
memcmp
(
tmp
->
type
,
desc
,
5
))
{
if
(
memcmp
(
tmp
->
type
,
desc
,
5
)
==
0
)
{
*
clients
=
tmp
->
next
;
*
clients
=
tmp
->
next
;
kfree
(
tmp
);
kfree
(
tmp
);
break
;
break
;
}
}
else
else
clients
=
&
tmp
->
next
;
clients
=
&
tmp
->
next
;
}
}
restore_flags
(
flags
);
restore_flags
(
flags
);
}
}
MODULE_LICENSE
(
"GPL"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment