Changeset 2887 in MondoRescue for branches/2.2.9/mondo/src


Ignore:
Timestamp:
Oct 9, 2011, 1:03:19 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Adds support for hwaddr (MAC addresses) at restore time, and map to the correct NIC if it's found at restore time (based on code from Stefan Heijmans)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-files.c

    r2847 r2887  
    11031103    /*@ buffers ******** */
    11041104    char netfs_dev[MAX_STR_LEN];
    1105     char mac_addr[MAX_STR_LEN];
    11061105    char netfs_mount[MAX_STR_LEN];
     1106    char netfs_client_hwaddr[MAX_STR_LEN];
    11071107    char netfs_client_ipaddr[MAX_STR_LEN];
    11081108    char netfs_client_netmask[MAX_STR_LEN];
     
    11311131            "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
    11321132    strcpy(netfs_dev, call_program_and_get_last_line_of_output(command));
     1133    sprintf(command,
     1134            "ifconfig %s | head -1 | awk '{print $5}'", netfs_dev);
     1135    strcpy(netfs_client_hwaddr, call_program_and_get_last_line_of_output(command));
    11331136    sprintf(command,
    11341137            "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
     
    11481151           call_program_and_get_last_line_of_output(command));
    11491152    sprintf(tmp,
    1150             "netfs_client_ipaddr=%s; netfs_server_ipaddr=%s; netfs_mount=%s",
    1151             netfs_client_ipaddr, netfs_server_ipaddr, netfs_mount);
     1153            "netfs_client_hwaddr=%s; netfs_client_ipaddr=%s; netfs_server_ipaddr=%s; netfs_mount=%s",
     1154            netfs_client_hwaddr, netfs_client_ipaddr, netfs_server_ipaddr, netfs_mount);
    11521155    if (strlen(netfs_dev) < 2) {
    11531156        fatal_error
     
    11661169        log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", netfs_dev);
    11671170        sprintf(command,
    1168                 "ifconfig %s | awk '{print $5}' | head -n1", netfs_dev);
    1169         strcpy(mac_addr, call_program_and_get_last_line_of_output(command));
    1170         sprintf(command,
    1171                 "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,netfs_dev);
     1171                "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1",netfs_client_hwaddr,netfs_dev);
    11721172        strcpy(netfs_dev, call_program_and_get_last_line_of_output(command));
    11731173        log_to_screen("Replacing it with %s\n", netfs_dev);
     
    11801180    write_one_liner_data_file(tmp, bkpinfo->netfs_proto);
    11811181
     1182    sprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir);
     1183    write_one_liner_data_file(tmp, netfs_client_hwaddr);
    11821184    sprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    11831185    write_one_liner_data_file(tmp, netfs_client_ipaddr);
Note: See TracChangeset for help on using the changeset viewer.