mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 19:23:24 +02:00
Korrekturen bei der Erkennung der Netzwerkkarten am Installer vorgenommen.
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@618 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -2,18 +2,10 @@
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
install)
|
install)
|
||||||
kudzu -qps -c NETWORK | egrep "desc|network.hwaddr|driver" | \
|
kudzu -qps -c NETWORK | egrep "desc|network.hwaddr|driver" > /tmp/scanned_nics 2>/dev/null
|
||||||
awk -F": " '{ print $2";" }' | sed -e '/..:..:..:..:..:..;/a\X' | \
|
|
||||||
tr "\n" "X" | sed -e 's/XXX/\n/g' -e 's/;X/;/g' | \
|
|
||||||
sort > /tmp/scanned_nics 2>/dev/null
|
|
||||||
;;
|
;;
|
||||||
"")
|
"")
|
||||||
if [ ! -e /var/ipfire/ethernet/scan_lock ]; then
|
kudzu -qps -c NETWORK | egrep "desc|network.hwaddr|driver" > /var/ipfire/ethernet/scanned_nics 2>/dev/null
|
||||||
kudzu -qps -c NETWORK | egrep "desc|network.hwaddr|driver" | \
|
|
||||||
awk -F": " '{ print $2";" }' | sed -e '/..:..:..:..:..:..;/a\X' | \
|
|
||||||
tr "\n" "X" | sed -e "s/XXX/\n/g" -e 's/;X/;/g' | \
|
|
||||||
sort > /var/ipfire/ethernet/scanned_nics 2>/dev/null
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -354,16 +354,17 @@ void strupper(unsigned char *string)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int ismacaddr(unsigned int *ismac)
|
/* int ismacaddr(char *ismac)
|
||||||
{
|
{
|
||||||
unsigned int *a;
|
char *a;
|
||||||
|
fprintf(flog,"Check is MAC true\n"); // #### Debug ####
|
||||||
for (a = ismac; *a; a++)
|
for (a = ismac; *a; a++) {
|
||||||
|
sprintf(flog,"%c\n", *a); // #### Debug ####
|
||||||
if (*a != ':' && !isxdigit(*a)) return 0; // is int != ':' or not hexdigit then exit
|
if (*a != ':' && !isxdigit(*a)) return 0; // is int != ':' or not hexdigit then exit
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
int write_configs_netudev(int card , int colour)
|
int write_configs_netudev(int card , int colour)
|
||||||
{
|
{
|
||||||
@@ -428,6 +429,9 @@ int scan_network_cards(void)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
char driver[STRING_SIZE], description[STRING_SIZE], macaddr[STRING_SIZE], temp_line[STRING_SIZE];
|
char driver[STRING_SIZE], description[STRING_SIZE], macaddr[STRING_SIZE], temp_line[STRING_SIZE];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
const char _driver[]="driver: ";
|
||||||
|
const char _desc[]="desc: ";
|
||||||
|
const char _network_hwaddr[]="network.hwaddr: ";
|
||||||
|
|
||||||
if (!(scanned_nics_read_done))
|
if (!(scanned_nics_read_done))
|
||||||
{
|
{
|
||||||
@@ -441,17 +445,11 @@ int scan_network_cards(void)
|
|||||||
}
|
}
|
||||||
while (fgets(temp_line, STRING_SIZE, fp) != NULL)
|
while (fgets(temp_line, STRING_SIZE, fp) != NULL)
|
||||||
{
|
{
|
||||||
strcpy(driver, strtok(temp_line,";"));
|
temp_line[strlen(temp_line) -1] = 0;
|
||||||
strcpy(description, strtok(NULL,";"));
|
if ( strncmp(temp_line, _driver, strlen(_driver)) == 0 ) sprintf(nics[count].driver, "%s", temp_line+strlen(_driver));
|
||||||
strcpy(macaddr, strtok(NULL,";"));
|
if ( strncmp(temp_line, _desc, strlen(_desc)) == 0 ) sprintf(nics[count].description, "%s", temp_line+strlen(_desc));
|
||||||
fprintf(flog,"Check 4 MacAddr.\n"); // #### Debug ####
|
if ( strncmp(temp_line, _network_hwaddr, strlen(_network_hwaddr)) == 0 ) sprintf(nics[count].macaddr, "%s", temp_line+strlen(_network_hwaddr));
|
||||||
if ( strlen(macaddr) ) {
|
if (strlen(nics[count].macaddr) > 15 ) count++;
|
||||||
// if ( ismacaddr(&macaddr) ) {
|
|
||||||
strcpy(nics[count].driver , driver );
|
|
||||||
strcpy(nics[count].description , description );
|
|
||||||
strcpy(nics[count].macaddr , macaddr );
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
scanned_nics_read_done = count;
|
scanned_nics_read_done = count;
|
||||||
@@ -501,12 +499,15 @@ int nicmenu(int colour)
|
|||||||
else {
|
else {
|
||||||
fprintf(flog,"Modify string 4 display.\n"); // #### Debug ####
|
fprintf(flog,"Modify string 4 display.\n"); // #### Debug ####
|
||||||
sprintf(cMenuInhalt, "%.50s", nics[i].description + 1);
|
sprintf(cMenuInhalt, "%.50s", nics[i].description + 1);
|
||||||
|
fprintf(flog,"1: %s\n"); // #### Debug ####
|
||||||
// strncpy(MenuInhalt[mcount], cMenuInhalt,(strrchr(cMenuInhalt,' ') - cMenuInhalt));
|
// strncpy(MenuInhalt[mcount], cMenuInhalt,(strrchr(cMenuInhalt,' ') - cMenuInhalt));
|
||||||
sprintf(MenuInhalt[mcount], "%.*s", strlen(strrchr(cMenuInhalt,' ')), cMenuInhalt);
|
// sprintf(MenuInhalt[mcount], "%.*s", strlen(strrchr(cMenuInhalt,' ')), cMenuInhalt);
|
||||||
|
strrchr(cMenuInhalt,' ');
|
||||||
|
sprintf(MenuInhalt[mcount], cMenuInhalt);
|
||||||
strcat (MenuInhalt[mcount], "...");
|
strcat (MenuInhalt[mcount], "...");
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( strlen(MenuInhalt[mcount]) < 50) strcat(MenuInhalt[mcount], " "); // Fill with space.
|
while ( strlen(MenuInhalt[mcount]) < 53) strcat(MenuInhalt[mcount], " "); // Fill with space.
|
||||||
|
|
||||||
strcat(MenuInhalt[mcount], " (");
|
strcat(MenuInhalt[mcount], " (");
|
||||||
strcat(MenuInhalt[mcount], nics[i].macaddr);
|
strcat(MenuInhalt[mcount], nics[i].macaddr);
|
||||||
|
|||||||
Reference in New Issue
Block a user