Browse Source

don't add auto OR hotplug lines for PCMCIA devices

r17275
master
Joshua Kwan 18 years ago
parent
commit
c55a9faddf
  1. 2
      dhcp.c
  2. 26
      netcfg-common.c
  3. 1
      netcfg.h
  4. 2
      static.c

2
dhcp.c

@ -38,7 +38,7 @@ static void netcfg_write_dhcp (char *iface, char *dhostname)
if ((fp = file_open(INTERFACES_FILE, "a"))) {
fprintf(fp, "\n# The primary network interface\n");
if (!iface_is_hotpluggable(iface))
if (!iface_is_hotpluggable(iface) && !find_in_stab(iface))
fprintf(fp, "auto %s\n", iface);
fprintf(fp, "iface %s inet dhcp\n", iface);
if (dhostname)

26
netcfg-common.c

@ -186,6 +186,30 @@ int get_all_ifs (int all, char*** ptr)
return len;
}
short find_in_stab(const char* iface)
{
FILE *dn = NULL;
char buf[128];
size_t len = strlen(iface);
if (access("/var/run/stab", F_OK) == -1)
return 0;
if (!(dn = popen("grep -v '^Socket' /var/run/stab | cut -f5", "r")))
return 0;
while (fgets (buf, 128, dn) != NULL)
{
if (!strncmp(buf, iface, len))
{
pclose(dn);
return 1;
}
}
pclose(dn);
return 0;
}
char *find_in_devnames(const char* iface)
{
FILE* dn = NULL;
@ -542,7 +566,7 @@ void netcfg_write_common(struct in_addr ipaddress, char *hostname, char *domain)
fprintf(fp, "\n# The loopback network interface\n");
fprintf(fp, "auto lo\n");
fprintf(fp, "iface lo inet loopback\n");
if (interface && iface_is_hotpluggable(interface)) {
if (interface && iface_is_hotpluggable(interface) && !find_in_stab(interface)) {
fprintf(fp, "\n");
fprintf(fp, "# This is a list of hotpluggable network interfaces.\n");
fprintf(fp, "# They will be activated automatically by the "

1
netcfg.h

@ -107,6 +107,7 @@ extern int netcfg_wireless_set_essid (struct debconfclient *client, char* iface,
extern int netcfg_wireless_set_wep (struct debconfclient *client, char* iface);
extern int iface_is_hotpluggable(const char *iface);
extern short find_in_stab (const char *iface);
extern void deconfigure_network(void);
extern void interface_up (char*);

2
static.c

@ -245,7 +245,7 @@ static int netcfg_write_static(char *domain, struct in_addr nameservers[])
if ((fp = file_open(INTERFACES_FILE, "a"))) {
fprintf(fp, "\n# The primary network interface\n");
if (!iface_is_hotpluggable(interface))
if (!iface_is_hotpluggable(interface) && !find_in_stab(interface))
fprintf(fp, "auto %s\n", interface);
fprintf(fp, "iface %s inet static\n", interface);
fprintf(fp, "\taddress %s\n", inet_ntop (AF_INET, &ipaddress, ptr1, sizeof (ptr1)));

Loading…
Cancel
Save