aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_divert.c
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1998-05-25 07:41:23 +0000
committerJulian Elischer <julian@FreeBSD.org>1998-05-25 07:41:23 +0000
commit25e75fb3209d93e017268dfb5c5109c8c570d2a2 (patch)
tree9799a148134f0beea1edd90afc349371458727c0 /sys/netinet/ip_divert.c
parentaf2bbadbe07432519a1fcb8cd12602f05cc9f4f1 (diff)
downloadsrc-25e75fb3209d93e017268dfb5c5109c8c570d2a2.tar.gz
src-25e75fb3209d93e017268dfb5c5109c8c570d2a2.zip
Take the user's "IGNORE_DIVERT" argument from where the user put it
and not from the PCB which HAPPENS to contain the same number most of the time, but not always.
Notes
Notes: svn path=/head/; revision=36363
Diffstat (limited to 'sys/netinet/ip_divert.c')
-rw-r--r--sys/netinet/ip_divert.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index ad214c786db5..3e7c6a334db2 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ip_divert.c,v 1.22 1998/03/28 10:18:23 bde Exp $
+ * $Id: ip_divert.c,v 1.23 1998/05/15 20:11:33 wollman Exp $
*/
#include "opt_inet.h"
@@ -221,16 +221,18 @@ div_output(so, m, addr, control)
{
register struct inpcb *const inp = sotoinpcb(so);
register struct ip *const ip = mtod(m, struct ip *);
- struct sockaddr_in *sin = NULL;
+ struct sockaddr_in *sin = (struct sockaddr_in *)addr;
int error = 0;
if (control)
m_freem(control); /* XXX */
- if (addr)
- sin = (struct sockaddr_in *)addr;
/* Loopback avoidance option */
- ip_divert_ignore = ntohs(inp->inp_lport);
+ if (sin) {
+ ip_divert_ignore = ntohs(sin->sin_port);
+ } else {
+ ip_divert_ignore = 0;
+ }
/* Reinject packet into the system as incoming or outgoing */
if (!sin || sin->sin_addr.s_addr == 0) {