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
fd1a5cba
Commit
fd1a5cba
authored
Sep 18, 2003
by
Sridhar Samudrala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP] ADDIP: Support to send ASCONF chunk with ADD/DEL IP params.
parent
4e30cacd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
5 deletions
+127
-5
include/net/sctp/sm.h
include/net/sctp/sm.h
+4
-0
include/net/sctp/structs.h
include/net/sctp/structs.h
+4
-0
net/sctp/bind_addr.c
net/sctp/bind_addr.c
+37
-0
net/sctp/sm_make_chunk.c
net/sctp/sm_make_chunk.c
+82
-5
No files found.
include/net/sctp/sm.h
View file @
fd1a5cba
...
...
@@ -269,6 +269,10 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
struct
sctp_chunk
*
asconf
,
int
vparam_len
);
struct
sctp_chunk
*
sctp_make_asconf_update_ip
(
struct
sctp_association
*
,
union
sctp_addr
*
,
struct
sockaddr
*
,
int
,
int
);
struct
sctp_chunk
*
sctp_make_asconf_set_prim
(
struct
sctp_association
*
asoc
,
union
sctp_addr
*
addr
);
...
...
include/net/sctp/structs.h
View file @
fd1a5cba
...
...
@@ -1085,6 +1085,10 @@ int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
int
sctp_del_bind_addr
(
struct
sctp_bind_addr
*
,
union
sctp_addr
*
);
int
sctp_bind_addr_match
(
struct
sctp_bind_addr
*
,
const
union
sctp_addr
*
,
struct
sctp_opt
*
);
union
sctp_addr
*
sctp_find_unmatch_addr
(
struct
sctp_bind_addr
*
bp
,
const
union
sctp_addr
*
addrs
,
int
addrcnt
,
struct
sctp_opt
*
opt
);
union
sctp_params
sctp_bind_addrs_to_raw
(
const
struct
sctp_bind_addr
*
bp
,
int
*
addrs_len
,
int
gfp
);
int
sctp_raw_to_bind_addrs
(
struct
sctp_bind_addr
*
bp
,
__u8
*
raw
,
int
len
,
...
...
net/sctp/bind_addr.c
View file @
fd1a5cba
...
...
@@ -324,6 +324,43 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp,
return
0
;
}
/* Find the first address in the bind address list that is not present in
* the addrs packed array.
*/
union
sctp_addr
*
sctp_find_unmatch_addr
(
struct
sctp_bind_addr
*
bp
,
const
union
sctp_addr
*
addrs
,
int
addrcnt
,
struct
sctp_opt
*
opt
)
{
struct
sctp_sockaddr_entry
*
laddr
;
union
sctp_addr
*
addr
;
void
*
addr_buf
;
struct
sctp_af
*
af
;
struct
list_head
*
pos
;
int
i
;
list_for_each
(
pos
,
&
bp
->
address_list
)
{
laddr
=
list_entry
(
pos
,
struct
sctp_sockaddr_entry
,
list
);
addr_buf
=
(
union
sctp_addr
*
)
addrs
;
for
(
i
=
0
;
i
<
addrcnt
;
i
++
)
{
addr
=
(
union
sctp_addr
*
)
addr_buf
;
af
=
sctp_get_af_specific
(
addr
->
v4
.
sin_family
);
if
(
!
af
)
return
NULL
;
if
(
opt
->
pf
->
cmp_addr
(
&
laddr
->
a
,
addr
,
opt
))
break
;
addr_buf
+=
af
->
sockaddr_len
;
}
if
(
i
==
addrcnt
)
return
&
laddr
->
a
;
}
return
NULL
;
}
/* Copy out addresses from the global local address list. */
static
int
sctp_copy_one_addr
(
struct
sctp_bind_addr
*
dest
,
union
sctp_addr
*
addr
,
...
...
net/sctp/sm_make_chunk.c
View file @
fd1a5cba
/* SCTP kernel reference Implementation
*
Copyright (C)
IBM Corp. 2001, 2003
*
(C) Copyright
IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001-2002 Intel Corp.
...
...
@@ -2021,11 +2021,11 @@ struct sctp_chunk *sctp_make_asconf(struct sctp_association *asoc,
sctp_addiphdr_t
asconf
;
struct
sctp_chunk
*
retval
;
int
length
=
sizeof
(
asconf
)
+
vparam_len
;
union
sctp_
params
addrparam
;
union
sctp_
addr_param
addrparam
;
int
addrlen
;
struct
sctp_af
*
af
=
sctp_get_af_specific
(
addr
->
v4
.
sin_family
);
addrlen
=
af
->
to_addr_param
(
addr
,
(
union
sctp_addr_param
*
)
&
addrparam
);
addrlen
=
af
->
to_addr_param
(
addr
,
&
addrparam
);
if
(
!
addrlen
)
return
NULL
;
length
+=
addrlen
;
...
...
@@ -2045,6 +2045,83 @@ struct sctp_chunk *sctp_make_asconf(struct sctp_association *asoc,
return
retval
;
}
/* ADDIP
* 3.2.1 Add IP Address
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Type = 0xC001 | Length = Variable |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | ASCONF-Request Correlation ID |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Address Parameter |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* 3.2.2 Delete IP Address
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Type = 0xC002 | Length = Variable |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | ASCONF-Request Correlation ID |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Address Parameter |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
*/
struct
sctp_chunk
*
sctp_make_asconf_update_ip
(
struct
sctp_association
*
asoc
,
union
sctp_addr
*
laddr
,
struct
sockaddr
*
addrs
,
int
addrcnt
,
int
flags
)
{
sctp_addip_param_t
param
;
struct
sctp_chunk
*
retval
;
union
sctp_addr_param
addr_param
;
union
sctp_addr
*
addr
;
void
*
addr_buf
;
struct
sctp_af
*
af
;
int
paramlen
=
sizeof
(
param
);
int
addr_param_len
=
0
;
int
totallen
=
0
;
int
i
;
/* Get total length of all the address parameters. */
addr_buf
=
addrs
;
for
(
i
=
0
;
i
<
addrcnt
;
i
++
)
{
addr
=
(
union
sctp_addr
*
)
addr_buf
;
af
=
sctp_get_af_specific
(
addr
->
v4
.
sin_family
);
addr_param_len
=
af
->
to_addr_param
(
addr
,
&
addr_param
);
totallen
+=
paramlen
;
totallen
+=
addr_param_len
;
addr_buf
+=
af
->
sockaddr_len
;
}
/* Create an asconf chunk with the required length. */
retval
=
sctp_make_asconf
(
asoc
,
laddr
,
totallen
);
if
(
!
retval
)
return
NULL
;
/* Add the address parameters to the asconf chunk. */
addr_buf
=
addrs
;
for
(
i
=
0
;
i
<
addrcnt
;
i
++
)
{
addr
=
(
union
sctp_addr
*
)
addr_buf
;
af
=
sctp_get_af_specific
(
addr
->
v4
.
sin_family
);
addr_param_len
=
af
->
to_addr_param
(
addr
,
&
addr_param
);
param
.
param_hdr
.
type
=
flags
;
param
.
param_hdr
.
length
=
htons
(
paramlen
+
addr_param_len
);
param
.
crr_id
=
htonl
(
i
);
sctp_addto_chunk
(
retval
,
paramlen
,
&
param
);
sctp_addto_chunk
(
retval
,
addr_param_len
,
&
addr_param
);
addr_buf
+=
af
->
sockaddr_len
;
}
return
retval
;
}
/* ADDIP
* 3.2.4 Set Primary IP Address
* 0 1 2 3
...
...
@@ -2065,11 +2142,11 @@ struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
sctp_addip_param_t
param
;
struct
sctp_chunk
*
retval
;
int
len
=
sizeof
(
param
);
union
sctp_
params
addrparam
;
union
sctp_
addr_param
addrparam
;
int
addrlen
;
struct
sctp_af
*
af
=
sctp_get_af_specific
(
addr
->
v4
.
sin_family
);
addrlen
=
af
->
to_addr_param
(
addr
,
(
union
sctp_addr_param
*
)
&
addrparam
);
addrlen
=
af
->
to_addr_param
(
addr
,
&
addrparam
);
if
(
!
addrlen
)
return
NULL
;
len
+=
addrlen
;
...
...
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