1 Index: ppp-2.4.3/pppd/demand.c
2 ===================================================================
3 --- ppp-2.4.3.orig/pppd/demand.c 2007-06-04 13:22:08.217606016 +0200
4 +++ ppp-2.4.3/pppd/demand.c 2007-06-04 13:22:11.613089824 +0200
11 #include <sys/param.h>
12 #include <sys/types.h>
15 #include <sys/resource.h>
17 #include <sys/socket.h>
18 +#include <netinet/in.h>
19 +#include <arpa/inet.h>
28 +/* check for synchronous connection... */
30 + if ( (p[0] == 0xFF) && (p[1] == 0x03) ) {
31 + rv = loop_frame(p,n);
38 @@ -299,17 +311,102 @@
39 * loopback, now that the real serial link is up.
43 +demand_rexmit(proto, newip)
47 struct packet *pkt, *prev, *nextpkt;
48 + unsigned short checksum;
49 + unsigned short pkt_checksum = 0;
60 + select(0,NULL,NULL,NULL,&tv); /* Sleep for 1 Seconds */
61 for (; pkt != NULL; pkt = nextpkt) {
63 if (PPP_PROTOCOL(pkt->data) == proto) {
64 + if ( (proto == PPP_IP) && newip ) {
65 + /* Get old checksum */
67 + iphdr = (pkt->data[4] & 15) << 2;
68 + checksum = *((unsigned short *) (pkt->data+14));
69 + if (checksum == 0xFFFF) {
74 + if (pkt->data[13] == 17) {
75 + pkt_checksum = *((unsigned short *) (pkt->data+10+iphdr));
78 + if (pkt_checksum == 0xFFFF) {
87 + if (pkt->data[13] == 6) {
88 + pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr));
90 + if (pkt_checksum == 0xFFFF) {
95 + /* Delete old Source-IP-Address */
96 + checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
97 + checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
99 + pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
100 + pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
102 + /* Change Source-IP-Address */
103 + * ((u_int32_t *) (pkt->data + 16)) = newip;
105 + /* Add new Source-IP-Address */
106 + checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
107 + checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
109 + pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
110 + pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
112 + /* Write new checksum */
116 + *((unsigned short *) (pkt->data+14)) = checksum;
117 + if (pkt->data[13] == 6) {
118 + *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum;
120 + if (cv && (pkt->data[13] == 17) ) {
121 + *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum;
125 + strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16))));
126 + if (pkt->data[13] == 1) {
127 + syslog(LOG_INFO,"Open ICMP %s -> %s\n",
129 + inet_ntoa(*( (struct in_addr *) (pkt->data+20))));
131 + syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n",
132 + pkt->data[13] == 6 ? "TCP" : "UDP",
134 + ntohs(*( (short *) (pkt->data+iphdr+4))),
135 + inet_ntoa(*( (struct in_addr *) (pkt->data+20))),
136 + ntohs(*( (short *) (pkt->data+iphdr+6))));
139 output(0, pkt->data, pkt->length);
142 Index: ppp-2.4.3/pppd/ipcp.c
143 ===================================================================
144 --- ppp-2.4.3.orig/pppd/ipcp.c 2007-06-04 13:22:11.387124176 +0200
145 +++ ppp-2.4.3/pppd/ipcp.c 2007-06-04 13:22:11.614089672 +0200
146 @@ -1796,7 +1796,7 @@
147 proxy_arp_set[f->unit] = 1;
150 - demand_rexmit(PPP_IP);
151 + demand_rexmit(PPP_IP,go->ouraddr);
152 sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
155 Index: ppp-2.4.3/pppd/ipv6cp.c
156 ===================================================================
157 --- ppp-2.4.3.orig/pppd/ipv6cp.c 2007-06-04 13:22:08.229604192 +0200
158 +++ ppp-2.4.3/pppd/ipv6cp.c 2007-06-04 13:22:11.614089672 +0200
159 @@ -1232,7 +1232,7 @@
163 - demand_rexmit(PPP_IPV6);
164 + demand_rexmit(PPP_IPV6,0);
165 sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
168 Index: ppp-2.4.3/pppd/pppd.h
169 ===================================================================
170 --- ppp-2.4.3.orig/pppd/pppd.h 2007-06-04 13:22:11.388124024 +0200
171 +++ ppp-2.4.3/pppd/pppd.h 2007-06-04 13:22:11.615089520 +0200
173 void demand_block __P((void)); /* set all NPs to queue up packets */
174 void demand_unblock __P((void)); /* set all NPs to pass packets */
175 void demand_discard __P((void)); /* set all NPs to discard packets */
176 -void demand_rexmit __P((int)); /* retransmit saved frames for an NP */
177 +void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/
178 int loop_chars __P((unsigned char *, int)); /* process chars from loopback */
179 int loop_frame __P((unsigned char *, int)); /* should we bring link up? */