Browse Source

fix a bunch of stuff

r16759
master
Joshua Kwan 18 years ago
parent
commit
79218c7e40
  1. 10
      debian/changelog
  2. 5
      dhclient-script
  3. 21
      netcfg-common.c
  4. 9
      netcfg.c
  5. 6
      static.c

10
debian/changelog

@ -4,8 +4,14 @@ netcfg (0.69) UNRELEASED; urgency=low
- Remove trailing exclamation mark from netcfg/dhcp_success_note
- Run debconf-updatepo and unfuzzy templates for removed exclamation mark
* Joshua Kwan
- Corrected reference to the pppconfig package. Closes:#253086
- killall.sh: add grep -v grep
- Corrected reference to the pppconfig package. (Closes: #253086)
- killall.sh: add grep -v grep (Closes: #253099)
- Allow netcfg/disable_dhcp option that governs what use_dhcp is
set to every time we start, instead of hardcoding true. Defaults
to true, so default behavior has not changed. (Closes: #248147)
- Don't set the broadcast address in either dhclient-script or
static configuration. (Closes: #253361)
- Fix /etc/hosts writing after much deliberation. (Closes: #247734)
-- Joshua Kwan <joshk@triplehelix.org> Thu, 10 Jun 2004 21:51:33 -0700

5
dhclient-script

@ -31,9 +31,6 @@ set_hostname() {
fi
}
if [ -n "$new_broadcast_address" ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
if [ -n "$new_subnet_mask" ]; then
new_mask="/$(ptom $new_subnet_mask)"
fi
@ -73,7 +70,7 @@ case "$reason" in
ip link set $interface up
ip addr flush dev $interface
ip addr add $new_ip_address$new_mask $new_broadcast_arg dev $interface
ip addr add $new_ip_address$new_mask dev $interface
for router in $new_routers; do
ip route add default via $router

21
netcfg-common.c

@ -554,17 +554,18 @@ void netcfg_write_common(struct in_addr ipaddress, char *hostname, char *domain)
if ((fp = file_open(HOSTS_FILE, "w"))) {
char ptr1[INET_ADDRSTRLEN];
if (ipaddress.s_addr) {
fprintf(fp, "127.0.0.1\tlocalhost\t%s\n", hostname);
if (domain && !empty_str(domain))
fprintf(fp, "%s\t%s.%s\t%s\n",
inet_ntop (AF_INET, &ipaddress, ptr1, sizeof (ptr1)), hostname,
domain, hostname);
else
fprintf(fp, "%s\t%s\n", inet_ntop (AF_INET, &ipaddress, ptr1, sizeof (ptr1)),
hostname);
fprintf(fp, "127.0.0.1\tlocalhost.localdomain\tlocalhost");
if (ipaddress.s_addr)
{
inet_ntop (AF_INET, &ipaddress, ptr1, sizeof(ptr1));
if (!empty_str(domain))
fprintf(fp, "\n%s\t%s.%s\t%s\n", ptr1, hostname, domain, hostname);
else
fprintf(fp, "\n%s\t%s\n", ptr1, hostname);
} else {
fprintf(fp, "127.0.0.1\tlocalhost\t%s\n", hostname);
fprintf(fp, "\t%s\n", hostname);
}
fprintf(fp, "\n" IPV6_HOSTS);

9
netcfg.c

@ -74,10 +74,11 @@ int main(int argc, char *argv[])
client = debconfclient_new();
debconf_capb(client, "backup");
/* always always always default back to DHCP. This might be bad, but
* one can't get back to DHCP from static. yet. */
debconf_set(client, "netcfg/use_dhcp", "true");
/* always always always default back to DHCP, unless you've specified
* disable_dhcp on the command line. */
debconf_get(client, "netcfg/disable_dhcp");
debconf_set(client, "netcfg/use_dhcp", client->value);
for (;;)
{
switch(state)

6
static.c

@ -293,7 +293,7 @@ static int netcfg_write_static(char *domain, struct in_addr nameservers[])
int netcfg_activate_static(struct debconfclient *client)
{
int rv = 0, masksize;
char buf[256], ptr1[INET_ADDRSTRLEN], ptr2[INET_ADDRSTRLEN];
char buf[256], ptr1[INET_ADDRSTRLEN];
#ifdef __GNU__
/* I had to do something like this ? */
@ -327,9 +327,9 @@ int netcfg_activate_static(struct debconfclient *client)
rv |= !inet_ptom (NULL, &masksize, &netmask);
/* Add the new IP address, and broadcast, and netmask */
snprintf(buf, sizeof(buf), "ip addr add %s/%d broadcast %s dev %s",
snprintf(buf, sizeof(buf), "ip addr add %s/%d dev %s",
inet_ntop (AF_INET, &ipaddress, ptr1, sizeof (ptr1)), masksize,
inet_ntop (AF_INET, &broadcast, ptr2, sizeof (ptr2)), interface);
interface);
di_info("executing: %s", buf);
rv |= di_exec_shell_log(buf);

Loading…
Cancel
Save