Index: net/udp/udp_socket_posix.cc |
diff --git a/net/udp/udp_socket_posix.cc b/net/udp/udp_socket_posix.cc |
index 797e1a0bc1352b5a4a9a43c8c663c7acb05ab374..09774ee0033144077ac9a1646e30a637851fcadd 100644 |
--- a/net/udp/udp_socket_posix.cc |
+++ b/net/udp/udp_socket_posix.cc |
@@ -425,6 +425,24 @@ int UDPSocketPosix::SetSendBufferSize(int32_t size) { |
return rv == 0 ? OK : MapSystemError(errno); |
} |
+int UDPSocketPosix::SetDoNotFragment(bool do_not_fragment) { |
+ DCHECK_NE(socket_, kInvalidSocket); |
+ DCHECK(CalledOnValidThread()); |
+ |
+ int val = do_not_fragment ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT; |
Jeremy Dorfman
2016/08/10 23:56:57
Strictly speaking, the system default is configura
Ryan Hamilton
2016/08/11 19:47:31
Good point. I removed the argument so that this me
|
+ int rv = setsockopt(socket_, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val)); |
Jeremy Dorfman
2016/08/10 23:56:57
I'm not sure what will happen if the socket is v6-
Ryan Hamilton
2016/08/11 19:47:31
How 'bout we only do one of these codepaths depend
Ryan Hamilton
2016/08/12 16:53:29
As discussed offline, doing only one codepath is p
|
+ if (rv != OK) |
+ return MapSystemError(errno); |
+ |
+ if (addr_family_ == AF_INET6) { |
+ val = do_not_fragment ? IPV6_PMTUDISC_DO : IPV6_PMTUDISC_DONT; |
+ rv = |
+ setsockopt(socket_, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val, sizeof(val)); |
+ } |
+ |
+ return rv == 0 ? OK : MapSystemError(errno); |
+} |
+ |
int UDPSocketPosix::AllowAddressReuse() { |
DCHECK_NE(socket_, kInvalidSocket); |
DCHECK(CalledOnValidThread()); |