Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14566
b: refs/heads/master
c: df9890c
h: refs/heads/master
v: v3
  • Loading branch information
YOSHIFUJI Hideaki committed Nov 20, 2005
1 parent 6e9db02 commit 59730ca
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a305989386e402f48b216786a5c8cf440b33bdad
refs/heads/master: df9890c31a1a447254f39e40c3fd81ad6547945b
2 changes: 2 additions & 0 deletions trunk/include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
int newtype,
struct ipv6_opt_hdr __user *newopt,
int newoptlen);
struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
struct ipv6_txoptions *opt);

extern int ip6_frag_nqueues;
extern atomic_t ip6_frag_mem;
Expand Down
19 changes: 19 additions & 0 deletions trunk/net/ipv6/exthdrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,22 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
return ERR_PTR(err);
}

struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
struct ipv6_txoptions *opt)
{
/*
* ignore the dest before srcrt unless srcrt is being included.
* --yoshfuji
*/
if (opt && opt->dst0opt && !opt->srcrt) {
if (opt_space != opt) {
memcpy(opt_space, opt, sizeof(*opt_space));
opt = opt_space;
}
opt->opt_nflen -= ipv6_optlen(opt->dst0opt);
opt->dst0opt = NULL;
}

return opt;
}

16 changes: 6 additions & 10 deletions trunk/net/ipv6/ip6_flowlabel.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,16 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
struct ip6_flowlabel * fl,
struct ipv6_txoptions * fopt)
{
struct ipv6_txoptions * fl_opt = fl ? fl->opt : NULL;

if (fopt == NULL || fopt->opt_flen == 0) {
if (!fl_opt || !fl_opt->dst0opt || fl_opt->srcrt)
return fl_opt;
}

struct ipv6_txoptions * fl_opt = fl->opt;

if (fopt == NULL || fopt->opt_flen == 0)
return fl_opt;

if (fl_opt != NULL) {
opt_space->hopopt = fl_opt->hopopt;
opt_space->dst0opt = fl_opt->srcrt ? fl_opt->dst0opt : NULL;
opt_space->dst0opt = fl_opt->dst0opt;
opt_space->srcrt = fl_opt->srcrt;
opt_space->opt_nflen = fl_opt->opt_nflen;
if (fl_opt->dst0opt && !fl_opt->srcrt)
opt_space->opt_nflen -= ipv6_optlen(fl_opt->dst0opt);
} else {
if (fopt->opt_nflen == 0)
return fopt;
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/ipv6/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
}
if (opt == NULL)
opt = np->opt;
opt = fl6_merge_options(&opt_space, flowlabel, opt);
if (flowlabel)
opt = fl6_merge_options(&opt_space, flowlabel, opt);
opt = ipv6_fixup_options(&opt_space, opt);

fl.proto = proto;
rawv6_probe_proto_opt(&fl, msg);
Expand Down
4 changes: 3 additions & 1 deletion trunk/net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,9 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
}
if (opt == NULL)
opt = np->opt;
opt = fl6_merge_options(&opt_space, flowlabel, opt);
if (flowlabel)
opt = fl6_merge_options(&opt_space, flowlabel, opt);
opt = ipv6_fixup_options(&opt_space, opt);

fl->proto = IPPROTO_UDP;
ipv6_addr_copy(&fl->fl6_dst, daddr);
Expand Down

0 comments on commit 59730ca

Please sign in to comment.