Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13b52cd4 authored by Brian Haley's avatar Brian Haley Committed by David S. Miller
Browse files

IPv6: Add dontfrag argument to relevant functions



Add dontfrag argument to relevant functions for
IPV6_DONTFRAG support, as well as allowing the value
to be passed-in via ancillary cmsg data.

Signed-off-by: default avatarBrian Haley <brian.haley@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 793b1473
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -503,7 +503,8 @@ extern int ip6_append_data(struct sock *sk,
						struct ipv6_txoptions *opt,
						struct ipv6_txoptions *opt,
						struct flowi *fl,
						struct flowi *fl,
						struct rt6_info *rt,
						struct rt6_info *rt,
						unsigned int flags);
						unsigned int flags,
						int dontfrag);


extern int			ip6_push_pending_frames(struct sock *sk);
extern int			ip6_push_pending_frames(struct sock *sk);


+2 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,8 @@ extern int datagram_send_ctl(struct net *net,
						  struct msghdr *msg,
						  struct msghdr *msg,
						  struct flowi *fl,
						  struct flowi *fl,
						  struct ipv6_txoptions *opt,
						  struct ipv6_txoptions *opt,
						  int *hlimit, int *tclass);
						  int *hlimit, int *tclass,
						  int *dontfrag);


#define		LOOPBACK4_IPV6		cpu_to_be32(0x7f000006)
#define		LOOPBACK4_IPV6		cpu_to_be32(0x7f000006)


+20 −1
Original line number Original line Diff line number Diff line
@@ -497,7 +497,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
int datagram_send_ctl(struct net *net,
int datagram_send_ctl(struct net *net,
		      struct msghdr *msg, struct flowi *fl,
		      struct msghdr *msg, struct flowi *fl,
		      struct ipv6_txoptions *opt,
		      struct ipv6_txoptions *opt,
		      int *hlimit, int *tclass)
		      int *hlimit, int *tclass, int *dontfrag)
{
{
	struct in6_pktinfo *src_info;
	struct in6_pktinfo *src_info;
	struct cmsghdr *cmsg;
	struct cmsghdr *cmsg;
@@ -735,6 +735,25 @@ int datagram_send_ctl(struct net *net,
			err = 0;
			err = 0;
			*tclass = tc;
			*tclass = tc;


			break;
		    }

		case IPV6_DONTFRAG:
		    {
			int df;

			err = -EINVAL;
			if (cmsg->cmsg_len != CMSG_LEN(sizeof(int))) {
				goto exit_f;
			}

			df = *(int *)CMSG_DATA(cmsg);
			if (df < 0 || df > 1)
				goto exit_f;

			err = 0;
			*dontfrag = df;

			break;
			break;
		    }
		    }
		default:
		default:
+3 −2
Original line number Original line Diff line number Diff line
@@ -481,7 +481,7 @@ route_done:
			      len + sizeof(struct icmp6hdr),
			      len + sizeof(struct icmp6hdr),
			      sizeof(struct icmp6hdr), hlimit,
			      sizeof(struct icmp6hdr), hlimit,
			      np->tclass, NULL, &fl, (struct rt6_info*)dst,
			      np->tclass, NULL, &fl, (struct rt6_info*)dst,
			      MSG_DONTWAIT);
			      MSG_DONTWAIT, np->dontfrag);
	if (err) {
	if (err) {
		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
		ip6_flush_pending_frames(sk);
		ip6_flush_pending_frames(sk);
@@ -561,7 +561,8 @@ static void icmpv6_echo_reply(struct sk_buff *skb)


	err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
	err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
				sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl,
				sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl,
				(struct rt6_info*)dst, MSG_DONTWAIT);
				(struct rt6_info*)dst, MSG_DONTWAIT,
				np->dontfrag);


	if (err) {
	if (err) {
		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
		ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
+2 −1
Original line number Original line Diff line number Diff line
@@ -360,7 +360,8 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
		msg.msg_control = (void*)(fl->opt+1);
		msg.msg_control = (void*)(fl->opt+1);
		flowi.oif = 0;
		flowi.oif = 0;


		err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk, &junk);
		err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk,
					&junk, &junk);
		if (err)
		if (err)
			goto done;
			goto done;
		err = -EINVAL;
		err = -EINVAL;
Loading