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
f445a573
Commit
f445a573
authored
Apr 28, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/acme/net-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
8f8495e9
95dcaa76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
353 additions
and
382 deletions
+353
-382
net/ipx/af_ipx.c
net/ipx/af_ipx.c
+353
-382
No files found.
net/ipx/af_ipx.c
View file @
f445a573
...
...
@@ -415,7 +415,7 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
int
is_broadcast
=
!
memcmp
(
ipx
->
ipx_dest
.
node
,
ipx_broadcast_node
,
IPX_NODE_LEN
);
struct
sock
*
s
;
int
r
et
;
int
r
c
;
spin_lock_bh
(
&
intrfc
->
if_sklist_lock
);
s
=
intrfc
->
if_sklist
;
...
...
@@ -431,7 +431,7 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
if
(
copy
)
{
skb1
=
skb_clone
(
skb
,
GFP_ATOMIC
);
r
et
=
-
ENOMEM
;
r
c
=
-
ENOMEM
;
if
(
!
skb1
)
goto
out
;
}
else
{
...
...
@@ -451,10 +451,10 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
if
(
!
copy
)
kfree_skb
(
skb
);
r
et
=
0
;
r
c
=
0
;
out:
spin_unlock_bh
(
&
intrfc
->
if_sklist_lock
);
return
r
et
;
return
r
c
;
}
#else
static
struct
sock
*
ncp_connection_hack
(
struct
ipx_interface
*
intrfc
,
...
...
@@ -497,7 +497,7 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
struct
ipxhdr
*
ipx
=
ipx_hdr
(
skb
);
struct
sock
*
sock1
=
NULL
,
*
sock2
=
NULL
;
struct
sk_buff
*
skb1
=
NULL
,
*
skb2
=
NULL
;
int
r
et
;
int
r
c
;
if
(
intrfc
==
ipx_primary_net
&&
ntohs
(
ipx
->
ipx_dest
.
sock
)
==
0x451
)
sock1
=
ncp_connection_hack
(
intrfc
,
ipx
);
...
...
@@ -528,10 +528,11 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
/*
* If there is nothing to do return. The kfree will cancel any charging.
*/
rc
=
0
;
if
(
!
sock1
&&
!
sock2
)
{
if
(
!
copy
)
kfree_skb
(
skb
);
return
0
;
goto
out
;
}
/*
...
...
@@ -547,9 +548,9 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
else
skb1
=
skb
;
r
et
=
-
ENOMEM
;
r
c
=
-
ENOMEM
;
if
(
!
skb1
)
goto
out
;
goto
out
_put
;
/* Do we need 2 SKBs? */
if
(
sock1
&&
sock2
)
...
...
@@ -560,20 +561,20 @@ static int ipxitf_demux_socket(struct ipx_interface *intrfc,
if
(
sock1
)
ipxitf_def_skb_handler
(
sock1
,
skb1
);
ret
=
-
ENOMEM
;
if
(
!
skb2
)
goto
out
;
goto
out
_put
;
if
(
sock2
)
ipxitf_def_skb_handler
(
sock2
,
skb2
);
r
et
=
0
;
out:
r
c
=
0
;
out
_put
:
if
(
sock1
)
sock_put
(
sock1
);
if
(
sock2
)
sock_put
(
sock2
);
return
ret
;
out:
return
rc
;
}
#endif
/* CONFIG_IPX_INTERN */
...
...
@@ -727,7 +728,7 @@ static int ipxrtr_route_skb(struct sk_buff *skb);
static
int
ipxitf_rcv
(
struct
ipx_interface
*
intrfc
,
struct
sk_buff
*
skb
)
{
struct
ipxhdr
*
ipx
=
ipx_hdr
(
skb
);
int
r
et
=
0
;
int
r
c
=
0
;
ipxitf_hold
(
intrfc
);
...
...
@@ -737,8 +738,8 @@ static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
IPX_SKB_CB
(
skb
)
->
last_hop
.
index
=
-
1
;
if
(
ipx
->
ipx_type
==
IPX_TYPE_PPROP
)
{
r
et
=
ipxitf_pprop
(
intrfc
,
skb
);
if
(
r
et
)
r
c
=
ipxitf_pprop
(
intrfc
,
skb
);
if
(
r
c
)
goto
out_free_skb
;
}
...
...
@@ -756,7 +757,7 @@ static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
if
(
skb
->
pkt_type
==
PACKET_HOST
)
{
skb
=
skb_unshare
(
skb
,
GFP_ATOMIC
);
if
(
skb
)
r
et
=
ipxrtr_route_skb
(
skb
);
r
c
=
ipxrtr_route_skb
(
skb
);
goto
out_intrfc
;
}
...
...
@@ -766,7 +767,7 @@ static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
/* see if we should keep it */
if
(
!
memcmp
(
ipx_broadcast_node
,
ipx
->
ipx_dest
.
node
,
IPX_NODE_LEN
)
||
!
memcmp
(
intrfc
->
if_node
,
ipx
->
ipx_dest
.
node
,
IPX_NODE_LEN
))
{
r
et
=
ipxitf_demux_socket
(
intrfc
,
skb
,
0
);
r
c
=
ipxitf_demux_socket
(
intrfc
,
skb
,
0
);
goto
out_intrfc
;
}
...
...
@@ -775,7 +776,7 @@ static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
kfree_skb
(
skb
);
out_intrfc:
ipxitf_put
(
intrfc
);
return
r
et
;
return
r
c
;
}
static
void
ipxitf_discover_netnum
(
struct
ipx_interface
*
intrfc
,
...
...
@@ -833,7 +834,7 @@ static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
static
int
ipxitf_pprop
(
struct
ipx_interface
*
intrfc
,
struct
sk_buff
*
skb
)
{
struct
ipxhdr
*
ipx
=
ipx_hdr
(
skb
);
int
i
,
r
et
=
-
EINVAL
;
int
i
,
r
c
=
-
EINVAL
;
struct
ipx_interface
*
ifcs
;
char
*
c
;
u32
*
l
;
...
...
@@ -847,7 +848,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
IPX_MAX_PPROP_HOPS
*
sizeof
(
u32
))
goto
out
;
/* are we broadcasting this damn thing? */
r
et
=
0
;
r
c
=
0
;
if
(
!
sysctl_ipx_pprop_broadcasting
)
goto
out
;
/* We do broadcast packet on the IPX_MAX_PPROP_HOPS hop, but we
...
...
@@ -896,7 +897,7 @@ static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
}
spin_unlock_bh
(
&
ipx_interfaces_lock
);
out:
return
r
et
;
return
r
c
;
}
static
void
ipxitf_insert
(
struct
ipx_interface
*
intrfc
)
...
...
@@ -944,24 +945,24 @@ static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum,
static
int
ipxitf_create_internal
(
struct
ipx_interface_definition
*
idef
)
{
struct
ipx_interface
*
intrfc
;
int
r
et
=
-
EEXIST
;
int
r
c
=
-
EEXIST
;
/* Only one primary network allowed */
if
(
ipx_primary_net
)
goto
out
;
/* Must have a valid network number */
r
et
=
-
EADDRNOTAVAIL
;
r
c
=
-
EADDRNOTAVAIL
;
if
(
!
idef
->
ipx_network
)
goto
out
;
intrfc
=
ipxitf_find_using_net
(
idef
->
ipx_network
);
r
et
=
-
EADDRINUSE
;
r
c
=
-
EADDRINUSE
;
if
(
intrfc
)
{
ipxitf_put
(
intrfc
);
goto
out
;
}
intrfc
=
ipxitf_alloc
(
NULL
,
idef
->
ipx_network
,
0
,
NULL
,
1
,
0
);
r
et
=
-
EAGAIN
;
r
c
=
-
EAGAIN
;
if
(
!
intrfc
)
goto
out
;
memcpy
((
char
*
)
&
(
intrfc
->
if_node
),
idef
->
ipx_node
,
IPX_NODE_LEN
);
...
...
@@ -969,28 +970,24 @@ static int ipxitf_create_internal(struct ipx_interface_definition *idef)
ipxitf_hold
(
intrfc
);
ipxitf_insert
(
intrfc
);
r
et
=
ipxitf_add_local_route
(
intrfc
);
r
c
=
ipxitf_add_local_route
(
intrfc
);
ipxitf_put
(
intrfc
);
out:
return
r
et
;
return
r
c
;
}
static
int
ipx_map_frame_type
(
unsigned
char
type
)
{
int
r
et
=
0
;
int
r
c
=
0
;
switch
(
type
)
{
case
IPX_FRAME_ETHERII
:
ret
=
htons
(
ETH_P_IPX
);
break
;
case
IPX_FRAME_8022
:
ret
=
htons
(
ETH_P_802_2
);
break
;
case
IPX_FRAME_SNAP
:
ret
=
htons
(
ETH_P_SNAP
);
break
;
case
IPX_FRAME_8023
:
ret
=
htons
(
ETH_P_802_3
);
break
;
case
IPX_FRAME_ETHERII
:
rc
=
htons
(
ETH_P_IPX
);
break
;
case
IPX_FRAME_8022
:
rc
=
htons
(
ETH_P_802_2
);
break
;
case
IPX_FRAME_SNAP
:
rc
=
htons
(
ETH_P_SNAP
);
break
;
case
IPX_FRAME_8023
:
rc
=
htons
(
ETH_P_802_3
);
break
;
}
return
r
et
;
return
r
c
;
}
static
int
ipxitf_create
(
struct
ipx_interface_definition
*
idef
)
...
...
@@ -999,19 +996,19 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
unsigned
short
dlink_type
=
0
;
struct
datalink_proto
*
datalink
=
NULL
;
struct
ipx_interface
*
intrfc
;
int
err
;
int
rc
;
if
(
idef
->
ipx_special
==
IPX_INTERNAL
)
{
err
=
ipxitf_create_internal
(
idef
);
rc
=
ipxitf_create_internal
(
idef
);
goto
out
;
}
err
=
-
EEXIST
;
rc
=
-
EEXIST
;
if
(
idef
->
ipx_special
==
IPX_PRIMARY
&&
ipx_primary_net
)
goto
out
;
intrfc
=
ipxitf_find_using_net
(
idef
->
ipx_network
);
err
=
-
EADDRINUSE
;
rc
=
-
EADDRINUSE
;
if
(
idef
->
ipx_network
&&
intrfc
)
{
ipxitf_put
(
intrfc
);
goto
out
;
...
...
@@ -1021,7 +1018,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
ipxitf_put
(
intrfc
);
dev
=
dev_get_by_name
(
idef
->
ipx_device
);
err
=
-
ENODEV
;
rc
=
-
ENODEV
;
if
(
!
dev
)
goto
out
;
...
...
@@ -1040,8 +1037,8 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
datalink
=
pEII_datalink
;
break
;
}
else
printk
(
KERN_WARNING
"IPX frame type EtherII
"
"
over
token-ring is obsolete. Use SNAP "
printk
(
KERN_WARNING
"IPX frame type EtherII over
"
"token-ring is obsolete. Use SNAP "
"instead.
\n
"
);
/* fall through */
case
IPX_FRAME_SNAP
:
...
...
@@ -1054,16 +1051,16 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
break
;
case
IPX_FRAME_NONE
:
default:
err
=
-
EPROTONOSUPPORT
;
rc
=
-
EPROTONOSUPPORT
;
goto
out_dev
;
}
err
=
-
ENETDOWN
;
rc
=
-
ENETDOWN
;
if
(
!
(
dev
->
flags
&
IFF_UP
))
goto
out_dev
;
/* Check addresses are suitable */
err
=
-
EINVAL
;
rc
=
-
EINVAL
;
if
(
dev
->
addr_len
>
IPX_NODE_LEN
)
goto
out_dev
;
...
...
@@ -1073,7 +1070,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
intrfc
=
ipxitf_alloc
(
dev
,
idef
->
ipx_network
,
dlink_type
,
datalink
,
0
,
dev
->
hard_header_len
+
datalink
->
header_length
);
err
=
-
EAGAIN
;
rc
=
-
EAGAIN
;
if
(
!
intrfc
)
goto
out_dev
;
/* Setup primary if necessary */
...
...
@@ -1092,18 +1089,18 @@ static int ipxitf_create(struct ipx_interface_definition *idef)
/* If the network number is known, add a route */
err
=
0
;
rc
=
0
;
if
(
!
intrfc
->
if_netnum
)
goto
out_intrfc
;
err
=
ipxitf_add_local_route
(
intrfc
);
rc
=
ipxitf_add_local_route
(
intrfc
);
out_intrfc:
ipxitf_put
(
intrfc
);
goto
out
;
out_dev:
dev_put
(
dev
);
out:
return
err
;
return
rc
;
}
static
int
ipxitf_delete
(
struct
ipx_interface_definition
*
idef
)
...
...
@@ -1111,7 +1108,7 @@ static int ipxitf_delete(struct ipx_interface_definition *idef)
struct
net_device
*
dev
=
NULL
;
unsigned
short
dlink_type
=
0
;
struct
ipx_interface
*
intrfc
;
int
r
et
=
0
;
int
r
c
=
0
;
spin_lock_bh
(
&
ipx_interfaces_lock
);
if
(
idef
->
ipx_special
==
IPX_INTERNAL
)
{
...
...
@@ -1119,30 +1116,30 @@ static int ipxitf_delete(struct ipx_interface_definition *idef)
__ipxitf_put
(
ipx_internal_net
);
goto
out
;
}
r
et
=
-
ENOENT
;
r
c
=
-
ENOENT
;
goto
out
;
}
dlink_type
=
ipx_map_frame_type
(
idef
->
ipx_dlink_type
);
r
et
=
-
EPROTONOSUPPORT
;
r
c
=
-
EPROTONOSUPPORT
;
if
(
!
dlink_type
)
goto
out
;
dev
=
__dev_get_by_name
(
idef
->
ipx_device
);
r
et
=
-
ENODEV
;
r
c
=
-
ENODEV
;
if
(
!
dev
)
goto
out
;
intrfc
=
__ipxitf_find_using_phys
(
dev
,
dlink_type
);
r
et
=
-
EINVAL
;
r
c
=
-
EINVAL
;
if
(
!
intrfc
)
goto
out
;
__ipxitf_put
(
intrfc
);
r
et
=
0
;
r
c
=
0
;
out:
spin_unlock_bh
(
&
ipx_interfaces_lock
);
return
r
et
;
return
r
c
;
}
static
struct
ipx_interface
*
ipxitf_auto_create
(
struct
net_device
*
dev
,
...
...
@@ -1159,24 +1156,11 @@ static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
goto
out
;
switch
(
htons
(
dlink_type
))
{
case
ETH_P_IPX
:
datalink
=
pEII_datalink
;
break
;
case
ETH_P_802_2
:
datalink
=
p8022_datalink
;
break
;
case
ETH_P_SNAP
:
datalink
=
pSNAP_datalink
;
break
;
case
ETH_P_802_3
:
datalink
=
p8023_datalink
;
break
;
default:
goto
out
;
case
ETH_P_IPX
:
datalink
=
pEII_datalink
;
break
;
case
ETH_P_802_2
:
datalink
=
p8022_datalink
;
break
;
case
ETH_P_SNAP
:
datalink
=
pSNAP_datalink
;
break
;
case
ETH_P_802_3
:
datalink
=
p8023_datalink
;
break
;
default:
goto
out
;
}
intrfc
=
ipxitf_alloc
(
dev
,
0
,
dlink_type
,
datalink
,
0
,
...
...
@@ -1198,6 +1182,7 @@ static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
static
int
ipxitf_ioctl
(
unsigned
int
cmd
,
void
*
arg
)
{
int
rc
=
-
EINVAL
;
struct
ifreq
ifr
;
int
val
;
...
...
@@ -1206,13 +1191,13 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg)
struct
sockaddr_ipx
*
sipx
;
struct
ipx_interface_definition
f
;
rc
=
-
EFAULT
;
if
(
copy_from_user
(
&
ifr
,
arg
,
sizeof
(
ifr
)))
return
-
EFAULT
;
break
;
sipx
=
(
struct
sockaddr_ipx
*
)
&
ifr
.
ifr_addr
;
rc
=
-
EINVAL
;
if
(
sipx
->
sipx_family
!=
AF_IPX
)
return
-
EINVAL
;
break
;
f
.
ipx_network
=
sipx
->
sipx_network
;
memcpy
(
f
.
ipx_device
,
ifr
.
ifr_name
,
sizeof
(
f
.
ipx_device
));
...
...
@@ -1221,57 +1206,58 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg)
f
.
ipx_special
=
sipx
->
sipx_special
;
if
(
sipx
->
sipx_action
==
IPX_DLTITF
)
return
ipxitf_delete
(
&
f
);
rc
=
ipxitf_delete
(
&
f
);
else
return
ipxitf_create
(
&
f
);
rc
=
ipxitf_create
(
&
f
);
break
;
}
case
SIOCGIFADDR
:
{
int
err
=
0
;
struct
sockaddr_ipx
*
sipx
;
struct
ipx_interface
*
ipxif
;
struct
net_device
*
dev
;
rc
=
-
EFAULT
;
if
(
copy_from_user
(
&
ifr
,
arg
,
sizeof
(
ifr
)))
return
-
EFAULT
;
break
;
sipx
=
(
struct
sockaddr_ipx
*
)
&
ifr
.
ifr_addr
;
dev
=
__dev_get_by_name
(
ifr
.
ifr_name
);
rc
=
-
ENODEV
;
if
(
!
dev
)
return
-
ENODEV
;
ipxif
=
ipxitf_find_using_phys
(
dev
,
ipx_map_frame_type
(
sipx
->
sipx_type
));
break
;
ipxif
=
ipxitf_find_using_phys
(
dev
,
ipx_map_frame_type
(
sipx
->
sipx_type
));
rc
=
-
EADDRNOTAVAIL
;
if
(
!
ipxif
)
return
-
EADDRNOTAVAIL
;
break
;
sipx
->
sipx_family
=
AF_IPX
;
sipx
->
sipx_network
=
ipxif
->
if_netnum
;
memcpy
(
sipx
->
sipx_node
,
ipxif
->
if_node
,
sizeof
(
sipx
->
sipx_node
));
rc
=
-
EFAULT
;
if
(
copy_to_user
(
arg
,
&
ifr
,
sizeof
(
ifr
)))
err
=
-
EFAULT
;
break
;
ipxitf_put
(
ipxif
);
return
err
;
rc
=
0
;
break
;
}
case
SIOCAIPXITFCRT
:
rc
=
-
EFAULT
;
if
(
get_user
(
val
,
(
unsigned
char
*
)
arg
))
return
-
EFAULT
;
break
;
rc
=
0
;
ipxcfg_auto_create_interfaces
=
val
;
break
;
case
SIOCAIPXPRISLT
:
rc
=
-
EFAULT
;
if
(
get_user
(
val
,
(
unsigned
char
*
)
arg
))
return
-
EFAULT
;
break
;
rc
=
0
;
ipxcfg_set_auto_select
(
val
);
break
;
default:
return
-
EINVAL
;
}
return
0
;
return
rc
;
}
/* Routing tables for the IPX socket layer. */
...
...
@@ -1307,13 +1293,13 @@ static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
unsigned
char
*
node
)
{
struct
ipx_route
*
rt
;
int
r
et
;
int
r
c
;
/* Get a route structure; either existing or create */
rt
=
ipxrtr_lookup
(
network
);
if
(
!
rt
)
{
rt
=
kmalloc
(
sizeof
(
*
rt
),
GFP_ATOMIC
);
r
et
=
-
EAGAIN
;
r
c
=
-
EAGAIN
;
if
(
!
rt
)
goto
out
;
...
...
@@ -1324,7 +1310,7 @@ static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
ipx_routes
=
rt
;
write_unlock_bh
(
&
ipx_routes_lock
);
}
else
{
r
et
=
-
EEXIST
;
r
c
=
-
EEXIST
;
if
(
intrfc
==
ipx_internal_net
)
goto
out_put
;
}
...
...
@@ -1339,11 +1325,11 @@ static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
rt
->
ir_routed
=
1
;
}
r
et
=
0
;
r
c
=
0
;
out_put:
ipxrtr_put
(
rt
);
out:
return
r
et
;
return
r
c
;
}
static
void
ipxrtr_del_routes
(
struct
ipx_interface
*
intrfc
)
...
...
@@ -1364,44 +1350,44 @@ static void ipxrtr_del_routes(struct ipx_interface *intrfc)
static
int
ipxrtr_create
(
struct
ipx_route_definition
*
rd
)
{
struct
ipx_interface
*
intrfc
;
int
r
et
=
-
ENETUNREACH
;
int
r
c
=
-
ENETUNREACH
;
/* Find the appropriate interface */
intrfc
=
ipxitf_find_using_net
(
rd
->
ipx_router_network
);
if
(
!
intrfc
)
goto
out
;
r
et
=
ipxrtr_add_route
(
rd
->
ipx_network
,
intrfc
,
rd
->
ipx_router_node
);
r
c
=
ipxrtr_add_route
(
rd
->
ipx_network
,
intrfc
,
rd
->
ipx_router_node
);
ipxitf_put
(
intrfc
);
out:
return
r
et
;
return
r
c
;
}
static
int
ipxrtr_delete
(
long
net
)
{
struct
ipx_route
**
r
;
struct
ipx_route
*
tmp
;
int
err
;
int
rc
;
write_lock_bh
(
&
ipx_routes_lock
);
for
(
r
=
&
ipx_routes
;
(
tmp
=
*
r
)
!=
NULL
;)
{
if
(
tmp
->
ir_net
==
net
)
{
/* Directly connected; can't lose route */
err
=
-
EPERM
;
rc
=
-
EPERM
;
if
(
!
tmp
->
ir_routed
)
goto
out
;
*
r
=
tmp
->
ir_next
;
ipxrtr_put
(
tmp
);
err
=
0
;
rc
=
0
;
goto
out
;
}
r
=
&
(
tmp
->
ir_next
);
}
err
=
-
ENOENT
;
rc
=
-
ENOENT
;
out:
write_unlock_bh
(
&
ipx_routes_lock
);
return
err
;
return
rc
;
}
/*
...
...
@@ -1456,7 +1442,7 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
int
size
;
int
ipx_offset
;
struct
ipx_route
*
rt
=
NULL
;
int
err
;
int
rc
;
/* Find the appropriate interface on which to send packet */
if
(
!
usipx
->
sipx_network
&&
ipx_primary_net
)
{
...
...
@@ -1464,7 +1450,7 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
intrfc
=
ipx_primary_net
;
}
else
{
rt
=
ipxrtr_lookup
(
usipx
->
sipx_network
);
err
=
-
ENETUNREACH
;
rc
=
-
ENETUNREACH
;
if
(
!
rt
)
goto
out
;
intrfc
=
rt
->
ir_intrfc
;
...
...
@@ -1474,7 +1460,7 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
ipx_offset
=
intrfc
->
if_ipx_offset
;
size
=
sizeof
(
struct
ipxhdr
)
+
len
+
ipx_offset
;
skb
=
sock_alloc_send_skb
(
sk
,
size
,
noblock
,
&
err
);
skb
=
sock_alloc_send_skb
(
sk
,
size
,
noblock
,
&
rc
);
if
(
!
skb
)
goto
out_put
;
...
...
@@ -1493,8 +1479,8 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
IPX_SKB_CB
(
skb
)
->
ipx_source_net
=
ipxs
->
intrfc
->
if_netnum
;
memcpy
(
ipx
->
ipx_source
.
node
,
ipxs
->
node
,
IPX_NODE_LEN
);
#else
err
=
ntohs
(
ipxs
->
port
);
if
(
err
==
0x453
||
err
==
0x452
)
{
rc
=
ntohs
(
ipxs
->
port
);
if
(
rc
==
0x453
||
rc
==
0x452
)
{
/* RIP/SAP special handling for mars_nwe */
IPX_SKB_CB
(
skb
)
->
ipx_source_net
=
intrfc
->
if_netnum
;
memcpy
(
ipx
->
ipx_source
.
node
,
intrfc
->
if_node
,
IPX_NODE_LEN
);
...
...
@@ -1509,8 +1495,8 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
memcpy
(
ipx
->
ipx_dest
.
node
,
usipx
->
sipx_node
,
IPX_NODE_LEN
);
ipx
->
ipx_dest
.
sock
=
usipx
->
sipx_port
;
err
=
memcpy_fromiovec
(
skb_put
(
skb
,
len
),
iov
,
len
);
if
(
err
)
{
rc
=
memcpy_fromiovec
(
skb_put
(
skb
,
len
),
iov
,
len
);
if
(
rc
)
{
kfree_skb
(
skb
);
goto
out_put
;
}
...
...
@@ -1521,14 +1507,14 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
else
ipx
->
ipx_checksum
=
ipx_cksum
(
ipx
,
len
+
sizeof
(
struct
ipxhdr
));
err
=
ipxitf_send
(
intrfc
,
skb
,
(
rt
&&
rt
->
ir_routed
)
?
rc
=
ipxitf_send
(
intrfc
,
skb
,
(
rt
&&
rt
->
ir_routed
)
?
rt
->
ir_router_node
:
ipx
->
ipx_dest
.
node
);
out_put:
ipxitf_put
(
intrfc
);
if
(
rt
)
ipxrtr_put
(
rt
);
out:
return
err
;
return
rc
;
}
/* the skb has to be unshared, we'll end up calling ipxitf_send, that'll
...
...
@@ -1559,7 +1545,7 @@ static int ipxrtr_ioctl(unsigned int cmd, void *arg)
{
struct
rtentry
rt
;
/* Use these to behave like 'other' stacks */
struct
sockaddr_ipx
*
sg
,
*
st
;
int
r
et
=
-
EFAULT
;
int
r
c
=
-
EFAULT
;
if
(
copy_from_user
(
&
rt
,
arg
,
sizeof
(
rt
)))
goto
out
;
...
...
@@ -1567,7 +1553,7 @@ static int ipxrtr_ioctl(unsigned int cmd, void *arg)
sg
=
(
struct
sockaddr_ipx
*
)
&
rt
.
rt_gateway
;
st
=
(
struct
sockaddr_ipx
*
)
&
rt
.
rt_dst
;
r
et
=
-
EINVAL
;
r
c
=
-
EINVAL
;
if
(
!
(
rt
.
rt_flags
&
RTF_GATEWAY
)
||
/* Direct routes are fixed */
sg
->
sipx_family
!=
AF_IPX
||
st
->
sipx_family
!=
AF_IPX
)
...
...
@@ -1575,35 +1561,35 @@ static int ipxrtr_ioctl(unsigned int cmd, void *arg)
switch
(
cmd
)
{
case
SIOCDELRT
:
ret
=
ipxrtr_delete
(
st
->
sipx_network
);
rc
=
ipxrtr_delete
(
st
->
sipx_network
);
break
;
case
SIOCADDRT
:
{
struct
ipx_route_definition
f
;
f
.
ipx_network
=
st
->
sipx_network
;
f
.
ipx_router_network
=
sg
->
sipx_network
;
memcpy
(
f
.
ipx_router_node
,
sg
->
sipx_node
,
IPX_NODE_LEN
);
ret
=
ipxrtr_create
(
&
f
);
rc
=
ipxrtr_create
(
&
f
);
break
;
}
}
out:
return
r
et
;
return
r
c
;
}
const
char
*
ipx_frame_name
(
unsigned
short
frame
)
{
char
*
r
et
=
"None"
;
char
*
r
c
=
"None"
;
switch
(
ntohs
(
frame
))
{
case
ETH_P_IPX
:
ret
=
"EtherII"
;
break
;
case
ETH_P_802_2
:
ret
=
"802.2"
;
break
;
case
ETH_P_SNAP
:
ret
=
"SNAP"
;
break
;
case
ETH_P_802_3
:
ret
=
"802.3"
;
break
;
case
ETH_P_TR_802_2
:
ret
=
"802.2TR"
;
break
;
case
ETH_P_IPX
:
rc
=
"EtherII"
;
break
;
case
ETH_P_802_2
:
rc
=
"802.2"
;
break
;
case
ETH_P_SNAP
:
rc
=
"SNAP"
;
break
;
case
ETH_P_802_3
:
rc
=
"802.3"
;
break
;
case
ETH_P_TR_802_2
:
rc
=
"802.2TR"
;
break
;
}
return
r
et
;
return
r
c
;
}
const
char
*
ipx_device_name
(
struct
ipx_interface
*
intrfc
)
...
...
@@ -1620,23 +1606,23 @@ static int ipx_setsockopt(struct socket *sock, int level, int optname,
{
struct
sock
*
sk
=
sock
->
sk
;
int
opt
;
int
r
et
=
-
EINVAL
;
int
r
c
=
-
EINVAL
;
if
(
optlen
!=
sizeof
(
int
))
goto
out
;
r
et
=
-
EFAULT
;
r
c
=
-
EFAULT
;
if
(
get_user
(
opt
,
(
unsigned
int
*
)
optval
))
goto
out
;
r
et
=
-
ENOPROTOOPT
;
r
c
=
-
ENOPROTOOPT
;
if
(
!
(
level
==
SOL_IPX
&&
optname
==
IPX_TYPE
))
goto
out
;
ipx_sk
(
sk
)
->
type
=
opt
;
r
et
=
0
;
r
c
=
0
;
out:
return
r
et
;
return
r
c
;
}
static
int
ipx_getsockopt
(
struct
socket
*
sock
,
int
level
,
int
optname
,
...
...
@@ -1645,41 +1631,41 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
struct
sock
*
sk
=
sock
->
sk
;
int
val
=
0
;
int
len
;
int
r
et
=
-
ENOPROTOOPT
;
int
r
c
=
-
ENOPROTOOPT
;
if
(
!
(
level
==
SOL_IPX
&&
optname
==
IPX_TYPE
))
goto
out
;
val
=
ipx_sk
(
sk
)
->
type
;
r
et
=
-
EFAULT
;
r
c
=
-
EFAULT
;
if
(
get_user
(
len
,
optlen
))
goto
out
;
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
int
));
r
et
=
-
EINVAL
;
r
c
=
-
EINVAL
;
if
(
len
<
0
)
goto
out
;
r
et
=
-
EFAULT
;
r
c
=
-
EFAULT
;
if
(
put_user
(
len
,
optlen
)
||
copy_to_user
(
optval
,
&
val
,
len
))
goto
out
;
r
et
=
0
;
r
c
=
0
;
out:
return
r
et
;
return
r
c
;
}
static
int
ipx_create
(
struct
socket
*
sock
,
int
protocol
)
{
int
r
et
=
-
ESOCKTNOSUPPORT
;
int
r
c
=
-
ESOCKTNOSUPPORT
;
struct
ipx_opt
*
ipx
=
NULL
;
struct
sock
*
sk
;
switch
(
sock
->
type
)
{
case
SOCK_DGRAM
:
sk
=
sk_alloc
(
PF_IPX
,
GFP_KERNEL
,
1
,
NULL
);
ret
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
if
(
!
sk
)
goto
out
;
ipx
=
ipx_sk
(
sk
)
=
kmalloc
(
sizeof
(
*
ipx
),
GFP_KERNEL
);
...
...
@@ -1688,7 +1674,6 @@ static int ipx_create(struct socket *sock, int protocol)
memset
(
ipx
,
0
,
sizeof
(
*
ipx
));
sock
->
ops
=
&
ipx_dgram_ops
;
break
;
case
SOCK_SEQPACKET
:
/*
* SPX support is not anymore in the kernel sources. If
...
...
@@ -1707,9 +1692,9 @@ static int ipx_create(struct socket *sock, int protocol)
#endif
sock_init_data
(
sock
,
sk
);
sk
->
no_check
=
1
;
/* Checksum off by default */
r
et
=
0
;
r
c
=
0
;
out:
return
r
et
;
return
r
c
;
outsk:
sk_free
(
sk
);
goto
out
;
...
...
@@ -1761,25 +1746,25 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
struct
ipx_opt
*
ipxs
=
ipx_sk
(
sk
);
struct
ipx_interface
*
intrfc
;
struct
sockaddr_ipx
*
addr
=
(
struct
sockaddr_ipx
*
)
uaddr
;
int
r
et
=
-
EINVAL
;
int
r
c
=
-
EINVAL
;
if
(
!
sk
->
zapped
||
addr_len
!=
sizeof
(
struct
sockaddr_ipx
))
goto
out
;
intrfc
=
ipxitf_find_using_net
(
addr
->
sipx_network
);
r
et
=
-
EADDRNOTAVAIL
;
r
c
=
-
EADDRNOTAVAIL
;
if
(
!
intrfc
)
goto
out
;
if
(
!
addr
->
sipx_port
)
{
addr
->
sipx_port
=
ipx_first_free_socketnum
(
intrfc
);
r
et
=
-
EINVAL
;
r
c
=
-
EINVAL
;
if
(
!
addr
->
sipx_port
)
goto
out_put
;
}
/* protect IPX system stuff like routing/sap */
r
et
=
-
EACCES
;
r
c
=
-
EACCES
;
if
(
ntohs
(
addr
->
sipx_port
)
<
IPX_MIN_EPHEMERAL_SOCKET
&&
!
capable
(
CAP_NET_ADMIN
))
goto
out_put
;
...
...
@@ -1793,7 +1778,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
* node number 0 was specified, the default is used.
*/
r
et
=
-
EINVAL
;
r
c
=
-
EINVAL
;
if
(
!
memcmp
(
addr
->
sipx_node
,
ipx_broadcast_node
,
IPX_NODE_LEN
))
goto
out_put
;
if
(
!
memcmp
(
addr
->
sipx_node
,
ipx_this_node
,
IPX_NODE_LEN
))
...
...
@@ -1801,7 +1786,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
else
memcpy
(
ipxs
->
node
,
addr
->
sipx_node
,
IPX_NODE_LEN
);
r
et
=
-
EADDRINUSE
;
r
c
=
-
EADDRINUSE
;
if
(
ipxitf_find_internal_socket
(
intrfc
,
ipxs
->
node
,
ipxs
->
port
))
{
SOCK_DEBUG
(
sk
,
...
...
@@ -1817,7 +1802,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
memcpy
(
ipxs
->
node
,
intrfc
->
if_node
,
IPX_NODE_LEN
);
r
et
=
-
EADDRINUSE
;
r
c
=
-
EADDRINUSE
;
if
(
ipxitf_find_socket
(
intrfc
,
addr
->
sipx_port
))
{
SOCK_DEBUG
(
sk
,
"IPX: bind failed because port %X in use.
\n
"
,
...
...
@@ -1831,7 +1816,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
/* Source addresses are easy. It must be our network:node pair for
an interface routed to IPX with the ipx routing ioctl() */
r
et
=
-
EADDRINUSE
;
r
c
=
-
EADDRINUSE
;
if
(
ipxitf_find_socket
(
intrfc
,
addr
->
sipx_port
))
{
SOCK_DEBUG
(
sk
,
"IPX: bind failed because port %X in use.
\n
"
,
ntohs
((
int
)
addr
->
sipx_port
));
...
...
@@ -1844,11 +1829,11 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
sk
->
zapped
=
0
;
SOCK_DEBUG
(
sk
,
"IPX: bound socket 0x%04X.
\n
"
,
ntohs
(
addr
->
sipx_port
)
);
r
et
=
0
;
r
c
=
0
;
out_put:
ipxitf_put
(
intrfc
);
out:
return
r
et
;
return
r
c
;
}
static
int
ipx_connect
(
struct
socket
*
sock
,
struct
sockaddr
*
uaddr
,
...
...
@@ -1857,7 +1842,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
struct
sock
*
sk
=
sock
->
sk
;
struct
ipx_opt
*
ipxs
=
ipx_sk
(
sk
);
struct
sockaddr_ipx
*
addr
;
int
r
et
=
-
EINVAL
;
int
r
c
=
-
EINVAL
;
struct
ipx_route
*
rt
;
sk
->
state
=
TCP_CLOSE
;
...
...
@@ -1875,23 +1860,23 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
uaddr
.
sipx_network
=
0
;
#ifdef CONFIG_IPX_INTERN
r
et
=
-
ENETDOWN
;
r
c
=
-
ENETDOWN
;
if
(
!
ipxs
->
intrfc
)
goto
out
;
/* Someone zonked the iface */
memcpy
(
uaddr
.
sipx_node
,
ipxs
->
intrfc
->
if_node
,
IPX_NODE_LEN
);
#endif
/* CONFIG_IPX_INTERN */
r
et
=
ipx_bind
(
sock
,
(
struct
sockaddr
*
)
&
uaddr
,
r
c
=
ipx_bind
(
sock
,
(
struct
sockaddr
*
)
&
uaddr
,
sizeof
(
struct
sockaddr_ipx
));
if
(
r
et
)
if
(
r
c
)
goto
out
;
}
/* We can either connect to primary network or somewhere
* we can route to */
rt
=
ipxrtr_lookup
(
addr
->
sipx_network
);
r
et
=
-
ENETUNREACH
;
r
c
=
-
ENETUNREACH
;
if
(
!
rt
&&
!
(
!
addr
->
sipx_network
&&
ipx_primary_net
))
goto
out
;
...
...
@@ -1907,9 +1892,9 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
if
(
rt
)
ipxrtr_put
(
rt
);
r
et
=
0
;
r
c
=
0
;
out:
return
r
et
;
return
r
c
;
}
...
...
@@ -1920,12 +1905,12 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr,
struct
sockaddr_ipx
sipx
;
struct
sock
*
sk
=
sock
->
sk
;
struct
ipx_opt
*
ipxs
=
ipx_sk
(
sk
);
int
r
et
;
int
r
c
;
*
uaddr_len
=
sizeof
(
struct
sockaddr_ipx
);
if
(
peer
)
{
r
et
=
-
ENOTCONN
;
r
c
=
-
ENOTCONN
;
if
(
sk
->
state
!=
TCP_ESTABLISHED
)
goto
out
;
...
...
@@ -1955,9 +1940,9 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr,
sipx
.
sipx_type
=
ipxs
->
type
;
memcpy
(
uaddr
,
&
sipx
,
sizeof
(
sipx
));
r
et
=
0
;
r
c
=
0
;
out:
return
r
et
;
return
r
c
;
}
int
ipx_rcv
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
,
struct
packet_type
*
pt
)
...
...
@@ -1966,7 +1951,7 @@ int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
struct
ipx_interface
*
intrfc
;
struct
ipxhdr
*
ipx
;
u16
ipx_pktsize
;
int
r
et
=
0
;
int
r
c
=
0
;
/* Not ours */
if
(
skb
->
pkt_type
==
PACKET_OTHERHOST
)
...
...
@@ -2005,13 +1990,13 @@ int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
goto
drop
;
}
r
et
=
ipxitf_rcv
(
intrfc
,
skb
);
r
c
=
ipxitf_rcv
(
intrfc
,
skb
);
ipxitf_put
(
intrfc
);
goto
out
;
drop:
kfree_skb
(
skb
);
out:
return
r
et
;
return
r
c
;
}
static
int
ipx_sendmsg
(
struct
kiocb
*
iocb
,
struct
socket
*
sock
,
...
...
@@ -2021,7 +2006,7 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
struct
ipx_opt
*
ipxs
=
ipx_sk
(
sk
);
struct
sockaddr_ipx
*
usipx
=
(
struct
sockaddr_ipx
*
)
msg
->
msg_name
;
struct
sockaddr_ipx
local_sipx
;
int
r
et
=
-
EINVAL
;
int
r
c
=
-
EINVAL
;
int
flags
=
msg
->
msg_flags
;
/* Socket gets bound below anyway */
...
...
@@ -2037,24 +2022,24 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
uaddr
.
sipx_port
=
0
;
uaddr
.
sipx_network
=
0
;
#ifdef CONFIG_IPX_INTERN
r
et
=
-
ENETDOWN
;
r
c
=
-
ENETDOWN
;
if
(
!
ipxs
->
intrfc
)
goto
out
;
/* Someone zonked the iface */
memcpy
(
uaddr
.
sipx_node
,
ipxs
->
intrfc
->
if_node
,
IPX_NODE_LEN
);
#endif
r
et
=
ipx_bind
(
sock
,
(
struct
sockaddr
*
)
&
uaddr
,
r
c
=
ipx_bind
(
sock
,
(
struct
sockaddr
*
)
&
uaddr
,
sizeof
(
struct
sockaddr_ipx
));
if
(
r
et
)
if
(
r
c
)
goto
out
;
}
r
et
=
-
EINVAL
;
r
c
=
-
EINVAL
;
if
(
msg
->
msg_namelen
<
sizeof
(
*
usipx
)
||
usipx
->
sipx_family
!=
AF_IPX
)
goto
out
;
}
else
{
r
et
=
-
ENOTCONN
;
r
c
=
-
ENOTCONN
;
if
(
sk
->
state
!=
TCP_ESTABLISHED
)
goto
out
;
...
...
@@ -2066,12 +2051,12 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock,
memcpy
(
usipx
->
sipx_node
,
ipxs
->
dest_addr
.
node
,
IPX_NODE_LEN
);
}
r
et
=
ipxrtr_route_packet
(
sk
,
usipx
,
msg
->
msg_iov
,
len
,
r
c
=
ipxrtr_route_packet
(
sk
,
usipx
,
msg
->
msg_iov
,
len
,
flags
&
MSG_DONTWAIT
);
if
(
r
et
>=
0
)
r
et
=
len
;
if
(
r
c
>=
0
)
r
c
=
len
;
out:
return
r
et
;
return
r
c
;
}
...
...
@@ -2083,7 +2068,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
struct
sockaddr_ipx
*
sipx
=
(
struct
sockaddr_ipx
*
)
msg
->
msg_name
;
struct
ipxhdr
*
ipx
=
NULL
;
struct
sk_buff
*
skb
;
int
copied
,
err
;
int
copied
,
rc
;
/* put the autobinding in */
if
(
!
ipxs
->
port
)
{
...
...
@@ -2093,24 +2078,24 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
uaddr
.
sipx_network
=
0
;
#ifdef CONFIG_IPX_INTERN
err
=
-
ENETDOWN
;
rc
=
-
ENETDOWN
;
if
(
!
ipxs
->
intrfc
)
goto
out
;
/* Someone zonked the iface */
memcpy
(
uaddr
.
sipx_node
,
ipxs
->
intrfc
->
if_node
,
IPX_NODE_LEN
);
#endif
/* CONFIG_IPX_INTERN */
err
=
ipx_bind
(
sock
,
(
struct
sockaddr
*
)
&
uaddr
,
rc
=
ipx_bind
(
sock
,
(
struct
sockaddr
*
)
&
uaddr
,
sizeof
(
struct
sockaddr_ipx
));
if
(
err
)
if
(
rc
)
goto
out
;
}
err
=
-
ENOTCONN
;
rc
=
-
ENOTCONN
;
if
(
sk
->
zapped
)
goto
out
;
skb
=
skb_recv_datagram
(
sk
,
flags
&
~
MSG_DONTWAIT
,
flags
&
MSG_DONTWAIT
,
&
err
);
flags
&
MSG_DONTWAIT
,
&
rc
);
if
(
!
skb
)
goto
out
;
...
...
@@ -2121,9 +2106,9 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
msg
->
msg_flags
|=
MSG_TRUNC
;
}
err
=
skb_copy_datagram_iovec
(
skb
,
sizeof
(
struct
ipxhdr
),
msg
->
msg_iov
,
rc
=
skb_copy_datagram_iovec
(
skb
,
sizeof
(
struct
ipxhdr
),
msg
->
msg_iov
,
copied
);
if
(
err
)
if
(
rc
)
goto
out_free
;
sk
->
stamp
=
skb
->
stamp
;
...
...
@@ -2136,17 +2121,18 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
sipx
->
sipx_network
=
IPX_SKB_CB
(
skb
)
->
ipx_source_net
;
sipx
->
sipx_type
=
ipx
->
ipx_type
;
}
err
=
copied
;
rc
=
copied
;
out_free:
skb_free_datagram
(
sk
,
skb
);
out:
return
err
;
return
rc
;
}
static
int
ipx_ioctl
(
struct
socket
*
sock
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
int
rc
=
0
;
long
amount
=
0
;
struct
sock
*
sk
=
sock
->
sk
;
...
...
@@ -2155,73 +2141,72 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
amount
=
sk
->
sndbuf
-
atomic_read
(
&
sk
->
wmem_alloc
);
if
(
amount
<
0
)
amount
=
0
;
return
put_user
(
amount
,
(
int
*
)
arg
);
rc
=
put_user
(
amount
,
(
int
*
)
arg
);
break
;
case
TIOCINQ
:
{
struct
sk_buff
*
skb
=
skb_peek
(
&
sk
->
receive_queue
);
/* These two are safe on a single CPU system as only
* user tasks fiddle here */
if
(
skb
)
amount
=
skb
->
len
-
sizeof
(
struct
ipxhdr
);
return
put_user
(
amount
,
(
int
*
)
arg
);
rc
=
put_user
(
amount
,
(
int
*
)
arg
);
break
;
}
case
SIOCADDRT
:
case
SIOCDELRT
:
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
r
eturn
ipxrtr_ioctl
(
cmd
,
(
void
*
)
arg
);
rc
=
-
EPERM
;
if
(
capable
(
CAP_NET_ADMIN
))
r
c
=
ipxrtr_ioctl
(
cmd
,
(
void
*
)
arg
);
break
;
case
SIOCSIFADDR
:
case
SIOCAIPXITFCRT
:
case
SIOCAIPXPRISLT
:
rc
=
-
EPERM
;
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
break
;
case
SIOCGIFADDR
:
return
ipxitf_ioctl
(
cmd
,
(
void
*
)
arg
);
rc
=
ipxitf_ioctl
(
cmd
,
(
void
*
)
arg
);
break
;
case
SIOCIPXCFGDATA
:
return
ipxcfg_get_config_data
((
void
*
)
arg
);
rc
=
ipxcfg_get_config_data
((
void
*
)
arg
);
break
;
case
SIOCIPXNCPCONN
:
/*
* This socket wants to take care of the NCP connection
* handed to us in arg.
*/
rc
=
-
EPERM
;
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
return
get_user
(
ipx_sk
(
sk
)
->
ipx_ncp_conn
,
break
;
rc
=
get_user
(
ipx_sk
(
sk
)
->
ipx_ncp_conn
,
(
const
unsigned
short
*
)(
arg
));
case
SIOCGSTAMP
:
{
int
ret
=
-
EINVAL
;
break
;
case
SIOCGSTAMP
:
rc
=
-
EINVAL
;
if
(
sk
)
{
rc
=
-
ENOENT
;
if
(
!
sk
->
stamp
.
tv_sec
)
return
-
ENOENT
;
ret
=
-
EFAULT
;
break
;
rc
=
-
EFAULT
;
if
(
!
copy_to_user
((
void
*
)
arg
,
&
sk
->
stamp
,
sizeof
(
struct
timeval
)))
ret
=
0
;
}
return
ret
;
rc
=
0
;
}
break
;
case
SIOCGIFDSTADDR
:
case
SIOCSIFDSTADDR
:
case
SIOCGIFBRDADDR
:
case
SIOCSIFBRDADDR
:
case
SIOCGIFNETMASK
:
case
SIOCSIFNETMASK
:
return
-
EINVAL
;
rc
=
-
EINVAL
;
break
;
default:
return
dev_ioctl
(
cmd
,(
void
*
)
arg
);
rc
=
dev_ioctl
(
cmd
,(
void
*
)
arg
);
break
;
}
/*NOT REACHED*/
return
0
;
return
rc
;
}
/*
...
...
@@ -2260,17 +2245,17 @@ SOCKOPS_WRAP(ipx_dgram, PF_IPX);
static
struct
packet_type
ipx_8023_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_802_3
),
.
func
=
ipx_rcv
,
.
data
=
(
void
*
)
1
,
/* yap, I understand shared skbs :-) */
.
data
=
(
void
*
)
1
,
/* yap, I understand shared skbs :-) */
};
static
struct
packet_type
ipx_dix_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_IPX
),
.
func
=
ipx_rcv
,
.
data
=
(
void
*
)
1
,
/* yap, I understand shared skbs :-) */
.
data
=
(
void
*
)
1
,
/* yap, I understand shared skbs :-) */
};
static
struct
notifier_block
ipx_dev_notifier
=
{
.
notifier_call
=
ipxitf_device_event
,
.
notifier_call
=
ipxitf_device_event
,
};
extern
struct
datalink_proto
*
make_EII_client
(
void
);
...
...
@@ -2324,21 +2309,6 @@ static int __init ipx_init(void)
return
0
;
}
module_init
(
ipx_init
);
/* Note on MOD_{INC,DEC}_USE_COUNT:
*
* Use counts are incremented/decremented when
* sockets are created/deleted.
*
* Routes are always associated with an interface, and
* allocs/frees will remain properly accounted for by
* their associated interfaces.
*
* Ergo, before the ipx module can be removed, all IPX
* sockets be closed from user space.
*/
static
void
__exit
ipx_proto_finito
(
void
)
{
/*
...
...
@@ -2369,5 +2339,6 @@ static void __exit ipx_proto_finito(void)
sock_unregister
(
ipx_family_ops
.
family
);
}
module_init
(
ipx_init
);
module_exit
(
ipx_proto_finito
);
MODULE_LICENSE
(
"GPL"
);
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