Changeset 27fc03


Ignore:
Timestamp:
06/11/09 21:52:42 (3 years ago)
Author:
Erik Ekman <yarrick@…>
Branches:
master
Children:
3eef14
Parents:
894ca2
git-author:
Erik Ekman <yarrick@…> (06/11/09 21:52:42)
git-committer:
Erik Ekman <erik@…> (02/04/12 20:34:02)
Message:

#36, add way to request ip address from server

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/iodined.c

    raddd79 r27fc03  
    390390                } 
    391391                return; 
     392        } else if(in[0] == 'I' || in[0] == 'i') { 
     393                /* Request for IP number */ 
     394                in_addr_t replyaddr; 
     395                unsigned addr; 
     396                char reply[5]; 
     397                 
     398                userid = b32_8to5(in[1]); 
     399                if (check_user_and_ip(userid, q) != 0) { 
     400                        write_dns(dns_fd, q, "BADIP", 5); 
     401                        return; /* illegal id */ 
     402                } 
     403 
     404                if (ns_ip != INADDR_ANY) { 
     405                        /* If set, use assigned external ip (-n option) */ 
     406                        replyaddr = ns_ip; 
     407                } else { 
     408                        /* otherwise return destination ip from packet */ 
     409                        memcpy(&replyaddr, &q->destination.s_addr, sizeof(in_addr_t)); 
     410                } 
     411 
     412                addr = htonl(replyaddr); 
     413                reply[0] = 'I'; 
     414                reply[1] = (addr >> 24) & 0xFF; 
     415                reply[2] = (addr >> 16) & 0xFF; 
     416                reply[3] = (addr >>  8) & 0xFF; 
     417                reply[4] = (addr >>  0) & 0xFF; 
     418                write_dns(dns_fd, q, reply, sizeof(reply)); 
    392419        } else if(in[0] == 'Z' || in[0] == 'z') { 
    393420                /* Check for case conservation and chars not allowed according to RFC */ 
     
    601628 
    602629        if (ns_ip != INADDR_ANY) { 
     630                /* If ns_ip set, overwrite destination addr with it. 
     631                 * Destination addr will be sent as additional record (A, IN) */ 
    603632                memcpy(&q->destination.s_addr, &ns_ip, sizeof(in_addr_t)); 
    604633        } 
  • src/version.h

    r8463d2 r27fc03  
    2020/* This is the version of the network protocol 
    2121   It is usually equal to the latest iodine version number */ 
    22 #define VERSION 0x00000500 
     22#define VERSION 0x00000501 
    2323 
    2424#endif /* _VERSION_H_ */ 
Note: See TracChangeset for help on using the changeset viewer.