1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

Fix a regression introduced in r179289 splitting up ip6_savecontrol()

into v4-only vs. v6-only inp_flags processing.
When ip6_savecontrol_v4() is called from ip6_savecontrol() we
were not passing back the **mp thus the information will be missing
in userland.
Istead of going with a *** as suggested in the PR we are returning
**mp now and passing in the v4only flag as a pointer argument.

PR:		kern/126349
Reviewed by:	rwatson, dwmalone
This commit is contained in:
Bjoern A. Zeeb 2008-08-16 06:39:18 +00:00
parent 8382474434
commit 48d48eb980
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181782
3 changed files with 17 additions and 8 deletions

View File

@ -216,7 +216,7 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off,
inp->inp_socket->so_options & (SO_TIMESTAMP | SO_BINTIME)) {
#ifdef INET6
if (inp->inp_vflag & INP_IPV6)
ip6_savecontrol_v4(inp, n, &opts);
(void)ip6_savecontrol_v4(inp, n, &opts, NULL);
else
#endif
ip_savecontrol(inp, &opts, ip, n);

View File

@ -1042,8 +1042,9 @@ ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int off)
* ip6_savecontrol will directly call ip6_savecontrol_v4 to handle those
* options and handle the v6-only ones itself.
*/
int
ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
struct mbuf **
ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
int *v4only)
{
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
@ -1059,8 +1060,11 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
}
#endif
if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION)
return (1);
if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
if (v4only != NULL)
*v4only = 1;
return (mp);
}
#define IS2292(inp, x, y) (((inp)->inp_flags & IN6P_RFC2292) ? (x) : (y))
/* RFC 2292 sec. 5 */
@ -1089,15 +1093,19 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
mp = &(*mp)->m_next;
}
return (0);
if (v4only != NULL)
*v4only = 0;
return (mp);
}
void
ip6_savecontrol(struct inpcb *in6p, struct mbuf *m, struct mbuf **mp)
{
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
int v4only = 0;
if (ip6_savecontrol_v4(in6p, m, mp) != 0)
mp = ip6_savecontrol_v4(in6p, m, mp, &v4only);
if (v4only)
return;
if ((in6p->in6p_flags & IN6P_TCLASS) != 0) {

View File

@ -350,7 +350,8 @@ extern int (*ip6_mforward)(struct ip6_hdr *, struct ifnet *,
int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
u_int32_t *));
int ip6_savecontrol_v4(struct inpcb *, struct mbuf *, struct mbuf **);
struct mbuf **ip6_savecontrol_v4(struct inpcb *, struct mbuf *,
struct mbuf **, int *);
void ip6_savecontrol __P((struct inpcb *, struct mbuf *, struct mbuf **));
void ip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *,
u_int32_t *));