diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2005-09-07 20:59:17 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2005-09-07 20:59:17 -0400 |
commit | 333fad5364d6b457c8d837f7d05802d2aaf8a961 (patch) | |
tree | 92149276982a827457e9c556c7ef82ec3b09fb52 /net/ipv6/tcp_ipv6.c | |
parent | 4706df3d3c42af802597d82c8b1542c3d52eab23 (diff) |
[IPV6]: Support several new sockopt / ancillary data in Advanced API (RFC3542).
Support several new socket options / ancillary data:
IPV6_RECVPKTINFO, IPV6_PKTINFO,
IPV6_RECVHOPOPTS, IPV6_HOPOPTS,
IPV6_RECVDSTOPTS, IPV6_DSTOPTS, IPV6_RTHDRDSTOPTS,
IPV6_RECVRTHDR, IPV6_RTHDR,
IPV6_RECVHOPOPTS, IPV6_HOPOPTS
Old semantics are preserved as IPV6_2292xxxx so that
we can maintain backward compatibility.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 794734f1d230..246414b27d0e 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -849,7 +849,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req, | |||
849 | if (dst == NULL) { | 849 | if (dst == NULL) { |
850 | opt = np->opt; | 850 | opt = np->opt; |
851 | if (opt == NULL && | 851 | if (opt == NULL && |
852 | np->rxopt.bits.srcrt == 2 && | 852 | np->rxopt.bits.osrcrt == 2 && |
853 | treq->pktopts) { | 853 | treq->pktopts) { |
854 | struct sk_buff *pktopts = treq->pktopts; | 854 | struct sk_buff *pktopts = treq->pktopts; |
855 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); | 855 | struct inet6_skb_parm *rxopt = IP6CB(pktopts); |
@@ -915,11 +915,10 @@ static int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb) | |||
915 | struct inet6_skb_parm *opt = IP6CB(skb); | 915 | struct inet6_skb_parm *opt = IP6CB(skb); |
916 | 916 | ||
917 | if (np->rxopt.all) { | 917 | if (np->rxopt.all) { |
918 | if ((opt->hop && np->rxopt.bits.hopopts) || | 918 | if ((opt->hop && (np->rxopt.bits.hopopts || np->rxopt.bits.ohopopts)) || |
919 | ((IPV6_FLOWINFO_MASK&*(u32*)skb->nh.raw) && | 919 | ((IPV6_FLOWINFO_MASK & *(u32*)skb->nh.raw) && np->rxopt.bits.rxflow) || |
920 | np->rxopt.bits.rxflow) || | 920 | (opt->srcrt && (np->rxopt.bits.srcrt || np->rxopt.bits.osrcrt)) || |
921 | (opt->srcrt && np->rxopt.bits.srcrt) || | 921 | ((opt->dst1 || opt->dst0) && (np->rxopt.bits.dstopts || np->rxopt.bits.odstopts))) |
922 | ((opt->dst1 || opt->dst0) && np->rxopt.bits.dstopts)) | ||
923 | return 1; | 922 | return 1; |
924 | } | 923 | } |
925 | return 0; | 924 | return 0; |
@@ -1190,8 +1189,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1190 | TCP_ECN_create_request(req, skb->h.th); | 1189 | TCP_ECN_create_request(req, skb->h.th); |
1191 | treq->pktopts = NULL; | 1190 | treq->pktopts = NULL; |
1192 | if (ipv6_opt_accepted(sk, skb) || | 1191 | if (ipv6_opt_accepted(sk, skb) || |
1193 | np->rxopt.bits.rxinfo || | 1192 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || |
1194 | np->rxopt.bits.rxhlim) { | 1193 | np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { |
1195 | atomic_inc(&skb->users); | 1194 | atomic_inc(&skb->users); |
1196 | treq->pktopts = skb; | 1195 | treq->pktopts = skb; |
1197 | } | 1196 | } |
@@ -1288,7 +1287,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1288 | if (sk_acceptq_is_full(sk)) | 1287 | if (sk_acceptq_is_full(sk)) |
1289 | goto out_overflow; | 1288 | goto out_overflow; |
1290 | 1289 | ||
1291 | if (np->rxopt.bits.srcrt == 2 && | 1290 | if (np->rxopt.bits.osrcrt == 2 && |
1292 | opt == NULL && treq->pktopts) { | 1291 | opt == NULL && treq->pktopts) { |
1293 | struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts); | 1292 | struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts); |
1294 | if (rxopt->srcrt) | 1293 | if (rxopt->srcrt) |
@@ -1544,9 +1543,9 @@ ipv6_pktoptions: | |||
1544 | tp = tcp_sk(sk); | 1543 | tp = tcp_sk(sk); |
1545 | if (TCP_SKB_CB(opt_skb)->end_seq == tp->rcv_nxt && | 1544 | if (TCP_SKB_CB(opt_skb)->end_seq == tp->rcv_nxt && |
1546 | !((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) { | 1545 | !((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) { |
1547 | if (np->rxopt.bits.rxinfo) | 1546 | if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo) |
1548 | np->mcast_oif = inet6_iif(opt_skb); | 1547 | np->mcast_oif = inet6_iif(opt_skb); |
1549 | if (np->rxopt.bits.rxhlim) | 1548 | if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) |
1550 | np->mcast_hops = opt_skb->nh.ipv6h->hop_limit; | 1549 | np->mcast_hops = opt_skb->nh.ipv6h->hop_limit; |
1551 | if (ipv6_opt_accepted(sk, opt_skb)) { | 1550 | if (ipv6_opt_accepted(sk, opt_skb)) { |
1552 | skb_set_owner_r(opt_skb, sk); | 1551 | skb_set_owner_r(opt_skb, sk); |