* Moved resolv.conf to /boot/common/settings/network/.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33989 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+1
-19
@@ -53,20 +53,11 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%
|
|
||||||
* @(#)resolv.h 8.1 (Berkeley) 6/2/93
|
|
||||||
* $Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _RESOLV_H_
|
#ifndef _RESOLV_H_
|
||||||
#define _RESOLV_H_
|
#define _RESOLV_H_
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#if (!defined(BSD)) || (BSD < 199306)
|
#include <sys/types.h>
|
||||||
# include <sys/bitypes.h>
|
|
||||||
#else
|
|
||||||
# include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -107,15 +98,6 @@ __BEGIN_DECLS
|
|||||||
void __h_errno_set(struct __res_state *res, int err);
|
void __h_errno_set(struct __res_state *res, int err);
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
/*%
|
|
||||||
* Resolver configuration file.
|
|
||||||
* Normally not present, but may contain the address of the
|
|
||||||
* initial name server(s) to query and the domain search list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _PATH_RESCONF
|
|
||||||
#define _PATH_RESCONF "/etc/resolv.conf"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
|
typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
|
||||||
res_sendhookact;
|
res_sendhookact;
|
||||||
|
|||||||
@@ -68,11 +68,6 @@
|
|||||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
|
||||||
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
|
|
||||||
static const char rcsid[] = "$Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Exp $";
|
|
||||||
#endif /* LIBC_SCCS and not lint */
|
|
||||||
|
|
||||||
#include "port_before.h"
|
#include "port_before.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -107,6 +102,8 @@ static const char rcsid[] = "$Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Ex
|
|||||||
/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */
|
/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */
|
||||||
#include <resolv.h>
|
#include <resolv.h>
|
||||||
|
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
|
||||||
#include "res_private.h"
|
#include "res_private.h"
|
||||||
|
|
||||||
/*% Options. Should all be left alone. */
|
/*% Options. Should all be left alone. */
|
||||||
@@ -167,6 +164,7 @@ __res_vinit(res_state statp, int preinit) {
|
|||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
register char *cp, **pp;
|
register char *cp, **pp;
|
||||||
register int n;
|
register int n;
|
||||||
|
char path[PATH_MAX];
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int nserv = 0; /*%< number of nameserver records read from file */
|
int nserv = 0; /*%< number of nameserver records read from file */
|
||||||
int haveenv = 0;
|
int haveenv = 0;
|
||||||
@@ -313,8 +311,12 @@ __res_vinit(res_state statp, int preinit) {
|
|||||||
(line[sizeof(name) - 1] == ' ' || \
|
(line[sizeof(name) - 1] == ' ' || \
|
||||||
line[sizeof(name) - 1] == '\t'))
|
line[sizeof(name) - 1] == '\t'))
|
||||||
|
|
||||||
|
if (find_directory(B_COMMON_SETTINGS_DIRECTORY, -1, false, path,
|
||||||
|
sizeof(path)) == B_OK)
|
||||||
|
strlcat(path, "/network/resolv.conf", sizeof(path));
|
||||||
|
|
||||||
nserv = 0;
|
nserv = 0;
|
||||||
if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
|
if ((fp = fopen(path, "r")) != NULL) {
|
||||||
/* read the config file */
|
/* read the config file */
|
||||||
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
while (fgets(buf, sizeof(buf), fp) != NULL) {
|
||||||
/* skip comments */
|
/* skip comments */
|
||||||
|
|||||||
@@ -10,8 +10,10 @@
|
|||||||
#include "DHCPClient.h"
|
#include "DHCPClient.h"
|
||||||
#include "NetServer.h"
|
#include "NetServer.h"
|
||||||
|
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
|
#include <Path.h>
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -628,8 +630,14 @@ DHCPClient::_ParseOptions(dhcp_message& message, BMessage& address)
|
|||||||
break;
|
break;
|
||||||
case OPTION_DOMAIN_NAME_SERVER:
|
case OPTION_DOMAIN_NAME_SERVER:
|
||||||
{
|
{
|
||||||
// TODO: for now, we write it just out to /etc/resolv.conf
|
// TODO: for now, we write it just out to resolv.conf
|
||||||
FILE* file = fopen("/etc/resolv.conf", "w");
|
BPath path;
|
||||||
|
if (find_directory(B_COMMON_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
path.Append("network/resolv.conf");
|
||||||
|
|
||||||
|
FILE* file = fopen(path.Path(), "w");
|
||||||
for (uint32 i = 0; i < size / 4; i++) {
|
for (uint32 i = 0; i < size / 4; i++) {
|
||||||
syslog(LOG_INFO, "DNS: %s\n",
|
syslog(LOG_INFO, "DNS: %s\n",
|
||||||
_ToString(&data[i * 4]).String());
|
_ToString(&data[i * 4]).String());
|
||||||
|
|||||||
Reference in New Issue
Block a user