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
f733bc48
Commit
f733bc48
authored
Nov 01, 2003
by
Arnaldo Carvalho de Melo
Committed by
David S. Miller
Nov 01, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[LLC]: fix client side after sockaddr_llc fixup
parent
ea2141fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
55 deletions
+56
-55
net/llc/af_llc.c
net/llc/af_llc.c
+56
-55
No files found.
net/llc/af_llc.c
View file @
f733bc48
...
@@ -250,41 +250,19 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
...
@@ -250,41 +250,19 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
if
(
!
sk
->
sk_zapped
)
if
(
!
sk
->
sk_zapped
)
goto
out
;
goto
out
;
/* bind to a specific sap, optional. */
rc
=
-
ENODEV
;
if
(
!
addr
->
sllc_sap
)
{
llc
->
dev
=
dev_getfirstbyhwtype
(
addr
->
sllc_arphrd
);
rc
=
-
EUSERS
;
if
(
!
llc
->
dev
)
addr
->
sllc_sap
=
llc_ui_autoport
();
goto
out
;
if
(
!
addr
->
sllc_sap
)
rc
=
-
EUSERS
;
goto
out
;
llc
->
laddr
.
lsap
=
llc_ui_autoport
();
}
if
(
!
llc
->
laddr
.
lsap
)
sap
=
llc_sap_find
(
addr
->
sllc_sap
);
goto
out
;
if
(
!
sap
)
{
rc
=
-
EBUSY
;
/* some other network layer is using the sap */
sap
=
llc_sap_open
(
addr
->
sllc_sap
,
NULL
);
sap
=
llc_sap_open
(
llc
->
laddr
.
lsap
,
NULL
);
rc
=
-
EBUSY
;
/* some other network layer is using the sap */
if
(
!
sap
)
if
(
!
sap
)
goto
out
;
goto
out
;
memcpy
(
llc
->
laddr
.
mac
,
llc
->
dev
->
dev_addr
,
IFHWADDRLEN
);
}
else
{
struct
llc_addr
laddr
,
daddr
;
struct
sock
*
ask
;
memset
(
&
laddr
,
0
,
sizeof
(
laddr
));
memset
(
&
daddr
,
0
,
sizeof
(
daddr
));
/*
* FIXME: check if the the address is multicast,
* only SOCK_DGRAM can do this.
*/
memcpy
(
laddr
.
mac
,
addr
->
sllc_mac
,
IFHWADDRLEN
);
laddr
.
lsap
=
addr
->
sllc_sap
;
rc
=
-
EADDRINUSE
;
/* mac + sap clash. */
ask
=
llc_lookup_established
(
sap
,
&
daddr
,
&
laddr
);
if
(
ask
)
{
sock_put
(
ask
);
goto
out
;
}
}
llc
->
laddr
.
lsap
=
addr
->
sllc_sap
;
if
(
llc
->
dev
)
memcpy
(
llc
->
laddr
.
mac
,
llc
->
dev
->
dev_addr
,
IFHWADDRLEN
);
memcpy
(
&
llc
->
addr
,
addr
,
sizeof
(
llc
->
addr
));
memcpy
(
&
llc
->
addr
,
addr
,
sizeof
(
llc
->
addr
));
/* assign new connection to its SAP */
/* assign new connection to its SAP */
llc_sap_add_socket
(
sap
,
sk
);
llc_sap_add_socket
(
sap
,
sk
);
...
@@ -315,6 +293,8 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
...
@@ -315,6 +293,8 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
{
{
struct
sockaddr_llc
*
addr
=
(
struct
sockaddr_llc
*
)
uaddr
;
struct
sockaddr_llc
*
addr
=
(
struct
sockaddr_llc
*
)
uaddr
;
struct
sock
*
sk
=
sock
->
sk
;
struct
sock
*
sk
=
sock
->
sk
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
;
int
rc
=
-
EINVAL
;
int
rc
=
-
EINVAL
;
dprintk
(
"%s: binding %02X
\n
"
,
__FUNCTION__
,
addr
->
sllc_sap
);
dprintk
(
"%s: binding %02X
\n
"
,
__FUNCTION__
,
addr
->
sllc_sap
);
...
@@ -323,8 +303,43 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
...
@@ -323,8 +303,43 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
rc
=
-
EAFNOSUPPORT
;
rc
=
-
EAFNOSUPPORT
;
if
(
addr
->
sllc_family
!=
AF_LLC
)
if
(
addr
->
sllc_family
!=
AF_LLC
)
goto
out
;
goto
out
;
/* use autobind, to avoid code replication. */
if
(
!
addr
->
sllc_sap
)
{
rc
=
llc_ui_autobind
(
sock
,
addr
);
rc
=
-
EUSERS
;
addr
->
sllc_sap
=
llc_ui_autoport
();
if
(
!
addr
->
sllc_sap
)
goto
out
;
}
sap
=
llc_sap_find
(
addr
->
sllc_sap
);
if
(
!
sap
)
{
sap
=
llc_sap_open
(
addr
->
sllc_sap
,
NULL
);
rc
=
-
EBUSY
;
/* some other network layer is using the sap */
if
(
!
sap
)
goto
out
;
}
else
{
struct
llc_addr
laddr
,
daddr
;
struct
sock
*
ask
;
memset
(
&
laddr
,
0
,
sizeof
(
laddr
));
memset
(
&
daddr
,
0
,
sizeof
(
daddr
));
/*
* FIXME: check if the the address is multicast,
* only SOCK_DGRAM can do this.
*/
memcpy
(
laddr
.
mac
,
addr
->
sllc_mac
,
IFHWADDRLEN
);
laddr
.
lsap
=
addr
->
sllc_sap
;
rc
=
-
EADDRINUSE
;
/* mac + sap clash. */
ask
=
llc_lookup_established
(
sap
,
&
daddr
,
&
laddr
);
if
(
ask
)
{
sock_put
(
ask
);
goto
out
;
}
}
llc
->
laddr
.
lsap
=
addr
->
sllc_sap
;
memcpy
(
llc
->
laddr
.
mac
,
addr
->
sllc_mac
,
IFHWADDRLEN
);
memcpy
(
&
llc
->
addr
,
addr
,
sizeof
(
llc
->
addr
));
/* assign new connection to its SAP */
llc_sap_add_socket
(
sap
,
sk
);
rc
=
sk
->
sk_zapped
=
0
;
out:
out:
return
rc
;
return
rc
;
}
}
...
@@ -399,15 +414,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
...
@@ -399,15 +414,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
llc
->
daddr
.
lsap
=
addr
->
sllc_sap
;
llc
->
daddr
.
lsap
=
addr
->
sllc_sap
;
memcpy
(
llc
->
daddr
.
mac
,
addr
->
sllc_mac
,
IFHWADDRLEN
);
memcpy
(
llc
->
daddr
.
mac
,
addr
->
sllc_mac
,
IFHWADDRLEN
);
}
}
if
(
!
llc
->
dev
)
{
dev
=
llc
->
dev
;
rc
=
-
ENODEV
;
dev
=
dev_getfirstbyhwtype
(
addr
->
sllc_arphrd
);
if
(
!
dev
)
goto
out
;
llc
->
dev
=
dev
;
memcpy
(
llc
->
laddr
.
mac
,
llc
->
dev
->
dev_addr
,
IFHWADDRLEN
);
}
else
dev
=
llc
->
dev
;
if
(
sk
->
sk_type
!=
SOCK_STREAM
)
if
(
sk
->
sk_type
!=
SOCK_STREAM
)
goto
out
;
goto
out
;
rc
=
-
EALREADY
;
rc
=
-
EALREADY
;
...
@@ -610,7 +617,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
...
@@ -610,7 +617,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
int
rc
=
-
EOPNOTSUPP
;
int
rc
=
-
EOPNOTSUPP
;
dprintk
(
"%s: accepting on %02X
\n
"
,
__FUNCTION__
,
dprintk
(
"%s: accepting on %02X
\n
"
,
__FUNCTION__
,
llc_sk
(
sk
)
->
addr
.
sllc_
sap
);
llc_sk
(
sk
)
->
laddr
.
l
sap
);
lock_sock
(
sk
);
lock_sock
(
sk
);
if
(
sk
->
sk_type
!=
SOCK_STREAM
)
if
(
sk
->
sk_type
!=
SOCK_STREAM
)
goto
out
;
goto
out
;
...
@@ -622,7 +629,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
...
@@ -622,7 +629,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
if
(
rc
)
if
(
rc
)
goto
out
;
goto
out
;
dprintk
(
"%s: got a new connection on %02X
\n
"
,
__FUNCTION__
,
dprintk
(
"%s: got a new connection on %02X
\n
"
,
__FUNCTION__
,
llc_sk
(
sk
)
->
addr
.
sllc_
sap
);
llc_sk
(
sk
)
->
laddr
.
l
sap
);
skb
=
skb_dequeue
(
&
sk
->
sk_receive_queue
);
skb
=
skb_dequeue
(
&
sk
->
sk_receive_queue
);
rc
=
-
EINVAL
;
rc
=
-
EINVAL
;
if
(
!
skb
->
sk
)
if
(
!
skb
->
sk
)
...
@@ -747,13 +754,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
...
@@ -747,13 +754,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
if
(
rc
)
if
(
rc
)
goto
release
;
goto
release
;
}
}
if
(
!
llc
->
dev
)
{
dev
=
llc
->
dev
;
rc
=
-
ENODEV
;
dev
=
dev_getfirstbyhwtype
(
addr
->
sllc_arphrd
);
if
(
!
dev
)
goto
release
;
}
else
dev
=
llc
->
dev
;
hdrlen
=
dev
->
hard_header_len
+
llc_ui_header_len
(
sk
,
addr
);
hdrlen
=
dev
->
hard_header_len
+
llc_ui_header_len
(
sk
,
addr
);
size
=
hdrlen
+
len
;
size
=
hdrlen
+
len
;
if
(
size
>
dev
->
mtu
)
if
(
size
>
dev
->
mtu
)
...
...
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