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

Comparing gvpe/src/connection.C (file contents):
Revision 1.26 by pcg, Sat Jan 17 14:08:57 2004 UTC vs.
Revision 1.28 by pcg, Tue Jan 27 05:56:35 2004 UTC

310} 310}
311 311
312#define MAXVPNDATA (MAX_MTU - 6 - 6) 312#define MAXVPNDATA (MAX_MTU - 6 - 6)
313#define DATAHDR (sizeof (u32) + RAND_SIZE) 313#define DATAHDR (sizeof (u32) + RAND_SIZE)
314 314
315struct vpndata_packet:vpn_packet 315struct vpndata_packet : vpn_packet
316 { 316 {
317 u8 data[MAXVPNDATA + DATAHDR]; // seqno 317 u8 data[MAXVPNDATA + DATAHDR]; // seqno
318 318
319 void setup (connection *conn, int dst, u8 *d, u32 len, u32 seqno); 319 void setup (connection *conn, int dst, u8 *d, u32 len, u32 seqno);
320 tap_packet *unpack (connection *conn, u32 &seqno); 320 tap_packet *unpack (connection *conn, u32 &seqno);
504 504
505struct auth_req_packet : config_packet 505struct auth_req_packet : config_packet
506{ 506{
507 char magic[8]; 507 char magic[8];
508 u8 initiate; // false if this is just an automatic reply 508 u8 initiate; // false if this is just an automatic reply
509 u8 protocols; // supported protocols (will get patches on forward) 509 u8 protocols; // supported protocols (will be patched on forward)
510 u8 pad2, pad3; 510 u8 pad2, pad3;
511 rsaid id; 511 rsaid id;
512 rsaencrdata encr; 512 rsaencrdata encr;
513 513
514 auth_req_packet (int dst, bool initiate_, u8 protocols_) 514 auth_req_packet (int dst, bool initiate_, u8 protocols_)
832{ 832{
833 if (ictx && octx) 833 if (ictx && octx)
834 send_vpn_packet (pkt, si, tos); 834 send_vpn_packet (pkt, si, tos);
835 else 835 else
836 { 836 {
837 vpn_queue.put (new vpn_packet (*pkt)); 837 vpn_queue.put ((vpn_packet *)new data_packet (*(data_packet *)pkt));
838 838
839 establish_connection (); 839 establish_connection ();
840 } 840 }
841} 841}
842 842
960 crypto_ctx *cctx = new crypto_ctx (chg, 0); 960 crypto_ctx *cctx = new crypto_ctx (chg, 0);
961 961
962 if (!p->hmac_chk (cctx)) 962 if (!p->hmac_chk (cctx))
963 { 963 {
964 slog (L_ERR, _("%s(%s): hmac authentication error on auth response, received invalid packet\n" 964 slog (L_ERR, _("%s(%s): hmac authentication error on auth response, received invalid packet\n"
965 "could be an attack, or just corruption or an synchronization error"), 965 "could be an attack, or just corruption or a synchronization error"),
966 conf->nodename, (const char *)rsi); 966 conf->nodename, (const char *)rsi);
967 break; 967 break;
968 } 968 }
969 else 969 else
970 { 970 {
1019 { 1019 {
1020 vpndata_packet *p = (vpndata_packet *)pkt; 1020 vpndata_packet *p = (vpndata_packet *)pkt;
1021 1021
1022 if (!p->hmac_chk (ictx)) 1022 if (!p->hmac_chk (ictx))
1023 slog (L_ERR, _("%s(%s): hmac authentication error, received invalid packet\n" 1023 slog (L_ERR, _("%s(%s): hmac authentication error, received invalid packet\n"
1024 "could be an attack, or just corruption or an synchronization error"), 1024 "could be an attack, or just corruption or a synchronization error"),
1025 conf->nodename, (const char *)rsi); 1025 conf->nodename, (const char *)rsi);
1026 else 1026 else
1027 { 1027 {
1028 u32 seqno; 1028 u32 seqno;
1029 tap_packet *d = p->unpack (this, seqno); 1029 tap_packet *d = p->unpack (this, seqno);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines