Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a3d7813b
Commit
a3d7813b
authored
Aug 23, 2002
by
Josef Siemes
Committed by
David S. Miller
Aug 23, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/ipv4/ipconfig.c: Add support for multiple nameservers.
parent
a9799084
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
net/ipv4/ipconfig.c
net/ipv4/ipconfig.c
+30
-8
No files found.
net/ipv4/ipconfig.c
View file @
a3d7813b
...
...
@@ -26,6 +26,9 @@
*
* Merged changes from 2.2.19 into 2.4.3
* -- Eric Biederman <ebiederman@lnxi.com>, 22 April Aug 2001
*
* Multipe Nameservers in /proc/net/pnp
* -- Josef Siemes <jsiemes@web.de>, Aug 2002
*/
#include <linux/config.h>
...
...
@@ -91,6 +94,8 @@
#define CONF_TIMEOUT_RANDOM (HZ)
/* Maximum amount of randomization */
#define CONF_TIMEOUT_MULT *7/4
/* Rate of timeout growth */
#define CONF_TIMEOUT_MAX (HZ*30)
/* Maximum allowed timeout */
#define CONF_NAMESERVERS_MAX 3
/* Maximum number of nameservers
- '3' from resolv.h */
/*
...
...
@@ -132,7 +137,7 @@ u8 root_server_path[256] __initdata = { 0, }; /* Path to mount as root */
/* Persistent data: */
int
ic_proto_used
;
/* Protocol used, if any */
u32
ic_nameserver
=
INADDR_NONE
;
/* DNS Server IP addres
s */
u32
ic_nameserver
s
[
CONF_NAMESERVERS_MAX
];
/* DNS Server IP addresse
s */
u8
ic_domain
[
64
];
/* DNS (not NIS) domain name */
/*
...
...
@@ -625,6 +630,11 @@ static void __init ic_bootp_init_ext(u8 *e)
*/
static
inline
void
ic_bootp_init
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
CONF_NAMESERVERS_MAX
;
i
++
)
ic_nameservers
[
i
]
=
INADDR_NONE
;
dev_add_pack
(
&
bootp_packet_type
);
}
...
...
@@ -729,6 +739,9 @@ static int __init ic_bootp_string(char *dest, char *src, int len, int max)
*/
static
void
__init
ic_do_bootp_ext
(
u8
*
ext
)
{
u8
servers
;
int
i
;
#ifdef IPCONFIG_DEBUG
u8
*
c
;
...
...
@@ -748,8 +761,13 @@ static void __init ic_do_bootp_ext(u8 *ext)
memcpy
(
&
ic_gateway
,
ext
+
1
,
4
);
break
;
case
6
:
/* DNS server */
if
(
ic_nameserver
==
INADDR_NONE
)
memcpy
(
&
ic_nameserver
,
ext
+
1
,
4
);
servers
=
*
ext
/
4
;
if
(
servers
>
CONF_NAMESERVERS_MAX
)
servers
=
CONF_NAMESERVERS_MAX
;
for
(
i
=
0
;
i
<
servers
;
i
++
)
{
if
(
ic_nameservers
[
i
]
==
INADDR_NONE
)
memcpy
(
&
ic_nameservers
[
i
],
ext
+
1
+
4
*
i
,
4
);
}
break
;
case
12
:
/* Host name */
ic_bootp_string
(
system_utsname
.
nodename
,
ext
+
1
,
*
ext
,
__NEW_UTS_LEN
);
...
...
@@ -914,8 +932,8 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
ic_servaddr
=
b
->
server_ip
;
if
(
ic_gateway
==
INADDR_NONE
&&
b
->
relay_ip
)
ic_gateway
=
b
->
relay_ip
;
if
(
ic_nameserver
==
INADDR_NONE
)
ic_nameserver
=
ic_servaddr
;
if
(
ic_nameserver
s
[
0
]
==
INADDR_NONE
)
ic_nameserver
s
[
0
]
=
ic_servaddr
;
ic_got_reply
=
IC_BOOTP
;
drop:
...
...
@@ -1078,6 +1096,7 @@ static int pnp_get_info(char *buffer, char **start,
off_t
offset
,
int
length
)
{
int
len
;
int
i
;
if
(
ic_proto_used
&
IC_PROTO
)
sprintf
(
buffer
,
"#PROTO: %s
\n
"
,
...
...
@@ -1090,9 +1109,12 @@ static int pnp_get_info(char *buffer, char **start,
if
(
ic_domain
[
0
])
len
+=
sprintf
(
buffer
+
len
,
"domain %s
\n
"
,
ic_domain
);
if
(
ic_nameserver
!=
INADDR_NONE
)
len
+=
sprintf
(
buffer
+
len
,
"nameserver %u.%u.%u.%u
\n
"
,
NIPQUAD
(
ic_nameserver
));
for
(
i
=
0
;
i
<
CONF_NAMESERVERS_MAX
;
i
++
)
{
if
(
ic_nameservers
[
i
]
!=
INADDR_NONE
)
len
+=
sprintf
(
buffer
+
len
,
"nameserver %u.%u.%u.%u
\n
"
,
NIPQUAD
(
ic_nameservers
[
i
]));
}
if
(
offset
>
len
)
offset
=
len
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment