ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/vpn_dns.C
(Generate patch)

Comparing gvpe/src/vpn_dns.C (file contents):
Revision 1.52 by root, Sun Mar 6 21:01:37 2011 UTC vs.
Revision 1.53 by root, Tue Oct 18 10:54:17 2011 UTC

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) )
590static 590static
591u16 next_id () 591u16 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
608struct dns_rcv; 614struct dns_rcv;
609struct dns_snd; 615struct dns_snd;
610 616

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines