Browse Source

super bugfix time

r15994
tags/0.65
Joshua Kwan 17 years ago
parent
commit
c2395e946b
6 changed files with 56 additions and 18 deletions
  1. +1
    -1
      Makefile
  2. +6
    -1
      debian/changelog
  3. +3
    -3
      debian/control
  4. +27
    -13
      netcfg.c
  5. +1
    -0
      netcfg.h
  6. +18
    -0
      static.c

+ 1
- 1
Makefile View File

@@ -3,7 +3,7 @@ TARGETS ?= netcfg-dhcp netcfg-static netcfg

LDOPTS = -ldebconfclient -ldebian-installer -liw
CFLAGS = -W -Wall
COMMON_OBJS = netcfg-common.o mii-lite.o wireless.o
COMMON_OBJS = netcfg-common.o wireless.o

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0 -g3


+ 6
- 1
debian/changelog View File

@@ -2,8 +2,13 @@ netcfg (0.65) UNRELEASED; urgency=low

* Joshua Kwan
- Fix machine state in static configuration to call QUIT.
(Closes: #250074)
- Rewrite resolv.conf in static configuration once we acquire a
domain name. (Closes: #250021)
- Switch to using mii-diag-udeb instead of mii-lite.c, which doesn't
seem to work across the board. (also addresses #250074)

-- Otavio Salvador <otavio@debian.org> Wed, 19 May 2004 17:01:43 -0300
-- Joshua Kwan <joshk@triplehelix.org> Fri, 21 May 2004 09:44:25 -0700

netcfg (0.64) unstable; urgency=medium



+ 3
- 3
debian/control View File

@@ -9,7 +9,7 @@ Standards-Version: 3.6.1.0
Package: netcfg
XC-Package-Type: udeb
Architecture: i386 sparc alpha m68k arm powerpc mips mipsel hppa ia64 amd64
Depends: ${shlibs:Depends}, cdebconf-udeb, dhcp-client-udeb | dhcp3-client-udeb | pump-udeb, ethernet-card-detection, libiw27-udeb
Depends: ${shlibs:Depends}, cdebconf-udeb, dhcp-client-udeb | dhcp3-client-udeb | pump-udeb, ethernet-card-detection, libiw27-udeb, mii-diag-udeb
Provides: configured-network
XB-Installer-Menu-Item: 18
Description: Configure the network
@@ -22,7 +22,7 @@ Description: Configure the network
Package: netcfg-dhcp
XC-Package-Type: udeb
Architecture: i386 sparc alpha m68k arm powerpc mips mipsel hppa ia64 amd64
Depends: ${shlibs:Depends}, cdebconf-udeb, dhcp-client-udeb | dhcp3-client-udeb | pump-udeb, ethernet-card-detection, libiw27-udeb
Depends: ${shlibs:Depends}, cdebconf-udeb, dhcp-client-udeb | dhcp3-client-udeb | pump-udeb, ethernet-card-detection, libiw27-udeb, mii-diag-udeb
Provides: configured-network
XB-Installer-Menu-Item: 18
Description: Configure the network via DHCP
@@ -37,7 +37,7 @@ Description: Configure the network via DHCP
Package: netcfg-static
XC-Package-Type: udeb
Architecture: any
Depends: ${shlibs:Depends}, cdebconf-udeb, ethernet-card-detection, libiw27-udeb
Depends: ${shlibs:Depends}, cdebconf-udeb, ethernet-card-detection, libiw27-udeb, mii-diag-udeb
Provides: configured-network
XB-Installer-Menu-Item: 20
Description: Configure a static network


+ 27
- 13
netcfg.c View File

@@ -96,19 +96,33 @@ int main(int argc, char *argv[])
state = (num_interfaces == 1) ? BACKUP : GET_INTERFACE;
else
{
method_t mii_result;
interface_up(interface);
mii_result = mii_diag_status_lite(interface);
interface_down(interface);

if (mii_result != DUNNO && res == NOT_ASKED)
netcfg_method = mii_result;

if (netcfg_method == DHCP)
state = GET_DHCP;
else
state = GET_STATIC;
char* buf;
int ret;
size_t len = sizeof("mii-diag -s ") + strlen (interface) + 1;

buf = malloc(len);
snprintf(buf, len, "mii-diag -s %s", interface);

interface_up(interface);
ret = di_exec_shell(buf);
interface_down(interface);

free(buf);

switch (ret)
{
/* SIOCGMIIPHY not supported */
case 1: di_info("link status for %s is unknown", interface); break;
/* Supported; no connection */
case 2: if (res == NOT_ASKED) netcfg_method = STATIC; break;
/* Supported; connected */
case 0: if (res == NOT_ASKED) netcfg_method = DHCP; break;
}

if (netcfg_method == DHCP)
state = GET_DHCP;
else
state = GET_STATIC;
}
break;



+ 1
- 0
netcfg.h View File

@@ -112,4 +112,5 @@ extern const char *inet_mtop (int src, char *dst, socklen_t cnt);
extern void parse_args (int argc, char** argv);
extern void open_sockets (void);

extern void netcfg_rewrite_resolv (char*, struct in_addr *);
#endif /* _NETCFG_H_ */

+ 18
- 0
static.c View File

@@ -452,6 +452,7 @@ int netcfg_get_static(struct debconfclient *client)
break;
case QUIT:
netcfg_write_common("40netcfg", ipaddress, hostname, domain);
netcfg_rewrite_resolv(domain, nameserver_array);
return 0;
break;
}
@@ -459,3 +460,20 @@ int netcfg_get_static(struct debconfclient *client)
return 0;
}

void netcfg_rewrite_resolv (char* domain, struct in_addr* nameservers)
{
FILE* fp = NULL;
char ptr1[INET_ADDRSTRLEN];

if ((fp = file_open(RESOLV_FILE, "w"))) {
int i = 0;
if (domain && !empty_str(domain))
fprintf(fp, "search %s\n", domain);

while (nameservers[i].s_addr)
fprintf(fp, "nameserver %s\n",
inet_ntop (AF_INET, &nameservers[i++], ptr1, sizeof (ptr1)));

fclose(fp);
}
}

Loading…
Cancel
Save