VirtualBox

Ticket #2759: bootp_permitExternalTftp.diff

File bootp_permitExternalTftp.diff, 2.6 KB (added by Luiz Angelo Daros de Luca, 16 years ago)

Modification of TFTPPrefix to allow external ip address

  • bootp.c

    ===================================================================              
     
    132132    struct mbuf *m;                                                             
    133133    struct bootp_t *rbp;                                                       
    134134    struct sockaddr_in saddr, daddr;                                           
    135     struct in_addr dns_addr_dhcp;                                              
     135    struct in_addr dns_addr_dhcp, tftp_server;                                 
    136136    int dhcp_msg_type, val;                                                     
    137137    uint8_t *q;                                                                 
    138138    struct in_addr requested_ip; /* the requested IP in DHCPREQUEST */         
     
    200200        }                                                                       
    201201    }                                                                           
    202202                                                                               
    203     if (   tftp_prefix                                                         
    204         && RTDirExists(tftp_prefix)                                             
    205         && bootp_filename)                                                     
    206         RTStrPrintf((char*)rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
    207                                                                                      
    208203    saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);           
    209204    saddr.sin_port = htons(BOOTP_SERVER);                                           
    210205
     
    218213
    219214    rbp->bp_yiaddr = daddr.sin_addr; /* Client IP address */
    220215    rbp->bp_siaddr = saddr.sin_addr; /* Server IP address */
     216    if (tftp_prefix
     217        && bootp_filename) {
     218        if (RTDirExists(tftp_prefix)) {
     219            RTStrPrintf((char*)rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
     220        } else if (inet_aton(tftp_prefix, &tftp_server)) {
     221            RTStrPrintf((char*)rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
     222            /* Replace Server IP with external TFTP Server */
     223            rbp->bp_siaddr = tftp_server; /* Next Server IP address*/
     224        }
     225    }
    221226
    222227    q = rbp->bp_vend;
    223228    memcpy(q, rfc1533_cookie, 4);

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy