NetBSD Problem Report #45394

From apb@cequrux.com  Fri Sep 23 06:53:08 2011
Return-Path: <apb@cequrux.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 0008063B884
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 23 Sep 2011 06:53:07 +0000 (UTC)
Message-Id: <20110923064510.4C1002C5E0CB@apb-laptoy.apb.alt.za>
Date: Fri, 23 Sep 2011 06:45:10 +0000 (UTC)
From: apb@cequrux.com
To: gnats-bugs@gnats.NetBSD.org
Subject: openvpn get_default_gateway() fails on NetBSD
X-Send-Pr-Version: 3.95

>Number:         45394
>Category:       pkg
>Synopsis:       openvpn get_default_gateway() fails on NetBSD
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 23 06:55:00 +0000 2011
>Originator:     Alan Barrett
>Release:        NetBSD 5.99.55
>Organization:
Not much
>Environment:
System: NetBSD 5.99.55
Architecture: i386
Machine: i386
>Description:

openvpn-2.2.1 built from pkgsrc contains code to find the
default gateway, but it fails on NetBSD-current, resulting in
log messages like this:

	NOTE: unable to redirect default gateway -- Cannot read current
	default gateway from system

>How-To-Repeat:
Build and install openvpn on NetBSD-current.  Attempt to use it with a
configuration that includes constructs like this:

	--redirect-gateway def1
	--route 10.0.0.0 255.0.0.0 net_gateway

The system's default IPv4 gateway is needed by both the the
--redirect-gateway option, and the net_gateway keyword used with the
--route option.

>Fix:
Change the code in openvpn-2.2.1/route.c to use the correct API on
NetBSD.

There are several versions of the get_default_gateway() function
in route.c.  The culprit seems to be the one guarded by

	#elif defined(TARGET_OPENBSD) || defined(TARGET_NETBSD)

in line 1933 of route.c.

I haven't investigated in detail, but it's suspicious that openvpn uses
it's own struct definitions instead of including appropriate headers
from the system.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.