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
0d027347
Commit
0d027347
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
83808320
7da34c58
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
120 deletions
+123
-120
net/x25/x25_link.c
net/x25/x25_link.c
+92
-91
net/x25/x25_out.c
net/x25/x25_out.c
+14
-10
net/x25/x25_subr.c
net/x25/x25_subr.c
+9
-9
net/x25/x25_timer.c
net/x25/x25_timer.c
+8
-10
No files found.
net/x25/x25_link.c
View file @
0d027347
/*
/*
* X.25 Packet Layer release 002
* X.25 Packet Layer release 002
*
*
* This is ALPHA test software. This code may break your machine, randomly fail to work with new
* This is ALPHA test software. This code may break your machine,
* releases, misbehave and/or generally screw up. It might even work.
* randomly fail to work with new releases, misbehave and/or generally
* screw up. It might even work.
*
*
* This code REQUIRES 2.1.15 or higher
* This code REQUIRES 2.1.15 or higher
*
*
...
@@ -42,7 +43,7 @@
...
@@ -42,7 +43,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <net/x25.h>
#include <net/x25.h>
static
struct
x25_neigh
*
x25_neigh_list
/* = NULL initially */
;
static
struct
x25_neigh
*
x25_neigh_list
;
/* = NULL initially */
static
void
x25_t20timer_expiry
(
unsigned
long
);
static
void
x25_t20timer_expiry
(
unsigned
long
);
...
@@ -82,7 +83,8 @@ static int x25_t20timer_pending(struct x25_neigh *neigh)
...
@@ -82,7 +83,8 @@ static int x25_t20timer_pending(struct x25_neigh *neigh)
/*
/*
* This handles all restart and diagnostic frames.
* This handles all restart and diagnostic frames.
*/
*/
void
x25_link_control
(
struct
sk_buff
*
skb
,
struct
x25_neigh
*
neigh
,
unsigned
short
frametype
)
void
x25_link_control
(
struct
sk_buff
*
skb
,
struct
x25_neigh
*
neigh
,
unsigned
short
frametype
)
{
{
struct
sk_buff
*
skbn
;
struct
sk_buff
*
skbn
;
int
confirm
;
int
confirm
;
...
@@ -92,7 +94,8 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *neigh, unsigned sho
...
@@ -92,7 +94,8 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *neigh, unsigned sho
confirm
=
!
x25_t20timer_pending
(
neigh
);
confirm
=
!
x25_t20timer_pending
(
neigh
);
x25_stop_t20timer
(
neigh
);
x25_stop_t20timer
(
neigh
);
neigh
->
state
=
X25_LINK_STATE_3
;
neigh
->
state
=
X25_LINK_STATE_3
;
if
(
confirm
)
x25_transmit_restart_confirmation
(
neigh
);
if
(
confirm
)
x25_transmit_restart_confirmation
(
neigh
);
break
;
break
;
case
X25_RESTART_CONFIRMATION
:
case
X25_RESTART_CONFIRMATION
:
...
@@ -101,18 +104,21 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *neigh, unsigned sho
...
@@ -101,18 +104,21 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *neigh, unsigned sho
break
;
break
;
case
X25_DIAGNOSTIC
:
case
X25_DIAGNOSTIC
:
printk
(
KERN_WARNING
"x25: diagnostic #%d - %02X %02X %02X
\n
"
,
skb
->
data
[
3
],
skb
->
data
[
4
],
skb
->
data
[
5
],
skb
->
data
[
6
]);
printk
(
KERN_WARNING
"x25: diagnostic #%d - "
"%02X %02X %02X
\n
"
,
skb
->
data
[
3
],
skb
->
data
[
4
],
skb
->
data
[
5
],
skb
->
data
[
6
]);
break
;
break
;
default:
default:
printk
(
KERN_WARNING
"x25: received unknown %02X with LCI 000
\n
"
,
frametype
);
printk
(
KERN_WARNING
"x25: received unknown %02X "
"with LCI 000
\n
"
,
frametype
);
break
;
break
;
}
}
if
(
neigh
->
state
==
X25_LINK_STATE_3
)
{
if
(
neigh
->
state
==
X25_LINK_STATE_3
)
while
((
skbn
=
skb_dequeue
(
&
neigh
->
queue
))
!=
NULL
)
while
((
skbn
=
skb_dequeue
(
&
neigh
->
queue
))
!=
NULL
)
x25_send_frame
(
skbn
,
neigh
);
x25_send_frame
(
skbn
,
neigh
);
}
}
}
/*
/*
...
@@ -120,20 +126,18 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *neigh, unsigned sho
...
@@ -120,20 +126,18 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *neigh, unsigned sho
*/
*/
void
x25_transmit_restart_request
(
struct
x25_neigh
*
neigh
)
void
x25_transmit_restart_request
(
struct
x25_neigh
*
neigh
)
{
{
struct
sk_buff
*
skb
;
unsigned
char
*
dptr
;
unsigned
char
*
dptr
;
int
len
;
int
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
+
2
;
struct
sk_buff
*
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
);
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
+
2
;
if
(
(
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
))
==
NULL
)
if
(
!
skb
)
return
;
return
;
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
+
2
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
+
2
);
*
dptr
++
=
(
neigh
->
extended
)
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
neigh
->
extended
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
0x00
;
*
dptr
++
=
0x00
;
*
dptr
++
=
X25_RESTART_REQUEST
;
*
dptr
++
=
X25_RESTART_REQUEST
;
*
dptr
++
=
0x00
;
*
dptr
++
=
0x00
;
...
@@ -149,20 +153,18 @@ void x25_transmit_restart_request(struct x25_neigh *neigh)
...
@@ -149,20 +153,18 @@ void x25_transmit_restart_request(struct x25_neigh *neigh)
*/
*/
void
x25_transmit_restart_confirmation
(
struct
x25_neigh
*
neigh
)
void
x25_transmit_restart_confirmation
(
struct
x25_neigh
*
neigh
)
{
{
struct
sk_buff
*
skb
;
unsigned
char
*
dptr
;
unsigned
char
*
dptr
;
int
len
;
int
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
;
struct
sk_buff
*
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
);
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
;
if
(
(
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
))
==
NULL
)
if
(
!
skb
)
return
;
return
;
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
);
*
dptr
++
=
(
neigh
->
extended
)
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
neigh
->
extended
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
0x00
;
*
dptr
++
=
0x00
;
*
dptr
++
=
X25_RESTART_CONFIRMATION
;
*
dptr
++
=
X25_RESTART_CONFIRMATION
;
...
@@ -176,20 +178,18 @@ void x25_transmit_restart_confirmation(struct x25_neigh *neigh)
...
@@ -176,20 +178,18 @@ void x25_transmit_restart_confirmation(struct x25_neigh *neigh)
*/
*/
void
x25_transmit_diagnostic
(
struct
x25_neigh
*
neigh
,
unsigned
char
diag
)
void
x25_transmit_diagnostic
(
struct
x25_neigh
*
neigh
,
unsigned
char
diag
)
{
{
struct
sk_buff
*
skb
;
unsigned
char
*
dptr
;
unsigned
char
*
dptr
;
int
len
;
int
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
+
1
;
struct
sk_buff
*
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
);
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
+
1
;
if
(
!
skb
)
if
((
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
))
==
NULL
)
return
;
return
;
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
+
1
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
+
1
);
*
dptr
++
=
(
neigh
->
extended
)
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
neigh
->
extended
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
0x00
;
*
dptr
++
=
0x00
;
*
dptr
++
=
X25_DIAGNOSTIC
;
*
dptr
++
=
X25_DIAGNOSTIC
;
*
dptr
++
=
diag
;
*
dptr
++
=
diag
;
...
@@ -205,21 +205,20 @@ void x25_transmit_diagnostic(struct x25_neigh *neigh, unsigned char diag)
...
@@ -205,21 +205,20 @@ void x25_transmit_diagnostic(struct x25_neigh *neigh, unsigned char diag)
*/
*/
void
x25_transmit_clear_request
(
struct
x25_neigh
*
neigh
,
unsigned
int
lci
,
unsigned
char
cause
)
void
x25_transmit_clear_request
(
struct
x25_neigh
*
neigh
,
unsigned
int
lci
,
unsigned
char
cause
)
{
{
struct
sk_buff
*
skb
;
unsigned
char
*
dptr
;
unsigned
char
*
dptr
;
int
len
;
int
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
+
2
;
struct
sk_buff
*
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
);
len
=
X25_MAX_L2_LEN
+
X25_STD_MIN_LEN
+
2
;
if
(
(
skb
=
alloc_skb
(
len
,
GFP_ATOMIC
))
==
NULL
)
if
(
!
skb
)
return
;
return
;
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
skb_reserve
(
skb
,
X25_MAX_L2_LEN
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
+
2
);
dptr
=
skb_put
(
skb
,
X25_STD_MIN_LEN
+
2
);
*
dptr
++
=
((
lci
>>
8
)
&
0x0F
)
|
(
neigh
->
extended
)
?
X25_GFI_EXTSEQ
:
X25_GFI_STDSEQ
;
*
dptr
++
=
((
lci
>>
8
)
&
0x0F
)
|
neigh
->
extended
?
X25_GFI_EXTSEQ
:
*
dptr
++
=
((
lci
>>
0
)
&
0xFF
);
X25_GFI_STDSEQ
;
*
dptr
++
=
(
lci
>>
0
)
&
0xFF
;
*
dptr
++
=
X25_CLEAR_REQUEST
;
*
dptr
++
=
X25_CLEAR_REQUEST
;
*
dptr
++
=
cause
;
*
dptr
++
=
cause
;
*
dptr
++
=
0x00
;
*
dptr
++
=
0x00
;
...
@@ -281,10 +280,10 @@ void x25_link_terminated(struct x25_neigh *neigh)
...
@@ -281,10 +280,10 @@ void x25_link_terminated(struct x25_neigh *neigh)
*/
*/
void
x25_link_device_up
(
struct
net_device
*
dev
)
void
x25_link_device_up
(
struct
net_device
*
dev
)
{
{
struct
x25_neigh
*
x25_neigh
;
unsigned
long
flags
;
unsigned
long
flags
;
struct
x25_neigh
*
x25_neigh
=
kmalloc
(
sizeof
(
*
x25_neigh
),
GFP_ATOMIC
);
if
(
(
x25_neigh
=
kmalloc
(
sizeof
(
*
x25_neigh
),
GFP_ATOMIC
))
==
NULL
)
if
(
!
x25_neigh
)
return
;
return
;
skb_queue_head_init
(
&
x25_neigh
->
queue
);
skb_queue_head_init
(
&
x25_neigh
->
queue
);
...
@@ -295,7 +294,13 @@ void x25_link_device_up(struct net_device *dev)
...
@@ -295,7 +294,13 @@ void x25_link_device_up(struct net_device *dev)
x25_neigh
->
dev
=
dev
;
x25_neigh
->
dev
=
dev
;
x25_neigh
->
state
=
X25_LINK_STATE_0
;
x25_neigh
->
state
=
X25_LINK_STATE_0
;
x25_neigh
->
extended
=
0
;
x25_neigh
->
extended
=
0
;
x25_neigh
->
global_facil_mask
=
(
X25_MASK_REVERSE
|
X25_MASK_THROUGHPUT
|
X25_MASK_PACKET_SIZE
|
X25_MASK_WINDOW_SIZE
);
/* enables negotiation */
/*
* Enables negotiation
*/
x25_neigh
->
global_facil_mask
=
X25_MASK_REVERSE
|
X25_MASK_THROUGHPUT
|
X25_MASK_PACKET_SIZE
|
X25_MASK_WINDOW_SIZE
;
x25_neigh
->
t20
=
sysctl_x25_restart_request_timeout
;
x25_neigh
->
t20
=
sysctl_x25_restart_request_timeout
;
save_flags
(
flags
);
cli
();
save_flags
(
flags
);
cli
();
...
@@ -317,23 +322,23 @@ static void x25_remove_neigh(struct x25_neigh *x25_neigh)
...
@@ -317,23 +322,23 @@ static void x25_remove_neigh(struct x25_neigh *x25_neigh)
if
((
s
=
x25_neigh_list
)
==
x25_neigh
)
{
if
((
s
=
x25_neigh_list
)
==
x25_neigh
)
{
x25_neigh_list
=
x25_neigh
->
next
;
x25_neigh_list
=
x25_neigh
->
next
;
restore_flags
(
flags
);
goto
out_kfree_neigh
;
kfree
(
x25_neigh
);
return
;
}
}
while
(
s
!=
NULL
&&
s
->
next
!=
NULL
)
{
while
(
s
&&
s
->
next
)
{
if
(
s
->
next
==
x25_neigh
)
{
if
(
s
->
next
==
x25_neigh
)
{
s
->
next
=
x25_neigh
->
next
;
s
->
next
=
x25_neigh
->
next
;
restore_flags
(
flags
);
goto
out_kfree_neigh
;
kfree
(
x25_neigh
);
return
;
}
}
s
=
s
->
next
;
s
=
s
->
next
;
}
}
out:
restore_flags
(
flags
);
restore_flags
(
flags
);
return
;
out_kfree_neigh:
kfree
(
x25_neigh
);
goto
out
;
}
}
/*
/*
...
@@ -343,11 +348,11 @@ void x25_link_device_down(struct net_device *dev)
...
@@ -343,11 +348,11 @@ void x25_link_device_down(struct net_device *dev)
{
{
struct
x25_neigh
*
neigh
,
*
x25_neigh
=
x25_neigh_list
;
struct
x25_neigh
*
neigh
,
*
x25_neigh
=
x25_neigh_list
;
while
(
x25_neigh
!=
NULL
)
{
while
(
x25_neigh
)
{
neigh
=
x25_neigh
;
neigh
=
x25_neigh
;
x25_neigh
=
x25_neigh
->
next
;
x25_neigh
=
x25_neigh
->
next
;
if
(
neigh
->
dev
==
dev
){
if
(
neigh
->
dev
==
dev
)
{
x25_remove_neigh
(
neigh
);
x25_remove_neigh
(
neigh
);
dev_put
(
dev
);
dev_put
(
dev
);
}
}
...
@@ -359,13 +364,13 @@ void x25_link_device_down(struct net_device *dev)
...
@@ -359,13 +364,13 @@ void x25_link_device_down(struct net_device *dev)
*/
*/
struct
x25_neigh
*
x25_get_neigh
(
struct
net_device
*
dev
)
struct
x25_neigh
*
x25_get_neigh
(
struct
net_device
*
dev
)
{
{
struct
x25_neigh
*
x25_neigh
;
struct
x25_neigh
*
x25_neigh
=
x25_neigh_list
;
for
(
x25_neigh
=
x25_neigh_list
;
x25_neigh
!=
NULL
;
x25_neigh
=
x25_neigh
->
next
)
for
(
;
x25_neigh
;
x25_neigh
=
x25_neigh
->
next
)
if
(
x25_neigh
->
dev
==
dev
)
if
(
x25_neigh
->
dev
==
dev
)
return
x25_neigh
;
break
;
return
NULL
;
return
x25_neigh
;
}
}
/*
/*
...
@@ -376,46 +381,42 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg)
...
@@ -376,46 +381,42 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg)
struct
x25_subscrip_struct
x25_subscr
;
struct
x25_subscrip_struct
x25_subscr
;
struct
x25_neigh
*
x25_neigh
;
struct
x25_neigh
*
x25_neigh
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
int
rc
=
-
EINVAL
;
switch
(
cmd
)
{
if
(
cmd
!=
SIOCX25GSUBSCRIP
&&
cmd
!=
SIOCX25SSUBSCRIP
)
case
SIOCX25GSUBSCRIP
:
goto
out
;
if
(
copy_from_user
(
&
x25_subscr
,
arg
,
sizeof
(
struct
x25_subscrip_struct
)))
return
-
EFAULT
;
rc
=
-
EFAULT
;
if
((
dev
=
x25_dev_get
(
x25_subscr
.
device
))
==
NULL
)
if
(
copy_from_user
(
&
x25_subscr
,
arg
,
sizeof
(
x25_subscr
)))
return
-
EINVAL
;
goto
out
;
if
((
x25_neigh
=
x25_get_neigh
(
dev
))
==
NULL
)
{
dev_put
(
dev
);
rc
=
-
EINVAL
;
return
-
EINVAL
;
if
((
dev
=
x25_dev_get
(
x25_subscr
.
device
))
==
NULL
)
}
goto
out
;
dev_put
(
dev
);
x25_subscr
.
extended
=
x25_neigh
->
extended
;
if
((
x25_neigh
=
x25_get_neigh
(
dev
))
==
NULL
)
x25_subscr
.
global_facil_mask
=
x25_neigh
->
global_facil_mask
;
goto
out_put
;
if
(
copy_to_user
(
arg
,
&
x25_subscr
,
sizeof
(
struct
x25_subscrip_struct
)))
return
-
EFAULT
;
dev_put
(
dev
);
break
;
if
(
cmd
==
SIOCX25GSUBSCRIP
)
{
case
SIOCX25SSUBSCRIP
:
x25_subscr
.
extended
=
x25_neigh
->
extended
;
if
(
copy_from_user
(
&
x25_subscr
,
arg
,
sizeof
(
struct
x25_subscrip_struct
)))
x25_subscr
.
global_facil_mask
=
x25_neigh
->
global_facil_mask
;
return
-
EFAULT
;
rc
=
copy_to_user
(
arg
,
&
x25_subscr
,
if
((
dev
=
x25_dev_get
(
x25_subscr
.
device
))
==
NULL
)
sizeof
(
x25_subscr
))
?
-
EFAULT
:
0
;
return
-
EINVAL
;
}
else
{
if
((
x25_neigh
=
x25_get_neigh
(
dev
))
==
NULL
)
{
rc
=
-
EINVAL
;
dev_put
(
dev
);
if
(
x25_subscr
.
extended
&&
x25_subscr
.
extended
!=
1
)
return
-
EINVAL
;
goto
out
;
}
rc
=
0
;
dev_put
(
dev
);
x25_neigh
->
extended
=
x25_subscr
.
extended
;
if
(
x25_subscr
.
extended
!=
0
&&
x25_subscr
.
extended
!=
1
)
x25_neigh
->
global_facil_mask
=
x25_subscr
.
global_facil_mask
;
return
-
EINVAL
;
x25_neigh
->
extended
=
x25_subscr
.
extended
;
x25_neigh
->
global_facil_mask
=
x25_subscr
.
global_facil_mask
;
break
;
default:
return
-
EINVAL
;
}
}
out:
return
0
;
return
rc
;
out_put:
dev_put
(
dev
);
goto
out
;
}
}
...
@@ -426,7 +427,7 @@ void __exit x25_link_free(void)
...
@@ -426,7 +427,7 @@ void __exit x25_link_free(void)
{
{
struct
x25_neigh
*
neigh
,
*
x25_neigh
=
x25_neigh_list
;
struct
x25_neigh
*
neigh
,
*
x25_neigh
=
x25_neigh_list
;
while
(
x25_neigh
!=
NULL
)
{
while
(
x25_neigh
)
{
neigh
=
x25_neigh
;
neigh
=
x25_neigh
;
x25_neigh
=
x25_neigh
->
next
;
x25_neigh
=
x25_neigh
->
next
;
...
...
net/x25/x25_out.c
View file @
0d027347
/*
/*
* X.25 Packet Layer release 002
* X.25 Packet Layer release 002
*
*
* This is ALPHA test software. This code may break your machine, randomly fail to work with new
* This is ALPHA test software. This code may break your machine,
* releases, misbehave and/or generally screw up. It might even work.
* randomly fail to work with new releases, misbehave and/or generally
* screw up. It might even work.
*
*
* This code REQUIRES 2.1.15 or higher
* This code REQUIRES 2.1.15 or higher
*
*
...
@@ -45,7 +46,7 @@ static int x25_pacsize_to_bytes(unsigned int pacsize)
...
@@ -45,7 +46,7 @@ static int x25_pacsize_to_bytes(unsigned int pacsize)
{
{
int
bytes
=
1
;
int
bytes
=
1
;
if
(
pacsize
==
0
)
if
(
!
pacsize
)
return
128
;
return
128
;
while
(
pacsize
--
>
0
)
while
(
pacsize
--
>
0
)
...
@@ -79,18 +80,21 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
...
@@ -79,18 +80,21 @@ int x25_output(struct sock *sk, struct sk_buff *skb)
frontlen
=
skb_headroom
(
skb
);
frontlen
=
skb_headroom
(
skb
);
while
(
skb
->
len
>
0
)
{
while
(
skb
->
len
>
0
)
{
if
((
skbn
=
sock_alloc_send_skb
(
sk
,
frontlen
+
max_len
,
noblock
,
&
err
))
==
NULL
){
if
((
skbn
=
sock_alloc_send_skb
(
sk
,
frontlen
+
max_len
,
if
(
err
==
-
EWOULDBLOCK
&&
noblock
){
noblock
,
&
err
))
==
NULL
){
if
(
err
==
-
EWOULDBLOCK
&&
noblock
){
kfree_skb
(
skb
);
kfree_skb
(
skb
);
return
sent
;
return
sent
;
}
}
SOCK_DEBUG
(
sk
,
"x25_output: fragment allocation failed, err=%d, %d bytes sent
\n
"
,
err
,
sent
);
SOCK_DEBUG
(
sk
,
"x25_output: fragment alloc"
" failed, err=%d, %d bytes "
"sent
\n
"
,
err
,
sent
);
return
err
;
return
err
;
}
}
skb_reserve
(
skbn
,
frontlen
);
skb_reserve
(
skbn
,
frontlen
);
len
=
(
max_len
>
skb
->
len
)
?
skb
->
len
:
max_len
;
len
=
max_len
>
skb
->
len
?
skb
->
len
:
max_len
;
/* Copy the user data */
/* Copy the user data */
memcpy
(
skb_put
(
skbn
,
len
),
skb
->
data
,
len
);
memcpy
(
skb_put
(
skbn
,
len
),
skb
->
data
,
len
);
...
@@ -127,7 +131,7 @@ static void x25_send_iframe(struct sock *sk, struct sk_buff *skb)
...
@@ -127,7 +131,7 @@ static void x25_send_iframe(struct sock *sk, struct sk_buff *skb)
{
{
x25_cb
*
x25
=
x25_sk
(
sk
);
x25_cb
*
x25
=
x25_sk
(
sk
);
if
(
skb
==
NULL
)
if
(
!
skb
)
return
;
return
;
if
(
x25
->
neighbour
->
extended
)
{
if
(
x25
->
neighbour
->
extended
)
{
...
@@ -168,9 +172,9 @@ void x25_kick(struct sock *sk)
...
@@ -168,9 +172,9 @@ void x25_kick(struct sock *sk)
if
(
skb_peek
(
&
sk
->
write_queue
)
==
NULL
)
if
(
skb_peek
(
&
sk
->
write_queue
)
==
NULL
)
return
;
return
;
modulus
=
(
x25
->
neighbour
->
extended
)
?
X25_EMODULUS
:
X25_SMODULUS
;
modulus
=
x25
->
neighbour
->
extended
?
X25_EMODULUS
:
X25_SMODULUS
;
start
=
(
skb_peek
(
&
x25
->
ack_queue
)
==
NULL
)
?
x25
->
va
:
x25
->
vs
;
start
=
skb_peek
(
&
x25
->
ack_queue
)
?
x25
->
vs
:
x25
->
va
;
end
=
(
x25
->
va
+
x25
->
facilities
.
winsize_out
)
%
modulus
;
end
=
(
x25
->
va
+
x25
->
facilities
.
winsize_out
)
%
modulus
;
if
(
start
==
end
)
if
(
start
==
end
)
...
...
net/x25/x25_subr.c
View file @
0d027347
/*
/*
* X.25 Packet Layer release 002
* X.25 Packet Layer release 002
*
*
* This is ALPHA test software. This code may break your machine, randomly fail to work with new
* This is ALPHA test software. This code may break your machine,
* releases, misbehave and/or generally screw up. It might even work.
* randomly fail to work with new releases, misbehave and/or generally
* screw up. It might even work.
*
*
* This code REQUIRES 2.1.15 or higher
* This code REQUIRES 2.1.15 or higher
*
*
...
@@ -15,7 +16,7 @@
...
@@ -15,7 +16,7 @@
* History
* History
* X.25 001 Jonathan Naylor Started coding.
* X.25 001 Jonathan Naylor Started coding.
* X.25 002 Jonathan Naylor Centralised disconnection processing.
* X.25 002 Jonathan Naylor Centralised disconnection processing.
* mar/20/00 Daniela Squassoni Disabling/enabling of facilities
* mar/20/00 Daniela Squassoni Disabling/enabling of facilities
* negotiation.
* negotiation.
* jun/24/01 Arnaldo C. Melo use skb_queue_purge, cleanups
* jun/24/01 Arnaldo C. Melo use skb_queue_purge, cleanups
*/
*/
...
@@ -88,7 +89,7 @@ void x25_requeue_frames(struct sock *sk)
...
@@ -88,7 +89,7 @@ void x25_requeue_frames(struct sock *sk)
* output queue.
* output queue.
*/
*/
while
((
skb
=
skb_dequeue
(
&
x25_sk
(
sk
)
->
ack_queue
))
!=
NULL
)
{
while
((
skb
=
skb_dequeue
(
&
x25_sk
(
sk
)
->
ack_queue
))
!=
NULL
)
{
if
(
skb_prev
==
NULL
)
if
(
!
skb_prev
)
skb_queue_head
(
&
sk
->
write_queue
,
skb
);
skb_queue_head
(
&
sk
->
write_queue
,
skb
);
else
else
skb_append
(
skb_prev
,
skb
);
skb_append
(
skb_prev
,
skb
);
...
@@ -107,14 +108,15 @@ int x25_validate_nr(struct sock *sk, unsigned short nr)
...
@@ -107,14 +108,15 @@ int x25_validate_nr(struct sock *sk, unsigned short nr)
int
modulus
=
x25
->
neighbour
->
extended
?
X25_EMODULUS
:
X25_SMODULUS
;
int
modulus
=
x25
->
neighbour
->
extended
?
X25_EMODULUS
:
X25_SMODULUS
;
while
(
vc
!=
x25
->
vs
)
{
while
(
vc
!=
x25
->
vs
)
{
if
(
nr
==
vc
)
return
1
;
if
(
nr
==
vc
)
return
1
;
vc
=
(
vc
+
1
)
%
modulus
;
vc
=
(
vc
+
1
)
%
modulus
;
}
}
return
nr
==
x25
->
vs
?
1
:
0
;
return
nr
==
x25
->
vs
?
1
:
0
;
}
}
/*
/*
* This routine is called when the packet layer internally generates a
* This routine is called when the packet layer internally generates a
* control frame.
* control frame.
*/
*/
...
@@ -126,12 +128,10 @@ void x25_write_internal(struct sock *sk, int frametype)
...
@@ -126,12 +128,10 @@ void x25_write_internal(struct sock *sk, int frametype)
unsigned
char
facilities
[
X25_MAX_FAC_LEN
];
unsigned
char
facilities
[
X25_MAX_FAC_LEN
];
unsigned
char
addresses
[
1
+
X25_ADDR_LEN
];
unsigned
char
addresses
[
1
+
X25_ADDR_LEN
];
unsigned
char
lci1
,
lci2
;
unsigned
char
lci1
,
lci2
;
int
len
;
/*
/*
* Default safe frame size.
* Default safe frame size.
*/
*/
len
=
X25_MAX_L2_LEN
+
X25_EXT_MIN_LEN
;
int
len
=
X25_MAX_L2_LEN
+
X25_EXT_MIN_LEN
;
/*
/*
* Adjust frame size.
* Adjust frame size.
...
...
net/x25/x25_timer.c
View file @
0d027347
/*
/*
* X.25 Packet Layer release 002
* X.25 Packet Layer release 002
*
*
* This is ALPHA test software. This code may break your machine, randomly fail to work with new
* This is ALPHA test software. This code may break your machine,
* releases, misbehave and/or generally screw up. It might even work.
* randomly fail to work with new releases, misbehave and/or generally
* screw up. It might even work.
*
*
* This code REQUIRES 2.1.15 or higher
* This code REQUIRES 2.1.15 or higher
*
*
...
@@ -130,9 +131,8 @@ static void x25_heartbeat_expiry(unsigned long param)
...
@@ -130,9 +131,8 @@ static void x25_heartbeat_expiry(unsigned long param)
struct
sock
*
sk
=
(
struct
sock
*
)
param
;
struct
sock
*
sk
=
(
struct
sock
*
)
param
;
bh_lock_sock
(
sk
);
bh_lock_sock
(
sk
);
if
(
sk
->
lock
.
users
)
{
/* can currently only occur in state 3 */
if
(
sk
->
lock
.
users
)
/* can currently only occur in state 3 */
goto
restart_heartbeat
;
goto
restart_heartbeat
;
}
switch
(
x25_sk
(
sk
)
->
state
)
{
switch
(
x25_sk
(
sk
)
->
state
)
{
...
@@ -152,9 +152,9 @@ static void x25_heartbeat_expiry(unsigned long param)
...
@@ -152,9 +152,9 @@ static void x25_heartbeat_expiry(unsigned long param)
x25_check_rbuf
(
sk
);
x25_check_rbuf
(
sk
);
break
;
break
;
}
}
restart_heartbeat:
restart_heartbeat:
x25_start_heartbeat
(
sk
);
x25_start_heartbeat
(
sk
);
unlock:
unlock:
bh_unlock_sock
(
sk
);
bh_unlock_sock
(
sk
);
}
}
...
@@ -194,11 +194,9 @@ static void x25_timer_expiry(unsigned long param)
...
@@ -194,11 +194,9 @@ static void x25_timer_expiry(unsigned long param)
bh_lock_sock
(
sk
);
bh_lock_sock
(
sk
);
if
(
sk
->
lock
.
users
)
{
/* can currently only occur in state 3 */
if
(
sk
->
lock
.
users
)
{
/* can currently only occur in state 3 */
if
(
x25_sk
(
sk
)
->
state
==
X25_STATE_3
)
{
if
(
x25_sk
(
sk
)
->
state
==
X25_STATE_3
)
x25_start_t2timer
(
sk
);
x25_start_t2timer
(
sk
);
}
}
else
}
else
{
x25_do_timer_expiry
(
sk
);
x25_do_timer_expiry
(
sk
);
}
bh_unlock_sock
(
sk
);
bh_unlock_sock
(
sk
);
}
}
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