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
nexedi
linux
Commits
6b2fb929
Commit
6b2fb929
authored
Sep 27, 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
26cc73d5
92acfab5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
172 additions
and
137 deletions
+172
-137
include/net/x25.h
include/net/x25.h
+29
-9
net/x25/af_x25.c
net/x25/af_x25.c
+21
-19
net/x25/x25_facilities.c
net/x25/x25_facilities.c
+1
-1
net/x25/x25_in.c
net/x25/x25_in.c
+5
-5
net/x25/x25_out.c
net/x25/x25_out.c
+4
-4
net/x25/x25_route.c
net/x25/x25_route.c
+99
-86
net/x25/x25_subr.c
net/x25/x25_subr.c
+7
-7
net/x25/x25_timer.c
net/x25/x25_timer.c
+6
-6
No files found.
include/net/x25.h
View file @
6b2fb929
...
...
@@ -101,16 +101,25 @@ enum {
#define X25_MAX_FAC_LEN 20
/* Plenty to spare */
#define X25_MAX_CUD_LEN 128
/**
* struct x25_route - x25 routing entry
* @node - entry in x25_list_lock
* @address - Start of address range
* @sigdigits - Number of sig digits
* @dev - More than one for MLP
* @refcnt - reference counter
*/
struct
x25_route
{
struct
x25_route
*
next
;
struct
x25_address
address
;
/* Start of address range */
unsigned
int
sigdigits
;
/* Number of sig digits */
struct
net_device
*
dev
;
/* More than one for MLP */
struct
list_head
node
;
struct
x25_address
address
;
unsigned
int
sigdigits
;
struct
net_device
*
dev
;
atomic_t
refcnt
;
};
struct
x25_neigh
{
struct
x25_neigh
*
next
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
unsigned
int
state
;
unsigned
int
extended
;
struct
sk_buff_head
queue
;
...
...
@@ -119,7 +128,7 @@ struct x25_neigh {
unsigned
long
global_facil_mask
;
};
typedef
struc
t
{
struct
x25_op
t
{
struct
x25_address
source_addr
,
dest_addr
;
struct
x25_neigh
*
neighbour
;
unsigned
int
lci
;
...
...
@@ -137,9 +146,9 @@ typedef struct {
struct
x25_facilities
facilities
;
struct
x25_calluserdata
calluserdata
;
unsigned
long
vc_facil_mask
;
/* inc_call facilities mask */
}
x25_cb
;
};
#define x25_sk(__sk) ((
x25_cb
*)(__sk)->protinfo)
#define x25_sk(__sk) ((
struct x25_opt
*)(__sk)->protinfo)
/* af_x25.c */
extern
int
sysctl_x25_restart_request_timeout
;
...
...
@@ -196,13 +205,24 @@ extern void x25_kick(struct sock *);
extern
void
x25_enquiry_response
(
struct
sock
*
);
/* x25_route.c */
extern
struct
net_device
*
x25_get_route
(
struct
x25_address
*
);
extern
struct
x25_route
*
x25_get_route
(
struct
x25_address
*
addr
);
extern
struct
net_device
*
x25_dev_get
(
char
*
);
extern
void
x25_route_device_down
(
struct
net_device
*
);
extern
int
x25_route_ioctl
(
unsigned
int
,
void
*
);
extern
int
x25_routes_get_info
(
char
*
,
char
**
,
off_t
,
int
);
extern
void
x25_route_free
(
void
);
static
__inline__
void
x25_route_hold
(
struct
x25_route
*
rt
)
{
atomic_inc
(
&
rt
->
refcnt
);
}
static
__inline__
void
x25_route_put
(
struct
x25_route
*
rt
)
{
if
(
atomic_dec_and_test
(
&
rt
->
refcnt
))
kfree
(
rt
);
}
/* x25_subr.c */
extern
void
x25_clear_queues
(
struct
sock
*
);
extern
void
x25_frames_acked
(
struct
sock
*
,
unsigned
short
);
...
...
net/x25/af_x25.c
View file @
6b2fb929
...
...
@@ -421,7 +421,7 @@ static int x25_listen(struct socket *sock, int backlog)
static
struct
sock
*
x25_alloc_socket
(
void
)
{
struct
sock
*
sk
;
x25_cb
*
x25
;
struct
x25_opt
*
x25
;
MOD_INC_USE_COUNT
;
...
...
@@ -455,7 +455,7 @@ static struct sock *x25_alloc_socket(void)
static
int
x25_create
(
struct
socket
*
sock
,
int
protocol
)
{
struct
sock
*
sk
;
x25_cb
*
x25
;
struct
x25_opt
*
x25
;
int
rc
=
-
ESOCKTNOSUPPORT
;
if
(
sock
->
type
!=
SOCK_SEQPACKET
||
protocol
)
...
...
@@ -495,7 +495,7 @@ static int x25_create(struct socket *sock, int protocol)
static
struct
sock
*
x25_make_new
(
struct
sock
*
osk
)
{
struct
sock
*
sk
=
NULL
;
x25_cb
*
x25
,
*
ox25
;
struct
x25_opt
*
x25
,
*
ox25
;
if
(
osk
->
type
!=
SOCK_SEQPACKET
)
goto
out
;
...
...
@@ -533,7 +533,7 @@ static struct sock *x25_make_new(struct sock *osk)
static
int
x25_release
(
struct
socket
*
sock
)
{
struct
sock
*
sk
=
sock
->
sk
;
x25_cb
*
x25
;
struct
x25_opt
*
x25
;
if
(
!
sk
)
goto
out
;
...
...
@@ -590,9 +590,9 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
static
int
x25_connect
(
struct
socket
*
sock
,
struct
sockaddr
*
uaddr
,
int
addr_len
,
int
flags
)
{
struct
sock
*
sk
=
sock
->
sk
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
struct
sockaddr_x25
*
addr
=
(
struct
sockaddr_x25
*
)
uaddr
;
struct
net_device
*
dev
;
struct
x25_route
*
rt
;
int
rc
=
0
;
if
(
sk
->
state
==
TCP_ESTABLISHED
&&
sock
->
state
==
SS_CONNECTING
)
{
...
...
@@ -619,23 +619,23 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len
goto
out
;
rc
=
-
ENETUNREACH
;
dev
=
x25_get_route
(
&
addr
->
sx25_addr
);
if
(
!
dev
)
rt
=
x25_get_route
(
&
addr
->
sx25_addr
);
if
(
!
rt
)
goto
out
;
x25
->
neighbour
=
x25_get_neigh
(
dev
);
x25
->
neighbour
=
x25_get_neigh
(
rt
->
dev
);
if
(
!
x25
->
neighbour
)
goto
out
;
goto
out
_put_route
;
x25_limit_facilities
(
&
x25
->
facilities
,
x25
->
neighbour
);
x25
->
lci
=
x25_new_lci
(
x25
->
neighbour
);
if
(
!
x25
->
lci
)
goto
out
;
goto
out
_put_route
;
rc
=
-
EINVAL
;
if
(
sk
->
zapped
)
/* Must bind first - autobinding does not work */
goto
out
;
goto
out
_put_route
;
if
(
!
strcmp
(
x25
->
source_addr
.
x25_addr
,
null_x25_address
.
x25_addr
))
memset
(
&
x25
->
source_addr
,
'\0'
,
X25_ADDR_LEN
);
...
...
@@ -656,7 +656,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len
/* Now the loop */
rc
=
-
EINPROGRESS
;
if
(
sk
->
state
!=
TCP_ESTABLISHED
&&
(
flags
&
O_NONBLOCK
))
goto
out
;
goto
out
_put_route
;
cli
();
/* To avoid races on the sleep */
...
...
@@ -681,6 +681,8 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len
rc
=
0
;
out_unlock:
sti
();
out_put_route:
x25_route_put
(
rt
);
out:
return
rc
;
}
...
...
@@ -741,7 +743,7 @@ static int x25_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_l
{
struct
sockaddr_x25
*
sx25
=
(
struct
sockaddr_x25
*
)
uaddr
;
struct
sock
*
sk
=
sock
->
sk
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
peer
)
{
if
(
sk
->
state
!=
TCP_ESTABLISHED
)
...
...
@@ -760,7 +762,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *neigh, unsigned i
{
struct
sock
*
sk
;
struct
sock
*
make
;
x25_cb
*
makex25
;
struct
x25_opt
*
makex25
;
struct
x25_address
source_addr
,
dest_addr
;
struct
x25_facilities
facilities
;
int
len
,
rc
;
...
...
@@ -858,7 +860,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *neigh, unsigned i
static
int
x25_sendmsg
(
struct
socket
*
sock
,
struct
msghdr
*
msg
,
int
len
,
struct
scm_cookie
*
scm
)
{
struct
sock
*
sk
=
sock
->
sk
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
struct
sockaddr_x25
*
usx25
=
(
struct
sockaddr_x25
*
)
msg
->
msg_name
;
struct
sockaddr_x25
sx25
;
struct
sk_buff
*
skb
;
...
...
@@ -1033,7 +1035,7 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int
flags
,
struct
scm_cookie
*
scm
)
{
struct
sock
*
sk
=
sock
->
sk
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
struct
sockaddr_x25
*
sx25
=
(
struct
sockaddr_x25
*
)
msg
->
msg_name
;
int
copied
,
qbit
;
struct
sk_buff
*
skb
;
...
...
@@ -1119,7 +1121,7 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, int size,
static
int
x25_ioctl
(
struct
socket
*
sock
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
sock
*
sk
=
sock
->
sk
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
int
rc
;
switch
(
cmd
)
{
...
...
@@ -1266,7 +1268,7 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length)
"t t2 t21 t22 t23 Snd-Q Rcv-Q inode
\n
"
);
for
(
s
=
x25_list
;
s
;
s
=
s
->
next
)
{
x25_cb
*
x25
=
x25_sk
(
s
);
struct
x25_opt
*
x25
=
x25_sk
(
s
);
if
(
!
x25
->
neighbour
||
(
dev
=
x25
->
neighbour
->
dev
)
==
NULL
)
devname
=
"???"
;
...
...
net/x25/x25_facilities.c
View file @
6b2fb929
...
...
@@ -172,7 +172,7 @@ int x25_create_facilities(unsigned char *buffer,
int
x25_negotiate_facilities
(
struct
sk_buff
*
skb
,
struct
sock
*
sk
,
struct
x25_facilities
*
new
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
struct
x25_facilities
*
ours
=
&
x25
->
facilities
;
struct
x25_facilities
theirs
;
int
len
;
...
...
net/x25/x25_in.c
View file @
6b2fb929
...
...
@@ -48,7 +48,7 @@
static
int
x25_queue_rx_frame
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
more
)
{
struct
sk_buff
*
skbo
,
*
skbn
=
skb
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
more
)
{
x25
->
fraglen
+=
skb
->
len
;
...
...
@@ -103,7 +103,7 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp
switch
(
frametype
)
{
case
X25_CALL_ACCEPTED
:
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
x25_stop_timer
(
sk
);
x25
->
condition
=
0x00
;
...
...
@@ -179,7 +179,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp
{
int
queued
=
0
;
int
modulus
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
modulus
=
(
x25
->
neighbour
->
extended
)
?
X25_EMODULUS
:
X25_SMODULUS
;
...
...
@@ -308,7 +308,7 @@ static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametyp
case
X25_RESET_REQUEST
:
x25_write_internal
(
sk
,
X25_RESET_CONFIRMATION
);
case
X25_RESET_CONFIRMATION
:
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
x25_stop_timer
(
sk
);
x25
->
condition
=
0x00
;
...
...
@@ -335,7 +335,7 @@ static int x25_state4_machine(struct sock *sk, struct sk_buff *skb, int frametyp
/* Higher level upcall for a LAPB frame */
int
x25_process_rx_frame
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
int
queued
=
0
,
frametype
,
ns
,
nr
,
q
,
d
,
m
;
if
(
x25
->
state
==
X25_STATE_0
)
...
...
net/x25/x25_out.c
View file @
6b2fb929
...
...
@@ -67,7 +67,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
unsigned
char
header
[
X25_EXT_MIN_LEN
];
int
err
,
frontlen
,
len
;
int
sent
=
0
,
noblock
=
X25_SKB_CB
(
skb
)
->
flags
&
MSG_DONTWAIT
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
int
header_len
=
x25
->
neighbour
->
extended
?
X25_EXT_MIN_LEN
:
X25_STD_MIN_LEN
;
int
max_len
=
x25_pacsize_to_bytes
(
x25
->
facilities
.
pacsize_out
);
...
...
@@ -129,7 +129,7 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
*/
static
void
x25_send_iframe
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
!
skb
)
return
;
...
...
@@ -152,7 +152,7 @@ void x25_kick(struct sock *sk)
struct
sk_buff
*
skb
,
*
skbn
;
unsigned
short
start
,
end
;
int
modulus
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
x25
->
state
!=
X25_STATE_3
)
return
;
...
...
@@ -224,7 +224,7 @@ void x25_kick(struct sock *sk)
void
x25_enquiry_response
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
x25
->
condition
&
X25_COND_OWN_RX_BUSY
)
x25_write_internal
(
sk
,
X25_RNR
);
...
...
net/x25/x25_route.c
View file @
6b2fb929
...
...
@@ -44,7 +44,8 @@
#include <linux/init.h>
#include <net/x25.h>
static
struct
x25_route
*
x25_route_list
;
/* = NULL initially */
static
struct
list_head
x25_route_list
=
LIST_HEAD_INIT
(
x25_route_list
);
static
rwlock_t
x25_route_list_lock
=
RW_LOCK_UNLOCKED
;
/*
* Add a new route.
...
...
@@ -52,80 +53,75 @@ static struct x25_route *x25_route_list; /* = NULL initially */
static
int
x25_add_route
(
struct
x25_address
*
address
,
unsigned
int
sigdigits
,
struct
net_device
*
dev
)
{
struct
x25_route
*
x25_route
;
unsigned
long
flags
;
struct
x25_route
*
rt
;
struct
list_head
*
entry
;
int
rc
=
-
EINVAL
;
for
(
x25_route
=
x25_route_list
;
x25_route
;
x25_route
=
x25_route
->
next
)
if
(
!
memcmp
(
&
x25_route
->
address
,
address
,
sigdigits
)
&&
x25_route
->
sigdigits
==
sigdigits
)
write_lock_bh
(
&
x25_route_list_lock
);
list_for_each
(
entry
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
if
(
!
memcmp
(
&
rt
->
address
,
address
,
sigdigits
)
&&
rt
->
sigdigits
==
sigdigits
)
goto
out
;
}
x25_route
=
kmalloc
(
sizeof
(
*
x25_route
),
GFP_ATOMIC
);
rt
=
kmalloc
(
sizeof
(
*
rt
),
GFP_ATOMIC
);
rc
=
-
ENOMEM
;
if
(
!
x25_route
)
if
(
!
rt
)
goto
out
;
strcpy
(
x25_route
->
address
.
x25_addr
,
"000000000000000"
);
memcpy
(
x25_route
->
address
.
x25_addr
,
address
->
x25_addr
,
sigdigits
);
strcpy
(
rt
->
address
.
x25_addr
,
"000000000000000"
);
memcpy
(
rt
->
address
.
x25_addr
,
address
->
x25_addr
,
sigdigits
);
x25_route
->
sigdigits
=
sigdigits
;
x25_route
->
dev
=
dev
;
rt
->
sigdigits
=
sigdigits
;
rt
->
dev
=
dev
;
atomic_set
(
&
rt
->
refcnt
,
1
);
save_flags
(
flags
);
cli
();
x25_route
->
next
=
x25_route_list
;
x25_route_list
=
x25_route
;
restore_flags
(
flags
);
list_add
(
&
rt
->
node
,
&
x25_route_list
);
rc
=
0
;
out:
write_unlock_bh
(
&
x25_route_list_lock
);
return
rc
;
}
static
void
x25_remove_route
(
struct
x25_route
*
x25_route
)
/**
* __x25_remove_route - remove route from x25_route_list
* @rt - route to remove
*
* Remove route from x25_route_list. If it was there.
* Caller must hold x25_route_list_lock.
*/
static
void
__x25_remove_route
(
struct
x25_route
*
rt
)
{
struct
x25_route
*
s
;
unsigned
long
flags
;
save_flags
(
flags
);
cli
();
if
((
s
=
x25_route_list
)
==
x25_route
)
{
x25_route_list
=
x25_route
->
next
;
restore_flags
(
flags
);
return
;
}
while
(
s
&&
s
->
next
)
{
if
(
s
->
next
==
x25_route
)
{
s
->
next
=
x25_route
->
next
;
goto
out_kfree_route
;
}
s
=
s
->
next
;
if
(
rt
->
node
.
next
)
{
list_del
(
&
rt
->
node
);
x25_route_put
(
rt
);
}
out:
restore_flags
(
flags
);
return
;
out_kfree_route:
kfree
(
x25_route
);
goto
out
;
}
static
int
x25_del_route
(
struct
x25_address
*
address
,
unsigned
int
sigdigits
,
struct
net_device
*
dev
)
{
struct
x25_route
*
x25_route
=
x25_route_list
;
struct
x25_route
*
rt
;
struct
list_head
*
entry
;
int
rc
=
-
EINVAL
;
for
(;
x25_route
;
x25_route
=
x25_route
->
next
)
if
(
!
memcmp
(
&
x25_route
->
address
,
address
,
sigdigits
)
&&
x25_route
->
sigdigits
==
sigdigits
&&
x25_route
->
dev
==
dev
)
{
x25_remove_route
(
x25_route
);
write_lock_bh
(
&
x25_route_list_lock
);
list_for_each
(
entry
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
if
(
!
memcmp
(
&
rt
->
address
,
address
,
sigdigits
)
&&
rt
->
sigdigits
==
sigdigits
&&
rt
->
dev
==
dev
)
{
__x25_remove_route
(
rt
);
rc
=
0
;
break
;
}
}
write_unlock_bh
(
&
x25_route_list_lock
);
return
rc
;
}
...
...
@@ -134,15 +130,18 @@ static int x25_del_route(struct x25_address *address, unsigned int sigdigits,
*/
void
x25_route_device_down
(
struct
net_device
*
dev
)
{
struct
x25_route
*
route
,
*
x25_route
=
x25_route_list
;
struct
x25_route
*
rt
;
struct
list_head
*
entry
,
*
tmp
;
while
(
x25_route
)
{
route
=
x25_route
;
x25_route
=
x25_route
->
next
;
write_lock_bh
(
&
x25_route_list_lock
);
if
(
route
->
dev
==
dev
)
x25_remove_route
(
route
);
list_for_each_safe
(
entry
,
tmp
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
if
(
rt
->
dev
==
dev
)
__x25_remove_route
(
rt
);
}
write_unlock_bh
(
&
x25_route_list_lock
);
}
/*
...
...
@@ -163,22 +162,35 @@ struct net_device *x25_dev_get(char *devname)
return
dev
;
}
/*
* Find a device given an X.25 address.
/**
* x25_get_route - Find a route given an X.25 address.
* @addr - address to find a route for
*
* Find a route given an X.25 address.
*/
struct
net_devic
e
*
x25_get_route
(
struct
x25_address
*
addr
)
struct
x25_rout
e
*
x25_get_route
(
struct
x25_address
*
addr
)
{
struct
x25_route
*
route
,
*
use
=
NULL
;
struct
x25_route
*
rt
,
*
use
=
NULL
;
struct
list_head
*
entry
;
for
(
route
=
x25_route_list
;
route
;
route
=
route
->
next
)
if
(
!
memcmp
(
&
route
->
address
,
addr
,
route
->
sigdigits
))
{
read_lock_bh
(
&
x25_route_list_lock
);
list_for_each
(
entry
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
if
(
!
memcmp
(
&
rt
->
address
,
addr
,
rt
->
sigdigits
))
{
if
(
!
use
)
use
=
r
oute
;
else
if
(
r
oute
->
sigdigits
>
use
->
sigdigits
)
use
=
r
oute
;
use
=
r
t
;
else
if
(
r
t
->
sigdigits
>
use
->
sigdigits
)
use
=
r
t
;
}
}
return
use
?
use
->
dev
:
NULL
;
if
(
use
)
x25_route_hold
(
use
);
read_unlock_bh
(
&
x25_route_list_lock
);
return
use
;
}
/*
...
...
@@ -186,7 +198,7 @@ struct net_device *x25_get_route(struct x25_address *addr)
*/
int
x25_route_ioctl
(
unsigned
int
cmd
,
void
*
arg
)
{
struct
x25_route_struct
x25_route
;
struct
x25_route_struct
rt
;
struct
net_device
*
dev
;
int
rc
=
-
EINVAL
;
...
...
@@ -194,21 +206,21 @@ int x25_route_ioctl(unsigned int cmd, void *arg)
goto
out
;
rc
=
-
EFAULT
;
if
(
copy_from_user
(
&
x25_route
,
arg
,
sizeof
(
x25_route
)))
if
(
copy_from_user
(
&
rt
,
arg
,
sizeof
(
rt
)))
goto
out
;
rc
=
-
EINVAL
;
if
(
x25_route
.
sigdigits
<
0
||
x25_route
.
sigdigits
>
15
)
if
(
rt
.
sigdigits
<
0
||
rt
.
sigdigits
>
15
)
goto
out
;
dev
=
x25_dev_get
(
x25_route
.
device
);
dev
=
x25_dev_get
(
rt
.
device
);
if
(
!
dev
)
goto
out
;
if
(
cmd
==
SIOCADDRT
)
rc
=
x25_add_route
(
&
x25_route
.
address
,
x25_route
.
sigdigits
,
dev
);
rc
=
x25_add_route
(
&
rt
.
address
,
rt
.
sigdigits
,
dev
);
else
rc
=
x25_del_route
(
&
x25_route
.
address
,
x25_route
.
sigdigits
,
dev
);
rc
=
x25_del_route
(
&
rt
.
address
,
rt
.
sigdigits
,
dev
);
dev_put
(
dev
);
out:
return
rc
;
...
...
@@ -216,20 +228,20 @@ int x25_route_ioctl(unsigned int cmd, void *arg)
int
x25_routes_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
{
struct
x25_route
*
x25_route
;
int
len
;
struct
x25_route
*
rt
;
struct
list_head
*
entry
;
off_t
pos
=
0
;
off_t
begin
=
0
;
int
len
=
sprintf
(
buffer
,
"address digits device
\n
"
);
cli
();
len
=
sprintf
(
buffer
,
"address digits device
\n
"
);
read_lock_bh
(
&
x25_route_list_lock
);
for
(
x25_route
=
x25_route_list
;
x25_route
;
x25_route
=
x25_route
->
next
)
{
list_for_each
(
entry
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
len
+=
sprintf
(
buffer
+
len
,
"%-15s %-6d %-5s
\n
"
,
x25_route
->
address
.
x25_addr
,
x25_route
->
sigdigits
,
x25_route
->
dev
?
x25_route
->
dev
->
name
:
"???"
);
rt
->
address
.
x25_addr
,
rt
->
sigdigits
,
rt
->
dev
?
rt
->
dev
->
name
:
"???"
);
pos
=
begin
+
len
;
...
...
@@ -242,7 +254,7 @@ int x25_routes_get_info(char *buffer, char **start, off_t offset, int length)
break
;
}
sti
(
);
read_unlock_bh
(
&
x25_route_list_lock
);
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
...
...
@@ -258,12 +270,13 @@ int x25_routes_get_info(char *buffer, char **start, off_t offset, int length)
*/
void
__exit
x25_route_free
(
void
)
{
struct
x25_route
*
route
,
*
x25_route
=
x25_route_list
;
while
(
x25_route
)
{
route
=
x25_route
;
x25_route
=
x25_route
->
next
;
struct
x25_route
*
rt
;
struct
list_head
*
entry
,
*
tmp
;
x25_remove_route
(
route
);
write_lock_bh
(
&
x25_route_list_lock
);
list_for_each_safe
(
entry
,
tmp
,
&
x25_route_list
)
{
rt
=
list_entry
(
entry
,
struct
x25_route
,
node
);
__x25_remove_route
(
rt
);
}
write_unlock_bh
(
&
x25_route_list_lock
);
}
net/x25/x25_subr.c
View file @
6b2fb929
...
...
@@ -47,7 +47,7 @@
*/
void
x25_clear_queues
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
skb_queue_purge
(
&
sk
->
write_queue
);
skb_queue_purge
(
&
x25
->
ack_queue
);
...
...
@@ -65,7 +65,7 @@ void x25_clear_queues(struct sock *sk)
void
x25_frames_acked
(
struct
sock
*
sk
,
unsigned
short
nr
)
{
struct
sk_buff
*
skb
;
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
int
modulus
=
x25
->
neighbour
->
extended
?
X25_EMODULUS
:
X25_SMODULUS
;
/*
...
...
@@ -103,7 +103,7 @@ void x25_requeue_frames(struct sock *sk)
*/
int
x25_validate_nr
(
struct
sock
*
sk
,
unsigned
short
nr
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
unsigned
short
vc
=
x25
->
va
;
int
modulus
=
x25
->
neighbour
->
extended
?
X25_EMODULUS
:
X25_SMODULUS
;
...
...
@@ -122,7 +122,7 @@ int x25_validate_nr(struct sock *sk, unsigned short nr)
*/
void
x25_write_internal
(
struct
sock
*
sk
,
int
frametype
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
struct
sk_buff
*
skb
;
unsigned
char
*
dptr
;
unsigned
char
facilities
[
X25_MAX_FAC_LEN
];
...
...
@@ -262,7 +262,7 @@ void x25_write_internal(struct sock *sk, int frametype)
int
x25_decode
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
*
ns
,
int
*
nr
,
int
*
q
,
int
*
d
,
int
*
m
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
unsigned
char
*
frame
=
skb
->
data
;
*
ns
=
*
nr
=
*
q
=
*
d
=
*
m
=
0
;
...
...
@@ -329,7 +329,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q,
void
x25_disconnect
(
struct
sock
*
sk
,
int
reason
,
unsigned
char
cause
,
unsigned
char
diagnostic
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
x25_clear_queues
(
sk
);
x25_stop_timer
(
sk
);
...
...
@@ -356,7 +356,7 @@ void x25_disconnect(struct sock *sk, int reason, unsigned char cause,
*/
void
x25_check_rbuf
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
atomic_read
(
&
sk
->
rmem_alloc
)
<
(
sk
->
rcvbuf
/
2
)
&&
(
x25
->
condition
&
X25_COND_OWN_RX_BUSY
))
{
...
...
net/x25/x25_timer.c
View file @
6b2fb929
...
...
@@ -61,7 +61,7 @@ void x25_stop_heartbeat(struct sock *sk)
void
x25_start_t2timer
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
...
...
@@ -74,7 +74,7 @@ void x25_start_t2timer(struct sock *sk)
void
x25_start_t21timer
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
...
...
@@ -87,7 +87,7 @@ void x25_start_t21timer(struct sock *sk)
void
x25_start_t22timer
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
...
...
@@ -100,7 +100,7 @@ void x25_start_t22timer(struct sock *sk)
void
x25_start_t23timer
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
del_timer
(
&
x25
->
timer
);
...
...
@@ -118,7 +118,7 @@ void x25_stop_timer(struct sock *sk)
unsigned
long
x25_display_timer
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
if
(
!
timer_pending
(
&
x25
->
timer
))
return
0
;
...
...
@@ -164,7 +164,7 @@ static void x25_heartbeat_expiry(unsigned long param)
*/
static
inline
void
x25_do_timer_expiry
(
struct
sock
*
sk
)
{
x25_cb
*
x25
=
x25_sk
(
sk
);
struct
x25_opt
*
x25
=
x25_sk
(
sk
);
switch
(
x25
->
state
)
{
...
...
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