aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/recv.c
diff options
context:
space:
mode:
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>2018-07-23 23:51:23 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-24 00:17:44 -0400
commitb7ff8b1036f0b0df1390ba6b5e9bc7ec458e857a (patch)
tree398bab1a171b7da3be14fe9f7f1d5936032b7f74 /net/rds/recv.c
parent1e2b44e78eead7bcadfbf96f70d95773191541c9 (diff)
rds: Extend RDS API for IPv6 support
There are many data structures (RDS socket options) used by RDS apps which use a 32 bit integer to store IP address. To support IPv6, struct in6_addr needs to be used. To ensure backward compatibility, a new data structure is introduced for each of those data structures which use a 32 bit integer to represent an IP address. And new socket options are introduced to use those new structures. This means that existing apps should work without a problem with the new RDS module. For apps which want to use IPv6, those new data structures and socket options can be used. IPv4 mapped address is used to represent IPv4 address in the new data structures. v4: Revert changes to SO_RDS_TRANSPORT Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/recv.c')
-rw-r--r--net/rds/recv.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/rds/recv.c b/net/rds/recv.c
index 1402c21210b1..03cd8df54c26 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -792,3 +792,28 @@ void rds_inc_info_copy(struct rds_incoming *inc,
792 792
793 rds_info_copy(iter, &minfo, sizeof(minfo)); 793 rds_info_copy(iter, &minfo, sizeof(minfo));
794} 794}
795
796void rds6_inc_info_copy(struct rds_incoming *inc,
797 struct rds_info_iterator *iter,
798 struct in6_addr *saddr, struct in6_addr *daddr,
799 int flip)
800{
801 struct rds6_info_message minfo6;
802
803 minfo6.seq = be64_to_cpu(inc->i_hdr.h_sequence);
804 minfo6.len = be32_to_cpu(inc->i_hdr.h_len);
805
806 if (flip) {
807 minfo6.laddr = *daddr;
808 minfo6.faddr = *saddr;
809 minfo6.lport = inc->i_hdr.h_dport;
810 minfo6.fport = inc->i_hdr.h_sport;
811 } else {
812 minfo6.laddr = *saddr;
813 minfo6.faddr = *daddr;
814 minfo6.lport = inc->i_hdr.h_sport;
815 minfo6.fport = inc->i_hdr.h_dport;
816 }
817
818 rds_info_copy(iter, &minfo6, sizeof(minfo6));
819}