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
bf616807
Commit
bf616807
authored
Sep 26, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge master.kernel.org:/home/acme/BK/x25-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
cbb6ac6d
726798ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
43 deletions
+35
-43
net/x25/af_x25.c
net/x25/af_x25.c
+35
-43
No files found.
net/x25/af_x25.c
View file @
bf616807
...
@@ -157,22 +157,16 @@ static void x25_remove_socket(struct sock *sk)
...
@@ -157,22 +157,16 @@ static void x25_remove_socket(struct sock *sk)
save_flags
(
flags
);
save_flags
(
flags
);
cli
();
cli
();
if
((
s
=
x25_list
)
==
sk
)
{
if
((
s
=
x25_list
)
==
sk
)
x25_list
=
s
->
next
;
x25_list
=
s
->
next
;
restore_flags
(
flags
);
else
while
(
s
&&
s
->
next
)
{
return
;
}
while
(
s
!=
NULL
&&
s
->
next
!=
NULL
)
{
if
(
s
->
next
==
sk
)
{
if
(
s
->
next
==
sk
)
{
s
->
next
=
sk
->
next
;
s
->
next
=
sk
->
next
;
restore_flags
(
flags
);
break
;
return
;
}
}
s
=
s
->
next
;
s
=
s
->
next
;
}
}
restore_flags
(
flags
);
restore_flags
(
flags
);
}
}
...
@@ -183,7 +177,7 @@ static void x25_kill_by_device(struct net_device *dev)
...
@@ -183,7 +177,7 @@ static void x25_kill_by_device(struct net_device *dev)
{
{
struct
sock
*
s
;
struct
sock
*
s
;
for
(
s
=
x25_list
;
s
!=
NULL
;
s
=
s
->
next
)
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
if
(
x25_sk
(
s
)
->
neighbour
&&
x25_sk
(
s
)
->
neighbour
->
dev
==
dev
)
if
(
x25_sk
(
s
)
->
neighbour
&&
x25_sk
(
s
)
->
neighbour
->
dev
==
dev
)
x25_disconnect
(
s
,
ENETUNREACH
,
0
,
0
);
x25_disconnect
(
s
,
ENETUNREACH
,
0
,
0
);
}
}
...
@@ -193,7 +187,7 @@ static void x25_kill_by_device(struct net_device *dev)
...
@@ -193,7 +187,7 @@ static void x25_kill_by_device(struct net_device *dev)
*/
*/
static
int
x25_device_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
static
int
x25_device_event
(
struct
notifier_block
*
this
,
unsigned
long
event
,
void
*
ptr
)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
ptr
;
struct
net_device
*
dev
=
ptr
;
struct
x25_neigh
*
neigh
;
struct
x25_neigh
*
neigh
;
if
(
dev
->
type
==
ARPHRD_X25
if
(
dev
->
type
==
ARPHRD_X25
...
@@ -248,17 +242,14 @@ static struct sock *x25_find_listener(struct x25_address *addr)
...
@@ -248,17 +242,14 @@ static struct sock *x25_find_listener(struct x25_address *addr)
save_flags
(
flags
);
save_flags
(
flags
);
cli
();
cli
();
for
(
s
=
x25_list
;
s
!=
NULL
;
s
=
s
->
next
)
{
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
if
((
!
strcmp
(
addr
->
x25_addr
,
x25_sk
(
s
)
->
source_addr
.
x25_addr
)
||
if
((
!
strcmp
(
addr
->
x25_addr
,
x25_sk
(
s
)
->
source_addr
.
x25_addr
)
||
strcmp
(
addr
->
x25_addr
,
null_x25_address
.
x25_addr
)
==
0
)
&&
!
strcmp
(
addr
->
x25_addr
,
null_x25_address
.
x25_addr
))
&&
s
->
state
==
TCP_LISTEN
)
{
s
->
state
==
TCP_LISTEN
)
restore_flags
(
flags
);
break
;
return
s
;
}
}
restore_flags
(
flags
);
restore_flags
(
flags
);
return
NULL
;
return
s
;
}
}
/*
/*
...
@@ -272,15 +263,12 @@ struct sock *x25_find_socket(unsigned int lci, struct x25_neigh *neigh)
...
@@ -272,15 +263,12 @@ struct sock *x25_find_socket(unsigned int lci, struct x25_neigh *neigh)
save_flags
(
flags
);
save_flags
(
flags
);
cli
();
cli
();
for
(
s
=
x25_list
;
s
!=
NULL
;
s
=
s
->
next
)
{
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
if
(
x25_sk
(
s
)
->
lci
==
lci
&&
x25_sk
(
s
)
->
neighbour
==
neigh
)
{
if
(
x25_sk
(
s
)
->
lci
==
lci
&&
x25_sk
(
s
)
->
neighbour
==
neigh
)
restore_flags
(
flags
);
break
;
return
s
;
}
}
restore_flags
(
flags
);
restore_flags
(
flags
);
return
NULL
;
return
s
;
}
}
/*
/*
...
@@ -290,10 +278,11 @@ unsigned int x25_new_lci(struct x25_neigh *neigh)
...
@@ -290,10 +278,11 @@ unsigned int x25_new_lci(struct x25_neigh *neigh)
{
{
unsigned
int
lci
=
1
;
unsigned
int
lci
=
1
;
while
(
x25_find_socket
(
lci
,
neigh
)
!=
NULL
)
{
while
(
x25_find_socket
(
lci
,
neigh
))
lci
++
;
if
(
++
lci
==
4096
)
{
if
(
lci
==
4096
)
return
0
;
lci
=
0
;
}
break
;
}
return
lci
;
return
lci
;
}
}
...
@@ -457,10 +446,13 @@ static struct sock *x25_alloc_socket(void)
...
@@ -457,10 +446,13 @@ static struct sock *x25_alloc_socket(void)
skb_queue_head_init
(
&
x25
->
fragment_queue
);
skb_queue_head_init
(
&
x25
->
fragment_queue
);
skb_queue_head_init
(
&
x25
->
interrupt_in_queue
);
skb_queue_head_init
(
&
x25
->
interrupt_in_queue
);
skb_queue_head_init
(
&
x25
->
interrupt_out_queue
);
skb_queue_head_init
(
&
x25
->
interrupt_out_queue
);
out:
return
sk
;
out:
frees:
sk_free
(
sk
);
return
sk
;
frees:
sk_free
(
sk
);
sk
=
NULL
;
sk
=
NULL
;
decmod:
MOD_DEC_USE_COUNT
;
decmod:
MOD_DEC_USE_COUNT
;
goto
out
;
goto
out
;
}
}
...
@@ -1230,7 +1222,7 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
...
@@ -1230,7 +1222,7 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
len
+=
sprintf
(
buffer
,
"dest_addr src_addr dev lci st vs vr va t t2 t21 t22 t23 Snd-Q Rcv-Q inode
\n
"
);
len
+=
sprintf
(
buffer
,
"dest_addr src_addr dev lci st vs vr va t t2 t21 t22 t23 Snd-Q Rcv-Q inode
\n
"
);
for
(
s
=
x25_list
;
s
!=
NULL
;
s
=
s
->
next
)
{
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
{
x25_cb
*
x25
=
x25_sk
(
s
);
x25_cb
*
x25
=
x25_sk
(
s
);
if
(
!
x25
->
neighbour
||
(
dev
=
x25
->
neighbour
->
dev
)
==
NULL
)
if
(
!
x25
->
neighbour
||
(
dev
=
x25
->
neighbour
->
dev
)
==
NULL
)
...
@@ -1256,7 +1248,7 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
...
@@ -1256,7 +1248,7 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
x25
->
t23
/
HZ
,
x25
->
t23
/
HZ
,
atomic_read
(
&
s
->
wmem_alloc
),
atomic_read
(
&
s
->
wmem_alloc
),
atomic_read
(
&
s
->
rmem_alloc
),
atomic_read
(
&
s
->
rmem_alloc
),
s
->
socket
!=
NULL
?
SOCK_INODE
(
s
->
socket
)
->
i_ino
:
0L
);
s
->
socket
?
SOCK_INODE
(
s
->
socket
)
->
i_ino
:
0L
);
pos
=
begin
+
len
;
pos
=
begin
+
len
;
...
@@ -1274,9 +1266,10 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
...
@@ -1274,9 +1266,10 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
*
start
=
buffer
+
(
offset
-
begin
);
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
len
=
length
;
if
(
len
>
length
)
len
=
length
;
return
(
len
)
;
return
len
;
}
}
struct
net_proto_family
x25_family_ops
=
{
struct
net_proto_family
x25_family_ops
=
{
...
@@ -1310,22 +1303,21 @@ SOCKOPS_WRAP(x25_proto, AF_X25);
...
@@ -1310,22 +1303,21 @@ SOCKOPS_WRAP(x25_proto, AF_X25);
static
struct
packet_type
x25_packet_type
=
{
static
struct
packet_type
x25_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_X25
),
.
type
=
__constant_htons
(
ETH_P_X25
),
.
func
=
x25_lapb_receive_frame
,
.
func
=
x25_lapb_receive_frame
,
};
};
struct
notifier_block
x25_dev_notifier
=
{
struct
notifier_block
x25_dev_notifier
=
{
.
notifier_call
=
x25_device_event
,
.
notifier_call
=
x25_device_event
,
};
};
void
x25_kill_by_neigh
(
struct
x25_neigh
*
neigh
)
void
x25_kill_by_neigh
(
struct
x25_neigh
*
neigh
)
{
{
struct
sock
*
s
;
struct
sock
*
s
;
for
(
s
=
x25_list
;
s
!=
NULL
;
s
=
s
->
next
){
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
if
(
x25_sk
(
s
)
->
neighbour
==
neigh
)
if
(
x25_sk
(
s
)
->
neighbour
==
neigh
)
x25_disconnect
(
s
,
ENETUNREACH
,
0
,
0
);
x25_disconnect
(
s
,
ENETUNREACH
,
0
,
0
);
}
}
}
static
int
__init
x25_init
(
void
)
static
int
__init
x25_init
(
void
)
...
@@ -1353,7 +1345,7 @@ static int __init x25_init(void)
...
@@ -1353,7 +1345,7 @@ static int __init x25_init(void)
* Register any pre existing devices.
* Register any pre existing devices.
*/
*/
read_lock
(
&
dev_base_lock
);
read_lock
(
&
dev_base_lock
);
for
(
dev
=
dev_base
;
dev
!=
NULL
;
dev
=
dev
->
next
)
{
for
(
dev
=
dev_base
;
dev
;
dev
=
dev
->
next
)
{
if
((
dev
->
flags
&
IFF_UP
)
&&
(
dev
->
type
==
ARPHRD_X25
if
((
dev
->
flags
&
IFF_UP
)
&&
(
dev
->
type
==
ARPHRD_X25
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
||
dev
->
type
==
ARPHRD_ETHER
||
dev
->
type
==
ARPHRD_ETHER
...
...
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