Hi -
copypktopts is only called by ip6_setpktopts with M_NOWAIT. Drop
canwait to make this simpler and more readable.
Index: ip6_output.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
retrieving revision 1.221
diff -u -p -r1.221 ip6_output.c
--- ip6_output.c 19 Jan 2017 14:49:19 -0000 1.221
+++ ip6_output.c 26 Jan 2017 20:18:00 -0000
@@ -127,7 +127,7 @@ int ip6_insertfraghdr(struct mbuf *, str
int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t);
int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *);
int ip6_getpmtu(struct rtentry *, struct ifnet *, u_long *);
-int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int);
+int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *);
static __inline u_int16_t __attribute__((__unused__))
in6_cksum_phdr(const struct in6_addr *, const struct in6_addr *,
u_int32_t, u_int32_t);
@@ -1839,22 +1839,22 @@ ip6_clearpktopts(struct ip6_pktopts *pkt
do {\
if (src->type) {\
size_t hlen = (((struct ip6_ext *)src->type)->ip6e_len + 1) <<
3;\
- dst->type = malloc(hlen, M_IP6OPT, canwait);\
- if (dst->type == NULL && canwait == M_NOWAIT)\
+ dst->type = malloc(hlen, M_IP6OPT, M_NOWAIT);\
+ if (dst->type == NULL)\
goto bad;\
memcpy(dst->type, src->type, hlen);\
}\
} while (/*CONSTCOND*/ 0)
int
-copypktopts(struct ip6_pktopts *dst, struct ip6_pktopts *src, int canwait)
+copypktopts(struct ip6_pktopts *dst, struct ip6_pktopts *src)
{
dst->ip6po_hlim = src->ip6po_hlim;
dst->ip6po_tclass = src->ip6po_tclass;
dst->ip6po_flags = src->ip6po_flags;
if (src->ip6po_pktinfo) {
dst->ip6po_pktinfo = malloc(sizeof(*dst->ip6po_pktinfo),
- M_IP6OPT, canwait);
+ M_IP6OPT, M_NOWAIT);
if (dst->ip6po_pktinfo == NULL)
goto bad;
*dst->ip6po_pktinfo = *src->ip6po_pktinfo;
@@ -2256,7 +2256,7 @@ ip6_setpktopts(struct mbuf *control, str
* but we can allow this since this option should be rarely
* used.
*/
- if ((error = copypktopts(opt, stickyopt, M_NOWAIT)) != 0)
+ if ((error = copypktopts(opt, stickyopt)) != 0)
return (error);
}