Page MenuHomeFreeBSD

UDP-Lite fixes
ClosedPublic

Authored by bz on Sep 17 2015, 11:24 AM.

Details

Summary

In the UDP over IPv6 implementation several cases are using the wrong protocol, e.g., based on wrong "next header" assumptions (which does not have to point to the upper layer protocol), or using hard-coded UDP instead of UDP or UDP-Lite switching protocols.
Fix those cases for UDP-Lite it to work correctly.

PR: 202788
Submitted by: Tiwei Bie (btw mail.ustc.edu.cn) (one part)
MFC After: 2 weeks

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202788

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bz retitled this revision from to UDP-Lite fixes.
bz updated this object.
bz edited the test plan for this revision. (Show Details)
bz added reviewers: adrian, gnn, kevlo.
bz set the repository for this revision to rS FreeBSD src repository - subversion.
bz added a subscriber: network.
kevlo edited edge metadata.

You're right, we should use "proto" to get the UDP or UDP-Lite.
Thanks for fixing it.

This revision is now accepted and ready to land.Sep 17 2015, 2:26 PM
sys/netinet6/udp6_usrreq.c
1236 ↗(On Diff #8813)

If we are going to replace the hard-coded UDP used in ip_protox[]
with UDP or UDP-Lite switching protocols, should we do that in all
cases? (I know UDP and UDP-Lite share udp_usrreqs)

Such as these codes:

static void
udp6_abort(struct socket *so)
{
	......

#ifdef INET
	if (inp->inp_vflag & INP_IPV4) {
		struct pr_usrreqs *pru;

		pru = inetsw[ip_protox[IPPROTO_UDP]].pr_usrreqs;
		(*pru->pru_abort)(so);
		return;
	}
#endif
	......
}

static void
udp6_close(struct socket *so)
{
	......

#ifdef INET
	if (inp->inp_vflag & INP_IPV4) {
		struct pr_usrreqs *pru;

		pru = inetsw[ip_protox[IPPROTO_UDP]].pr_usrreqs;
		(*pru->pru_disconnect)(so);
		return;
	}
#endif

	......
}

static int
udp6_disconnect(struct socket *so)
{
	......

#ifdef INET
	if (inp->inp_vflag & INP_IPV4) {
		struct pr_usrreqs *pru;

		pru = inetsw[ip_protox[IPPROTO_UDP]].pr_usrreqs;
		(void)(*pru->pru_disconnect)(so);
		return (0);
	}
#endif

	......

}

Thanks! :-)

bz edited edge metadata.

Update for all ip_protox[] cases.

This revision now requires review to proceed.Sep 19 2015, 11:25 AM
bz marked an inline comment as done.Sep 19 2015, 11:25 AM

Updated to catch the other 3.

btw edited edge metadata.
This revision is now accepted and ready to land.Sep 19 2015, 5:11 PM
gnn edited edge metadata.
This revision was automatically updated to reflect the committed changes.