diff options
| author | Jon Grimm <jgrimm@touki.austin.ibm.com> | 2003-07-15 03:53:43 -0500 |
|---|---|---|
| committer | Sridhar Samudrala <sri@us.ibm.com> | 2003-07-15 03:53:43 -0500 |
| commit | 845ddb449836d43b741d5c5000e4a79a9358e562 (patch) | |
| tree | e8772c9c25ba20842d5e29a8769c7940bbe8a99b /include/net | |
| parent | 33585c7e32919b6e6e16f4d25e19a02ffaf55341 (diff) | |
[SCTP] Support v4-mapped-v6 addresses (Ardelle Fan)
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/sctp/sctp.h | 19 | ||||
| -rw-r--r-- | include/net/sctp/structs.h | 9 | ||||
| -rw-r--r-- | include/net/sctp/user.h | 2 |
3 files changed, 27 insertions, 3 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 3793352764c0..68f550019491 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -611,4 +611,23 @@ int static inline __sctp_sstate(const struct sock *sk, sctp_sock_state_t state) return sk->sk_state == state; } +/* Map v4-mapped v6 address back to v4 address */ +static inline void sctp_v6_map_v4(union sctp_addr *addr) +{ + addr->v4.sin_family = AF_INET; + addr->v4.sin_port = addr->v6.sin6_port; + addr->v4.sin_addr.s_addr = addr->v6.sin6_addr.s6_addr32[3]; +} + +/* Map v4 address to v4-mapped v6 address */ +static inline void sctp_v4_map_v6(union sctp_addr *addr) +{ + addr->v6.sin6_family = AF_INET6; + addr->v6.sin6_port = addr->v4.sin_port; + addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; + addr->v6.sin6_addr.s6_addr32[0] = 0; + addr->v6.sin6_addr.s6_addr32[1] = 0; + addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); +} + #endif /* __net_sctp_h__ */ diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 94bebc0b7ce0..aae255de586b 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -260,11 +260,13 @@ struct sctp_af { struct sock *sk); void (*to_sk_daddr) (union sctp_addr *, struct sock *sk); - int (*addr_valid) (union sctp_addr *); + int (*addr_valid) (union sctp_addr *, + struct sctp_opt *); sctp_scope_t (*scope) (union sctp_addr *); void (*inaddr_any) (union sctp_addr *, unsigned short); int (*is_any) (const union sctp_addr *); - int (*available) (const union sctp_addr *); + int (*available) (union sctp_addr *, + struct sctp_opt *); int (*skb_iif) (const struct sk_buff *sk); int (*is_ce) (const struct sk_buff *sk); void (*seq_dump_addr)(struct seq_file *seq, @@ -282,7 +284,7 @@ int sctp_register_af(struct sctp_af *); struct sctp_pf { void (*event_msgname)(struct sctp_ulpevent *, char *, int *); void (*skb_msgname) (struct sk_buff *, char *, int *); - int (*af_supported) (sa_family_t); + int (*af_supported) (sa_family_t, struct sctp_opt *); int (*cmp_addr) (const union sctp_addr *, const union sctp_addr *, struct sctp_opt *); @@ -291,6 +293,7 @@ struct sctp_pf { int (*supported_addrs)(const struct sctp_opt *, __u16 *); struct sock *(*create_accept_sk) (struct sock *sk, struct sctp_association *asoc); + void (*addr_v4map) (struct sctp_opt *, union sctp_addr *); struct sctp_af *af; }; diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index e51992a2fe22..da96859dba92 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h @@ -2,6 +2,7 @@ * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001-2003 International Business Machines, Corp. + * Copyright (c) 2002 Intel Corp. * * This file is part of the SCTP kernel reference Implementation * @@ -41,6 +42,7 @@ * Jon Grimm <jgrimm@us.ibm.com> * Daisy Chang <daisyc@us.ibm.com> * Ryan Layer <rmlayer@us.ibm.com> + * Ardelle Fan <ardelle.fan@intel.com> * Sridhar Samudrala <sri@us.ibm.com> * * Any bugs reported given to us we will try to fix... any fixes shared will |
