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)
if
(
!
sk
->
sk_zapped
)
goto
out
;
/* bind to a specific sap, optional. */
if
(
!
addr
->
sllc_sap
)
{
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
;
if
(
llc
->
dev
)
memcpy
(
llc
->
laddr
.
mac
,
llc
->
dev
->
dev_addr
,
IFHWADDRLEN
);
rc
=
-
ENODEV
;
llc
->
dev
=
dev_getfirstbyhwtype
(
addr
->
sllc_arphrd
);
if
(
!
llc
->
dev
)
goto
out
;
rc
=
-
EUSERS
;
llc
->
laddr
.
lsap
=
llc_ui_autoport
();
if
(
!
llc
->
laddr
.
lsap
)
goto
out
;
rc
=
-
EBUSY
;
/* some other network layer is using the sap */
sap
=
llc_sap_open
(
llc
->
laddr
.
lsap
,
NULL
);
if
(
!
sap
)
goto
out
;
memcpy
(
llc
->
laddr
.
mac
,
llc
->
dev
->
dev_addr
,
IFHWADDRLEN
);
memcpy
(
&
llc
->
addr
,
addr
,
sizeof
(
llc
->
addr
));
/* assign new connection to its SAP */
llc_sap_add_socket
(
sap
,
sk
);
...
...
@@ -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
sock
*
sk
=
sock
->
sk
;
struct
llc_opt
*
llc
=
llc_sk
(
sk
);
struct
llc_sap
*
sap
;
int
rc
=
-
EINVAL
;
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)
rc
=
-
EAFNOSUPPORT
;
if
(
addr
->
sllc_family
!=
AF_LLC
)
goto
out
;
/* use autobind, to avoid code replication. */
rc
=
llc_ui_autobind
(
sock
,
addr
);
if
(
!
addr
->
sllc_sap
)
{
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:
return
rc
;
}
...
...
@@ -399,15 +414,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
llc
->
daddr
.
lsap
=
addr
->
sllc_sap
;
memcpy
(
llc
->
daddr
.
mac
,
addr
->
sllc_mac
,
IFHWADDRLEN
);
}
if
(
!
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
;
dev
=
llc
->
dev
;
if
(
sk
->
sk_type
!=
SOCK_STREAM
)
goto
out
;
rc
=
-
EALREADY
;
...
...
@@ -610,7 +617,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
int
rc
=
-
EOPNOTSUPP
;
dprintk
(
"%s: accepting on %02X
\n
"
,
__FUNCTION__
,
llc_sk
(
sk
)
->
addr
.
sllc_
sap
);
llc_sk
(
sk
)
->
laddr
.
l
sap
);
lock_sock
(
sk
);
if
(
sk
->
sk_type
!=
SOCK_STREAM
)
goto
out
;
...
...
@@ -622,7 +629,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
if
(
rc
)
goto
out
;
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
);
rc
=
-
EINVAL
;
if
(
!
skb
->
sk
)
...
...
@@ -747,13 +754,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
if
(
rc
)
goto
release
;
}
if
(
!
llc
->
dev
)
{
rc
=
-
ENODEV
;
dev
=
dev_getfirstbyhwtype
(
addr
->
sllc_arphrd
);
if
(
!
dev
)
goto
release
;
}
else
dev
=
llc
->
dev
;
dev
=
llc
->
dev
;
hdrlen
=
dev
->
hard_header_len
+
llc_ui_header_len
(
sk
,
addr
);
size
=
hdrlen
+
len
;
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