diff options
Diffstat (limited to 'net/ipv6/ip6_flowlabel.c')
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index b6c73da5ff35..a7db762de14a 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -225,16 +225,20 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, | |||
225 | struct ip6_flowlabel * fl, | 225 | struct ip6_flowlabel * fl, |
226 | struct ipv6_txoptions * fopt) | 226 | struct ipv6_txoptions * fopt) |
227 | { | 227 | { |
228 | struct ipv6_txoptions * fl_opt = fl->opt; | 228 | struct ipv6_txoptions * fl_opt = fl ? fl->opt : NULL; |
229 | 229 | ||
230 | if (fopt == NULL || fopt->opt_flen == 0) | 230 | if (fopt == NULL || fopt->opt_flen == 0) { |
231 | return fl_opt; | 231 | if (!fl_opt || !fl_opt->dst0opt || fl_opt->srcrt) |
232 | return fl_opt; | ||
233 | } | ||
232 | 234 | ||
233 | if (fl_opt != NULL) { | 235 | if (fl_opt != NULL) { |
234 | opt_space->hopopt = fl_opt->hopopt; | 236 | opt_space->hopopt = fl_opt->hopopt; |
235 | opt_space->dst0opt = fl_opt->dst0opt; | 237 | opt_space->dst0opt = fl_opt->srcrt ? fl_opt->dst0opt : NULL; |
236 | opt_space->srcrt = fl_opt->srcrt; | 238 | opt_space->srcrt = fl_opt->srcrt; |
237 | opt_space->opt_nflen = fl_opt->opt_nflen; | 239 | opt_space->opt_nflen = fl_opt->opt_nflen; |
240 | if (fl_opt->dst0opt && !fl_opt->srcrt) | ||
241 | opt_space->opt_nflen -= ipv6_optlen(fl_opt->dst0opt); | ||
238 | } else { | 242 | } else { |
239 | if (fopt->opt_nflen == 0) | 243 | if (fopt->opt_nflen == 0) |
240 | return fopt; | 244 | return fopt; |
@@ -310,7 +314,7 @@ fl_create(struct in6_flowlabel_req *freq, char __user *optval, int optlen, int * | |||
310 | msg.msg_control = (void*)(fl->opt+1); | 314 | msg.msg_control = (void*)(fl->opt+1); |
311 | flowi.oif = 0; | 315 | flowi.oif = 0; |
312 | 316 | ||
313 | err = datagram_send_ctl(&msg, &flowi, fl->opt, &junk); | 317 | err = datagram_send_ctl(&msg, &flowi, fl->opt, &junk, &junk); |
314 | if (err) | 318 | if (err) |
315 | goto done; | 319 | goto done; |
316 | err = -EINVAL; | 320 | err = -EINVAL; |