From: dlg Date: Sun, 11 Feb 2018 00:24:13 +0000 (+0000) Subject: add an ipv6 "don't fragment" flag to mbufs for ip6_output to use. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=45ad364f7d01c9de832747f18d3161506cc558ea;p=openbsd add an ipv6 "don't fragment" flag to mbufs for ip6_output to use. if you need to send an ipv6 packet with ip6_send(), there's no DF bit in an ipv6 packet and no way to pass the ip6 options to ip6_output to tell it to not allow fragmentation. this adds an M_IPV6_DF_OUT "checksum" flag so something creating ipv6 packets a long way from ip6_output can easily tell it to not allow fragmentation. grumbling and ok claudio@ --- diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 03fc4fae449..4818d7cb441 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.232 2017/09/01 15:05:31 mpi Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.233 2018/02/11 00:24:13 dlg Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -656,7 +656,10 @@ reroute: */ tlen = m->m_pkthdr.len; - if (opt && (opt->ip6po_flags & IP6PO_DONTFRAG)) + if (ISSET(m->m_pkthdr.csum_flags, M_IPV6_DF_OUT)) { + CLR(m->m_pkthdr.csum_flags, M_IPV6_DF_OUT); + dontfrag = 1; + } else if (opt && ISSET(opt->ip6po_flags, IP6PO_DONTFRAG)) dontfrag = 1; else dontfrag = 0; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 825cc801843..14a43b44585 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.234 2018/02/09 02:26:33 patrick Exp $ */ +/* $OpenBSD: mbuf.h,v 1.235 2018/02/11 00:24:13 dlg Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -224,12 +224,14 @@ struct mbuf { #define M_ICMP_CSUM_OUT 0x0200 /* ICMP/ICMPv6 checksum needed */ #define M_ICMP_CSUM_IN_OK 0x0400 /* ICMP/ICMPv6 checksum verified */ #define M_ICMP_CSUM_IN_BAD 0x0800 /* ICMP/ICMPv6 checksum bad */ +#define M_IPV6_DF_OUT 0x1000 /* don't fragment outgoing IPv6 */ #ifdef _KERNEL #define MCS_BITS \ ("\20\1IPV4_CSUM_OUT\2TCP_CSUM_OUT\3UDP_CSUM_OUT\4IPV4_CSUM_IN_OK" \ "\5IPV4_CSUM_IN_BAD\6TCP_CSUM_IN_OK\7TCP_CSUM_IN_BAD\10UDP_CSUM_IN_OK" \ - "\11UDP_CSUM_IN_BAD\12ICMP_CSUM_OUT\13ICMP_CSUM_IN_OK\14ICMP_CSUM_IN_BAD") + "\11UDP_CSUM_IN_BAD\12ICMP_CSUM_OUT\13ICMP_CSUM_IN_OK\14ICMP_CSUM_IN_BAD" \ + "\15IPV6_NODF_OUT") #endif /* mbuf types */