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
ee45a5d2
Commit
ee45a5d2
authored
Sep 25, 2003
by
Chas Williams
Committed by
David S. Miller
Sep 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATM]: [ioctl][7/8] Use new code for clip (from levon@movementarian.org)
parent
2bd2d053
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
135 deletions
+51
-135
include/net/atmclip.h
include/net/atmclip.h
+0
-22
net/atm/clip.c
net/atm/clip.c
+48
-17
net/atm/ioctl.c
net/atm/ioctl.c
+3
-95
net/atm/protocols.h
net/atm/protocols.h
+0
-1
No files found.
include/net/atmclip.h
View file @
ee45a5d2
...
...
@@ -56,29 +56,7 @@ struct clip_priv {
#ifdef __KERNEL__
struct
atm_clip_ops
{
int
(
*
clip_create
)(
int
number
);
int
(
*
clip_mkip
)(
struct
atm_vcc
*
vcc
,
int
timeout
);
int
(
*
clip_setentry
)(
struct
atm_vcc
*
vcc
,
u32
ip
);
int
(
*
clip_encap
)(
struct
atm_vcc
*
vcc
,
int
mode
);
void
(
*
clip_push
)(
struct
atm_vcc
*
vcc
,
struct
sk_buff
*
skb
);
int
(
*
atm_init_atmarp
)(
struct
atm_vcc
*
vcc
);
struct
module
*
owner
;
};
void
atm_clip_ops_set
(
struct
atm_clip_ops
*
);
#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
int
try_atm_clip_ops
(
void
);
#else
static
inline
int
try_atm_clip_ops
(
void
)
{
return
0
;
}
#endif
extern
struct
neigh_table
*
clip_tbl_hook
;
extern
struct
atm_clip_ops
*
atm_clip_ops
;
#endif
#endif
net/atm/clip.c
View file @
ee45a5d2
...
...
@@ -762,14 +762,51 @@ static int atm_init_atmarp(struct atm_vcc *vcc)
return
0
;
}
static
struct
atm_clip_ops
__atm_clip_ops
=
{
.
clip_create
=
clip_create
,
.
clip_mkip
=
clip_mkip
,
.
clip_setentry
=
clip_setentry
,
.
clip_encap
=
clip_encap
,
.
clip_push
=
clip_push
,
.
atm_init_atmarp
=
atm_init_atmarp
,
.
owner
=
THIS_MODULE
static
int
clip_ioctl
(
struct
socket
*
sock
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
atm_vcc
*
vcc
=
ATM_SD
(
sock
);
int
err
=
0
;
switch
(
cmd
)
{
case
SIOCMKCLIP
:
case
ATMARPD_CTRL
:
case
ATMARP_MKIP
:
case
ATMARP_SETENTRY
:
case
ATMARP_ENCAP
:
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
break
;
default:
return
-
ENOIOCTLCMD
;
}
switch
(
cmd
)
{
case
SIOCMKCLIP
:
err
=
clip_create
(
arg
);
break
;
case
ATMARPD_CTRL
:
err
=
atm_init_atmarp
(
vcc
);
if
(
!
err
)
{
sock
->
state
=
SS_CONNECTED
;
__module_get
(
THIS_MODULE
);
}
break
;
case
ATMARP_MKIP
:
err
=
clip_mkip
(
vcc
,
arg
);
break
;
case
ATMARP_SETENTRY
:
err
=
clip_setentry
(
vcc
,
arg
);
break
;
case
ATMARP_ENCAP
:
err
=
clip_encap
(
vcc
,
arg
);
break
;
}
return
err
;
}
static
struct
atm_ioctl
clip_ioctl_ops
=
{
.
owner
=
THIS_MODULE
,
.
ioctl
=
clip_ioctl
,
};
#ifdef CONFIG_PROC_FS
...
...
@@ -942,13 +979,10 @@ static int arp_seq_open(struct inode *inode, struct file *file)
struct
seq_file
*
seq
;
int
rc
=
-
EAGAIN
;
if
(
!
try_atm_clip_ops
())
goto
out
;
state
=
kmalloc
(
sizeof
(
*
state
),
GFP_KERNEL
);
if
(
!
state
)
{
rc
=
-
ENOMEM
;
goto
out_
put
;
goto
out_
kfree
;
}
rc
=
seq_open
(
file
,
&
arp_seq_ops
);
...
...
@@ -960,8 +994,6 @@ static int arp_seq_open(struct inode *inode, struct file *file)
out:
return
rc
;
out_put:
module_put
(
atm_clip_ops
->
owner
);
out_kfree:
kfree
(
state
);
goto
out
;
...
...
@@ -969,7 +1001,6 @@ static int arp_seq_open(struct inode *inode, struct file *file)
static
int
arp_seq_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
module_put
(
atm_clip_ops
->
owner
);
return
seq_release_private
(
inode
,
file
);
}
...
...
@@ -1004,7 +1035,7 @@ static int __init atm_clip_init(void)
skb_queue_head_init
(
&
clip_tbl
.
proxy_queue
);
clip_tbl_hook
=
&
clip_tbl
;
atm_clip_ops_set
(
&
__atm_clip
_ops
);
register_atm_ioctl
(
&
clip_ioctl
_ops
);
return
0
;
}
...
...
@@ -1015,7 +1046,7 @@ static void __exit atm_clip_exit(void)
remove_proc_entry
(
"arp"
,
atm_proc_root
);
atm_clip_ops_set
(
NULL
);
deregister_atm_ioctl
(
&
clip_ioctl_ops
);
neigh_ifdown
(
&
clip_tbl
,
NULL
);
dev
=
clip_devs
;
...
...
net/atm/ioctl.c
View file @
ee45a5d2
...
...
@@ -15,11 +15,9 @@
#include <linux/sonet.h>
/* for ioctls */
#include <linux/atmsvc.h>
#include <linux/atmmpc.h>
#include <net/atmclip.h>
#include <asm/ioctls.h>
#ifdef CONFIG_ATM_CLIP
#include <net/atmclip.h>
/* for clip_create */
#endif
#include "resources.h"
#include "signaling.h"
/* for WAITING and sigd_attach */
...
...
@@ -63,36 +61,6 @@ EXPORT_SYMBOL(atm_tcp_ops);
#endif
#endif
#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
#include <net/atmclip.h>
struct
atm_clip_ops
*
atm_clip_ops
;
static
DECLARE_MUTEX
(
atm_clip_ops_mutex
);
void
atm_clip_ops_set
(
struct
atm_clip_ops
*
hook
)
{
down
(
&
atm_clip_ops_mutex
);
atm_clip_ops
=
hook
;
up
(
&
atm_clip_ops_mutex
);
}
int
try_atm_clip_ops
(
void
)
{
down
(
&
atm_clip_ops_mutex
);
if
(
atm_clip_ops
&&
try_module_get
(
atm_clip_ops
->
owner
))
{
up
(
&
atm_clip_ops_mutex
);
return
1
;
}
up
(
&
atm_clip_ops_mutex
);
return
0
;
}
#ifdef CONFIG_ATM_CLIP_MODULE
EXPORT_SYMBOL
(
atm_clip_ops
);
EXPORT_SYMBOL
(
try_atm_clip_ops
);
EXPORT_SYMBOL
(
atm_clip_ops_set
);
#endif
#endif
static
DECLARE_MUTEX
(
ioctl_mutex
);
static
LIST_HEAD
(
ioctl_list
);
...
...
@@ -177,68 +145,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if
(
!
error
)
sock
->
state
=
SS_CONNECTED
;
goto
done
;
#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
case
SIOCMKCLIP
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_clip_ops
())
{
error
=
atm_clip_ops
->
clip_create
(
arg
);
module_put
(
atm_clip_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMARPD_CTRL
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
#if defined(CONFIG_ATM_CLIP_MODULE)
if
(
!
atm_clip_ops
)
request_module
(
"clip"
);
#endif
if
(
try_atm_clip_ops
())
{
error
=
atm_clip_ops
->
atm_init_atmarp
(
vcc
);
if
(
!
error
)
sock
->
state
=
SS_CONNECTED
;
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMARP_MKIP
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_clip_ops
())
{
error
=
atm_clip_ops
->
clip_mkip
(
vcc
,
arg
);
module_put
(
atm_clip_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMARP_SETENTRY
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_clip_ops
())
{
error
=
atm_clip_ops
->
clip_setentry
(
vcc
,
arg
);
module_put
(
atm_clip_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMARP_ENCAP
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_clip_ops
())
{
error
=
atm_clip_ops
->
clip_encap
(
vcc
,
arg
);
module_put
(
atm_clip_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
#endif
#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
case
ATMLEC_CTRL
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
...
...
@@ -329,6 +235,8 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if
(
cmd
==
ATMMPC_CTRL
||
cmd
==
ATMMPC_DATA
)
request_module
(
"mpoa"
);
if
(
cmd
==
ATMARPD_CTRL
)
request_module
(
"clip"
);
error
=
-
ENOIOCTLCMD
;
...
...
net/atm/protocols.h
View file @
ee45a5d2
...
...
@@ -11,6 +11,5 @@ void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb);
int
atm_init_aal0
(
struct
atm_vcc
*
vcc
);
/* "raw" AAL0 */
int
atm_init_aal34
(
struct
atm_vcc
*
vcc
);
/* "raw" AAL3/4 transport */
int
atm_init_aal5
(
struct
atm_vcc
*
vcc
);
/* "raw" AAL5 transport */
int
atm_init_atmarp
(
struct
atm_vcc
*
vcc
);
/* ATM ARP */
#endif
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