… | |
… | |
70 | #define MAX_SEND_INTERVAL 5. // optimistic? |
70 | #define MAX_SEND_INTERVAL 5. // optimistic? |
71 | |
71 | |
72 | #define MAX_WINDOW 1000 // max. for MAX_OUTSTANDING, and backlog |
72 | #define MAX_WINDOW 1000 // max. for MAX_OUTSTANDING, and backlog |
73 | #define MAX_BACKLOG (64*1024) // size of gvpe protocol backlog (bytes), must be > MAXSIZE |
73 | #define MAX_BACKLOG (64*1024) // size of gvpe protocol backlog (bytes), must be > MAXSIZE |
74 | |
74 | |
75 | #define MAX_DOMAIN_SIZE 240 // 255 is legal limit, but bind doesn't compress well |
75 | #define MAX_DOMAIN_SIZE 235 // 255 is legal limit, but bind doesn't compress well |
76 | // 240 leaves about 4 bytes of server reply data |
76 | // 240 leaves about 4 bytes of server reply data |
77 | // every request byte less give room for two reply bytes |
77 | // every request byte less give room for two reply bytes |
78 | |
78 | |
79 | #define SEQNO_MASK 0x3fff |
79 | #define SEQNO_MASK 0x3fff |
80 | #define SEQNO_EQ(a,b) ( 0 == ( ((a) ^ (b)) & SEQNO_MASK) ) |
80 | #define SEQNO_EQ(a,b) ( 0 == ( ((a) ^ (b)) & SEQNO_MASK) ) |
… | |
… | |
590 | static |
590 | static |
591 | u16 next_id () |
591 | u16 next_id () |
592 | { |
592 | { |
593 | static u16 dns_id = 0; // TODO: should be per-vpn |
593 | static u16 dns_id = 0; // TODO: should be per-vpn |
594 | |
594 | |
|
|
595 | #if 1 |
595 | if (!dns_id) |
596 | if (!dns_id) |
596 | dns_id = time (0); |
597 | dns_id = time (0); |
597 | |
598 | |
598 | // the simplest lsfr with periodicity 65535 i could find |
599 | // the simplest lsfr with periodicity 65535 i could find |
599 | dns_id = (dns_id << 1) |
600 | dns_id = (dns_id << 1) |
… | |
… | |
601 | ^ (dns_id >> 2) |
602 | ^ (dns_id >> 2) |
602 | ^ (dns_id >> 4) |
603 | ^ (dns_id >> 4) |
603 | ^ (dns_id >> 15)) & 1); |
604 | ^ (dns_id >> 15)) & 1); |
604 | |
605 | |
605 | return dns_id; |
606 | return dns_id; |
|
|
607 | #else |
|
|
608 | dns_id++;//D |
|
|
609 | |
|
|
610 | return htons (dns_id); |
|
|
611 | #endif |
606 | } |
612 | } |
607 | |
613 | |
608 | struct dns_rcv; |
614 | struct dns_rcv; |
609 | struct dns_snd; |
615 | struct dns_snd; |
610 | |
616 | |