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.20 by pcg, Tue Oct 14 15:48:15 2003 UTC vs.
Revision 1.21 by pcg, Thu Oct 16 02:28:36 2003 UTC

800 reset_connection (); 800 reset_connection ();
801 establish_connection (); 801 establish_connection ();
802} 802}
803 803
804void 804void
805connection::send_data_packet (tap_packet *pkt, bool broadcast) 805connection::send_data_packet (tap_packet *pkt)
806{ 806{
807 vpndata_packet *p = new vpndata_packet; 807 vpndata_packet *p = new vpndata_packet;
808 int tos = 0; 808 int tos = 0;
809 809
810 // I am not hilarious about peeking into packets, but so be it. 810 // I am not hilarious about peeking into packets, but so be it.
811 if (conf->inherit_tos 811 if (conf->inherit_tos && pkt->is_ipv4 ())
812 && (*pkt)[12] == 0x08 && (*pkt)[13] == 0x00 // IP
813 && ((*pkt)[14] & 0xf0) == 0x40) // IPv4
814 tos = (*pkt)[15] & IPTOS_TOS_MASK; 812 tos = (*pkt)[15] & IPTOS_TOS_MASK;
815 813
816 p->setup (this, broadcast ? 0 : conf->id, &((*pkt)[6 + 6]), pkt->len - 6 - 6, ++oseqno); // skip 2 macs 814 p->setup (this, conf->id, &((*pkt)[6 + 6]), pkt->len - 6 - 6, ++oseqno); // skip 2 macs
817 send_vpn_packet (p, si, tos); 815 send_vpn_packet (p, si, tos);
818 816
819 delete p; 817 delete p;
820 818
821 if (oseqno > MAX_SEQNO) 819 if (oseqno > MAX_SEQNO)
822 rekey (); 820 rekey ();
823} 821}
824 822
825void 823void
826connection::inject_data_packet (tap_packet *pkt, bool broadcast) 824connection::inject_data_packet (tap_packet *pkt, bool broadcast/*TODO DDD*/)
827{ 825{
828 if (ictx && octx) 826 if (ictx && octx)
829 send_data_packet (pkt, broadcast); 827 send_data_packet (pkt);
830 else 828 else
831 { 829 {
832 if (!broadcast)//DDDD 830 if (!broadcast)//DDDD
833 data_queue.put (new tap_packet (*pkt)); 831 data_queue.put (new tap_packet (*pkt));
834 832
1037 1035
1038 if (iseqno.recv_ok (seqno)) 1036 if (iseqno.recv_ok (seqno))
1039 { 1037 {
1040 vpn->tap->send (d); 1038 vpn->tap->send (d);
1041 1039
1042 if (p->dst () == 0) // re-broadcast
1043 for (vpn::conns_vector::iterator i = vpn->conns.begin (); i != vpn->conns.end (); ++i)
1044 {
1045 connection *c = *i;
1046
1047 if (c->conf != THISNODE && c->conf != conf)
1048 c->inject_data_packet (d);
1049 }
1050
1051 if (si != rsi) 1040 if (si != rsi)
1052 { 1041 {
1053 // fast re-sync on connection changes, useful especially for tcp/ip 1042 // fast re-sync on connection changes, useful especially for tcp/ip
1054 si = rsi; 1043 si = rsi;
1055 1044

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines