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
aa3f2b33
Commit
aa3f2b33
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
229e0840
6c546640
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
160 additions
and
112 deletions
+160
-112
net/x25/sysctl_net_x25.c
net/x25/sysctl_net_x25.c
+75
-25
net/x25/x25_in.c
net/x25/x25_in.c
+7
-6
net/x25/x25_route.c
net/x25/x25_route.c
+78
-81
No files found.
net/x25/sysctl_net_x25.c
View file @
aa3f2b33
...
@@ -13,38 +13,88 @@
...
@@ -13,38 +13,88 @@
#include <linux/init.h>
#include <linux/init.h>
#include <net/x25.h>
#include <net/x25.h>
static
int
min_timer
[]
=
{
1
*
HZ
};
static
int
min_timer
[]
=
{
1
*
HZ
};
static
int
max_timer
[]
=
{
300
*
HZ
};
static
int
max_timer
[]
=
{
300
*
HZ
};
static
struct
ctl_table_header
*
x25_table_header
;
static
struct
ctl_table_header
*
x25_table_header
;
static
ctl_table
x25_table
[]
=
{
static
struct
ctl_table
x25_table
[]
=
{
{
NET_X25_RESTART_REQUEST_TIMEOUT
,
"restart_request_timeout"
,
{
&
sysctl_x25_restart_request_timeout
,
sizeof
(
int
),
0644
,
NULL
,
.
ctl_name
=
NET_X25_RESTART_REQUEST_TIMEOUT
,
&
proc_dointvec_minmax
,
&
sysctl_intvec
,
NULL
,
&
min_timer
,
&
max_timer
},
.
procname
=
"restart_request_timeout"
,
{
NET_X25_CALL_REQUEST_TIMEOUT
,
"call_request_timeout"
,
.
data
=
&
sysctl_x25_restart_request_timeout
,
&
sysctl_x25_call_request_timeout
,
sizeof
(
int
),
0644
,
NULL
,
.
maxlen
=
sizeof
(
int
),
&
proc_dointvec_minmax
,
&
sysctl_intvec
,
NULL
,
&
min_timer
,
&
max_timer
},
.
mode
=
0644
,
{
NET_X25_RESET_REQUEST_TIMEOUT
,
"reset_request_timeout"
,
.
proc_handler
=
&
proc_dointvec_minmax
,
&
sysctl_x25_reset_request_timeout
,
sizeof
(
int
),
0644
,
NULL
,
.
strategy
=
&
sysctl_intvec
,
&
proc_dointvec_minmax
,
&
sysctl_intvec
,
NULL
,
&
min_timer
,
&
max_timer
},
.
extra1
=
&
min_timer
,
{
NET_X25_CLEAR_REQUEST_TIMEOUT
,
"clear_request_timeout"
,
.
extra2
=
&
max_timer
,
&
sysctl_x25_clear_request_timeout
,
sizeof
(
int
),
0644
,
NULL
,
},
&
proc_dointvec_minmax
,
&
sysctl_intvec
,
NULL
,
&
min_timer
,
&
max_timer
},
{
{
NET_X25_ACK_HOLD_BACK_TIMEOUT
,
"acknowledgement_hold_back_timeout"
,
.
ctl_name
=
NET_X25_CALL_REQUEST_TIMEOUT
,
&
sysctl_x25_ack_holdback_timeout
,
sizeof
(
int
),
0644
,
NULL
,
.
procname
=
"call_request_timeout"
,
&
proc_dointvec_minmax
,
&
sysctl_intvec
,
NULL
,
&
min_timer
,
&
max_timer
},
.
data
=
&
sysctl_x25_call_request_timeout
,
{
0
}
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_minmax
,
.
strategy
=
&
sysctl_intvec
,
.
extra1
=
&
min_timer
,
.
extra2
=
&
max_timer
,
},
{
.
ctl_name
=
NET_X25_RESET_REQUEST_TIMEOUT
,
.
procname
=
"reset_request_timeout"
,
.
data
=
&
sysctl_x25_reset_request_timeout
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_minmax
,
.
strategy
=
&
sysctl_intvec
,
.
extra1
=
&
min_timer
,
.
extra2
=
&
max_timer
,
},
{
.
ctl_name
=
NET_X25_CLEAR_REQUEST_TIMEOUT
,
.
procname
=
"clear_request_timeout"
,
.
data
=
&
sysctl_x25_clear_request_timeout
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_minmax
,
.
strategy
=
&
sysctl_intvec
,
.
extra1
=
&
min_timer
,
.
extra2
=
&
max_timer
,
},
{
.
ctl_name
=
NET_X25_ACK_HOLD_BACK_TIMEOUT
,
.
procname
=
"acknowledgement_hold_back_timeout"
,
.
data
=
&
sysctl_x25_ack_holdback_timeout
,
.
maxlen
=
sizeof
(
int
),
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_minmax
,
.
strategy
=
&
sysctl_intvec
,
.
extra1
=
&
min_timer
,
.
extra2
=
&
max_timer
,
},
{
0
,
},
};
};
static
ctl_table
x25_dir_table
[]
=
{
static
struct
ctl_table
x25_dir_table
[]
=
{
{
NET_X25
,
"x25"
,
NULL
,
0
,
0555
,
x25_table
},
{
{
0
}
.
ctl_name
=
NET_X25
,
.
procname
=
"x25"
,
.
mode
=
0555
,
.
child
=
x25_table
,
},
{
0
,
},
};
};
static
ctl_table
x25_root_table
[]
=
{
static
struct
ctl_table
x25_root_table
[]
=
{
{
CTL_NET
,
"net"
,
NULL
,
0
,
0555
,
x25_dir_table
},
{
{
0
}
.
ctl_name
=
CTL_NET
,
.
procname
=
"net"
,
.
mode
=
0555
,
.
child
=
x25_dir_table
,
},
{
0
,
},
};
};
void
__init
x25_register_sysctl
(
void
)
void
__init
x25_register_sysctl
(
void
)
...
...
net/x25/x25_in.c
View file @
aa3f2b33
/*
/*
* 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
*
*
...
@@ -86,7 +87,7 @@ static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
...
@@ -86,7 +87,7 @@ static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
skb_set_owner_r
(
skbn
,
sk
);
skb_set_owner_r
(
skbn
,
sk
);
skb_queue_tail
(
&
sk
->
receive_queue
,
skbn
);
skb_queue_tail
(
&
sk
->
receive_queue
,
skbn
);
if
(
!
sk
->
dead
)
if
(
!
sk
->
dead
)
sk
->
data_ready
(
sk
,
skbn
->
len
);
sk
->
data_ready
(
sk
,
skbn
->
len
);
return
0
;
return
0
;
}
}
...
@@ -364,10 +365,10 @@ int x25_process_rx_frame(struct sock *sk, struct sk_buff *skb)
...
@@ -364,10 +365,10 @@ int x25_process_rx_frame(struct sock *sk, struct sk_buff *skb)
int
x25_backlog_rcv
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
int
x25_backlog_rcv
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
int
queued
;
int
queued
=
x25_process_rx_frame
(
sk
,
skb
)
;
queued
=
x25_process_rx_frame
(
sk
,
skb
);
if
(
!
queued
)
if
(
!
queued
)
kfree_skb
(
skb
);
kfree_skb
(
skb
);
return
0
;
return
0
;
}
}
net/x25/x25_route.c
View file @
aa3f2b33
/*
/*
* 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
*
*
...
@@ -43,7 +44,7 @@
...
@@ -43,7 +44,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <net/x25.h>
#include <net/x25.h>
static
struct
x25_route
*
x25_route_list
/* = NULL initially */
;
static
struct
x25_route
*
x25_route_list
;
/* = NULL initially */
/*
/*
* Add a new route.
* Add a new route.
...
@@ -53,13 +54,17 @@ static int x25_add_route(struct x25_address *address, unsigned int sigdigits,
...
@@ -53,13 +54,17 @@ static int x25_add_route(struct x25_address *address, unsigned int sigdigits,
{
{
struct
x25_route
*
x25_route
;
struct
x25_route
*
x25_route
;
unsigned
long
flags
;
unsigned
long
flags
;
int
rc
=
-
EINVAL
;
for
(
x25_route
=
x25_route_list
;
x25_route
!=
NULL
;
x25_route
=
x25_route
->
next
)
for
(
x25_route
=
x25_route_list
;
x25_route
;
x25_route
=
x25_route
->
next
)
if
(
memcmp
(
&
x25_route
->
address
,
address
,
sigdigits
)
==
0
&&
x25_route
->
sigdigits
==
sigdigits
)
if
(
!
memcmp
(
&
x25_route
->
address
,
address
,
sigdigits
)
&&
return
-
EINVAL
;
x25_route
->
sigdigits
==
sigdigits
)
goto
out
;
if
((
x25_route
=
kmalloc
(
sizeof
(
*
x25_route
),
GFP_ATOMIC
))
==
NULL
)
x25_route
=
kmalloc
(
sizeof
(
*
x25_route
),
GFP_ATOMIC
);
return
-
ENOMEM
;
rc
=
-
ENOMEM
;
if
(
!
x25_route
)
goto
out
;
strcpy
(
x25_route
->
address
.
x25_addr
,
"000000000000000"
);
strcpy
(
x25_route
->
address
.
x25_addr
,
"000000000000000"
);
memcpy
(
x25_route
->
address
.
x25_addr
,
address
->
x25_addr
,
sigdigits
);
memcpy
(
x25_route
->
address
.
x25_addr
,
address
->
x25_addr
,
sigdigits
);
...
@@ -71,8 +76,9 @@ static int x25_add_route(struct x25_address *address, unsigned int sigdigits,
...
@@ -71,8 +76,9 @@ static int x25_add_route(struct x25_address *address, unsigned int sigdigits,
x25_route
->
next
=
x25_route_list
;
x25_route
->
next
=
x25_route_list
;
x25_route_list
=
x25_route
;
x25_route_list
=
x25_route
;
restore_flags
(
flags
);
restore_flags
(
flags
);
rc
=
0
;
return
0
;
out:
return
rc
;
}
}
static
void
x25_remove_route
(
struct
x25_route
*
x25_route
)
static
void
x25_remove_route
(
struct
x25_route
*
x25_route
)
...
@@ -86,37 +92,41 @@ static void x25_remove_route(struct x25_route *x25_route)
...
@@ -86,37 +92,41 @@ static void x25_remove_route(struct x25_route *x25_route)
if
((
s
=
x25_route_list
)
==
x25_route
)
{
if
((
s
=
x25_route_list
)
==
x25_route
)
{
x25_route_list
=
x25_route
->
next
;
x25_route_list
=
x25_route
->
next
;
restore_flags
(
flags
);
restore_flags
(
flags
);
kfree
(
x25_route
);
return
;
return
;
}
}
while
(
s
!=
NULL
&&
s
->
next
!=
NULL
)
{
while
(
s
&&
s
->
next
)
{
if
(
s
->
next
==
x25_route
)
{
if
(
s
->
next
==
x25_route
)
{
s
->
next
=
x25_route
->
next
;
s
->
next
=
x25_route
->
next
;
restore_flags
(
flags
);
goto
out_kfree_route
;
kfree
(
x25_route
);
return
;
}
}
s
=
s
->
next
;
s
=
s
->
next
;
}
}
out:
restore_flags
(
flags
);
restore_flags
(
flags
);
return
;
out_kfree_route:
kfree
(
x25_route
);
goto
out
;
}
}
static
int
x25_del_route
(
struct
x25_address
*
address
,
unsigned
int
sigdigits
,
static
int
x25_del_route
(
struct
x25_address
*
address
,
unsigned
int
sigdigits
,
struct
net_device
*
dev
)
struct
net_device
*
dev
)
{
{
struct
x25_route
*
x25_route
;
struct
x25_route
*
x25_route
=
x25_route_list
;
int
rc
=
-
EINVAL
;
for
(
x25_route
=
x25_route_list
;
x25_route
!=
NULL
;
x25_route
=
x25_route
->
next
)
{
for
(;
x25_route
;
x25_route
=
x25_route
->
next
)
if
(
memcmp
(
&
x25_route
->
address
,
address
,
sigdigits
)
==
0
&&
x25_route
->
sigdigits
==
sigdigits
&&
x25_route
->
dev
==
dev
)
{
if
(
!
memcmp
(
&
x25_route
->
address
,
address
,
sigdigits
)
&&
x25_route
->
sigdigits
==
sigdigits
&&
x25_route
->
dev
==
dev
)
{
x25_remove_route
(
x25_route
);
x25_remove_route
(
x25_route
);
return
0
;
rc
=
0
;
break
;
}
}
}
return
-
EINVAL
;
return
rc
;
}
}
/*
/*
...
@@ -126,7 +136,7 @@ void x25_route_device_down(struct net_device *dev)
...
@@ -126,7 +136,7 @@ void x25_route_device_down(struct net_device *dev)
{
{
struct
x25_route
*
route
,
*
x25_route
=
x25_route_list
;
struct
x25_route
*
route
,
*
x25_route
=
x25_route_list
;
while
(
x25_route
!=
NULL
)
{
while
(
x25_route
)
{
route
=
x25_route
;
route
=
x25_route
;
x25_route
=
x25_route
->
next
;
x25_route
=
x25_route
->
next
;
...
@@ -140,21 +150,17 @@ void x25_route_device_down(struct net_device *dev)
...
@@ -140,21 +150,17 @@ void x25_route_device_down(struct net_device *dev)
*/
*/
struct
net_device
*
x25_dev_get
(
char
*
devname
)
struct
net_device
*
x25_dev_get
(
char
*
devname
)
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
=
dev_get_by_name
(
devname
);
if
((
dev
=
dev_get_by_name
(
devname
))
==
NULL
)
return
NULL
;
if
((
dev
->
flags
&
IFF_UP
)
&&
(
dev
->
type
==
ARPHRD_X25
if
(
dev
&&
(
!
(
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
#endif
#endif
))
)))
return
dev
;
dev_put
(
dev
);
dev_put
(
dev
);
return
NULL
;
return
dev
;
}
}
/*
/*
...
@@ -164,18 +170,15 @@ struct net_device *x25_get_route(struct x25_address *addr)
...
@@ -164,18 +170,15 @@ struct net_device *x25_get_route(struct x25_address *addr)
{
{
struct
x25_route
*
route
,
*
use
=
NULL
;
struct
x25_route
*
route
,
*
use
=
NULL
;
for
(
route
=
x25_route_list
;
route
!=
NULL
;
route
=
route
->
next
)
{
for
(
route
=
x25_route_list
;
route
;
route
=
route
->
next
)
if
(
memcmp
(
&
route
->
address
,
addr
,
route
->
sigdigits
)
==
0
)
{
if
(
!
memcmp
(
&
route
->
address
,
addr
,
route
->
sigdigits
))
{
if
(
use
==
NULL
)
{
if
(
!
use
)
use
=
route
;
else
if
(
route
->
sigdigits
>
use
->
sigdigits
)
use
=
route
;
use
=
route
;
}
else
{
if
(
route
->
sigdigits
>
use
->
sigdigits
)
use
=
route
;
}
}
}
}
return
(
use
!=
NULL
)
?
use
->
dev
:
NULL
;
return
use
?
use
->
dev
:
NULL
;
}
}
/*
/*
...
@@ -185,55 +188,48 @@ int x25_route_ioctl(unsigned int cmd, void *arg)
...
@@ -185,55 +188,48 @@ int x25_route_ioctl(unsigned int cmd, void *arg)
{
{
struct
x25_route_struct
x25_route
;
struct
x25_route_struct
x25_route
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
int
err
;
int
rc
=
-
EINVAL
;
switch
(
cmd
)
{
if
(
cmd
!=
SIOCADDRT
&&
cmd
!=
SIOCDELRT
)
goto
out
;
case
SIOCADDRT
:
if
(
copy_from_user
(
&
x25_route
,
arg
,
sizeof
(
struct
x25_route_struct
)))
return
-
EFAULT
;
if
(
x25_route
.
sigdigits
<
0
||
x25_route
.
sigdigits
>
15
)
return
-
EINVAL
;
if
((
dev
=
x25_dev_get
(
x25_route
.
device
))
==
NULL
)
return
-
EINVAL
;
err
=
x25_add_route
(
&
x25_route
.
address
,
x25_route
.
sigdigits
,
dev
);
dev_put
(
dev
);
return
err
;
case
SIOCDELRT
:
if
(
copy_from_user
(
&
x25_route
,
arg
,
sizeof
(
struct
x25_route_struct
)))
return
-
EFAULT
;
if
(
x25_route
.
sigdigits
<
0
||
x25_route
.
sigdigits
>
15
)
return
-
EINVAL
;
if
((
dev
=
x25_dev_get
(
x25_route
.
device
))
==
NULL
)
return
-
EINVAL
;
err
=
x25_del_route
(
&
x25_route
.
address
,
x25_route
.
sigdigits
,
dev
);
dev_put
(
dev
);
return
err
;
default:
return
-
EINVAL
;
}
return
0
;
rc
=
-
EFAULT
;
if
(
copy_from_user
(
&
x25_route
,
arg
,
sizeof
(
x25_route
)))
goto
out
;
rc
=
-
EINVAL
;
if
(
x25_route
.
sigdigits
<
0
||
x25_route
.
sigdigits
>
15
)
goto
out
;
dev
=
x25_dev_get
(
x25_route
.
device
);
if
(
!
dev
)
goto
out
;
if
(
cmd
==
SIOCADDRT
)
rc
=
x25_add_route
(
&
x25_route
.
address
,
x25_route
.
sigdigits
,
dev
);
else
rc
=
x25_del_route
(
&
x25_route
.
address
,
x25_route
.
sigdigits
,
dev
);
dev_put
(
dev
);
out:
return
rc
;
}
}
int
x25_routes_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
int
x25_routes_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
{
{
struct
x25_route
*
x25_route
;
struct
x25_route
*
x25_route
;
int
len
=
0
;
int
len
;
off_t
pos
=
0
;
off_t
pos
=
0
;
off_t
begin
=
0
;
off_t
begin
=
0
;
cli
();
cli
();
len
+
=
sprintf
(
buffer
,
"address digits device
\n
"
);
len
=
sprintf
(
buffer
,
"address digits device
\n
"
);
for
(
x25_route
=
x25_route_list
;
x25_route
!=
NULL
;
x25_route
=
x25_route
->
next
)
{
for
(
x25_route
=
x25_route_list
;
x25_route
;
x25_route
=
x25_route
->
next
)
{
len
+=
sprintf
(
buffer
+
len
,
"%-15s %-6d %-5s
\n
"
,
len
+=
sprintf
(
buffer
+
len
,
"%-15s %-6d %-5s
\n
"
,
x25_route
->
address
.
x25_addr
,
x25_route
->
address
.
x25_addr
,
x25_route
->
sigdigits
,
x25_route
->
sigdigits
,
(
x25_route
->
dev
!=
NULL
)
?
x25_route
->
dev
->
name
:
"???"
);
x25_route
->
dev
?
x25_route
->
dev
->
name
:
"???"
);
pos
=
begin
+
len
;
pos
=
begin
+
len
;
...
@@ -251,7 +247,8 @@ int x25_routes_get_info(char *buffer, char **start, off_t offset, int length)
...
@@ -251,7 +247,8 @@ int x25_routes_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
;
}
}
...
@@ -263,7 +260,7 @@ void __exit x25_route_free(void)
...
@@ -263,7 +260,7 @@ void __exit x25_route_free(void)
{
{
struct
x25_route
*
route
,
*
x25_route
=
x25_route_list
;
struct
x25_route
*
route
,
*
x25_route
=
x25_route_list
;
while
(
x25_route
!=
NULL
)
{
while
(
x25_route
)
{
route
=
x25_route
;
route
=
x25_route
;
x25_route
=
x25_route
->
next
;
x25_route
=
x25_route
->
next
;
...
...
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