aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2007-12-20 17:10:00 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:21 -0500
commitd6de3097592b7ae7f8e233a4dafb088e2aa8170f (patch)
tree67c3bba0cb62fa4cc81d8546b34f12c4756d158b /net/sctp
parent42e30bf3463cd37d73839376662cb79b4d5c416c (diff)
[SCTP]: Add the handling of "Set Primary IP Address" parameter to INIT
The ADD-IP "Set Primary IP Address" parameter is allowed in the INIT/INIT-ACK exchange. Allow processing of this parameter during the INIT/INIT-ACK. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/sm_make_chunk.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 64790b53323b..8138bbd93210 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1969,6 +1969,11 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
1969 case SCTP_PARAM_SUPPORTED_EXT: 1969 case SCTP_PARAM_SUPPORTED_EXT:
1970 break; 1970 break;
1971 1971
1972 case SCTP_PARAM_SET_PRIMARY:
1973 if (sctp_addip_enable)
1974 break;
1975 goto fallthrough;
1976
1972 case SCTP_PARAM_HOST_NAME_ADDRESS: 1977 case SCTP_PARAM_HOST_NAME_ADDRESS:
1973 /* Tell the peer, we won't support this param. */ 1978 /* Tell the peer, we won't support this param. */
1974 sctp_process_hn_param(asoc, param, chunk, err_chunk); 1979 sctp_process_hn_param(asoc, param, chunk, err_chunk);
@@ -2286,6 +2291,8 @@ static int sctp_process_param(struct sctp_association *asoc,
2286 sctp_scope_t scope; 2291 sctp_scope_t scope;
2287 time_t stale; 2292 time_t stale;
2288 struct sctp_af *af; 2293 struct sctp_af *af;
2294 union sctp_addr_param *addr_param;
2295 struct sctp_transport *t;
2289 2296
2290 /* We maintain all INIT parameters in network byte order all the 2297 /* We maintain all INIT parameters in network byte order all the
2291 * time. This allows us to not worry about whether the parameters 2298 * time. This allows us to not worry about whether the parameters
@@ -2376,6 +2383,26 @@ static int sctp_process_param(struct sctp_association *asoc,
2376 asoc->peer.adaptation_ind = param.aind->adaptation_ind; 2383 asoc->peer.adaptation_ind = param.aind->adaptation_ind;
2377 break; 2384 break;
2378 2385
2386 case SCTP_PARAM_SET_PRIMARY:
2387 addr_param = param.v + sizeof(sctp_addip_param_t);
2388
2389 af = sctp_get_af_specific(param_type2af(param.p->type));
2390 af->from_addr_param(&addr, addr_param,
2391 htons(asoc->peer.port), 0);
2392
2393 /* if the address is invalid, we can't process it.
2394 * XXX: see spec for what to do.
2395 */
2396 if (!af->addr_valid(&addr, NULL, NULL))
2397 break;
2398
2399 t = sctp_assoc_lookup_paddr(asoc, &addr);
2400 if (!t)
2401 break;
2402
2403 sctp_assoc_set_primary(asoc, t);
2404 break;
2405
2379 case SCTP_PARAM_SUPPORTED_EXT: 2406 case SCTP_PARAM_SUPPORTED_EXT:
2380 sctp_process_ext_param(asoc, param); 2407 sctp_process_ext_param(asoc, param);
2381 break; 2408 break;