lkml.org 
[lkml]   [1997]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Diald 0.16.4a in Linux 2.1.74 -- The Saga (still) Continues

The patch I posted would not work with the diald -reroute option. Here is
a revision.

--- diald-0.16.dist/ppp.c Mon Dec 15 22:46:24 1997
+++ diald-0.16/ppp.c Mon Dec 22 03:18:15 1997
@@ -122,6 +122,7 @@
int ppp_set_addrs()
{
ulong laddr = 0, raddr = 0;
+ int sockfd;

/* Try to get the interface number if we don't know it yet. */
if (link_iface == -1) {
@@ -140,6 +141,12 @@
SET_SA_FAMILY (ifr.ifr_dstaddr, AF_INET);
SET_SA_FAMILY (ifr.ifr_netmask, AF_INET);
sprintf(ifr.ifr_name,"ppp%d",link_iface);
+ sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sockfd < 0)
+ {
+ syslog(LOG_ERR, "Couldn't create IP socket in ppp.c: %m");
+ die(1);
+ }
if (ioctl(snoopfd, SIOCGIFFLAGS, (caddr_t) &ifr) == -1) {
syslog(LOG_ERR,"failed to read ppp interface status");
return 0;
@@ -156,12 +163,12 @@
}

/* Ok, the interface is up, grab the addresses. */
- if (ioctl(snoopfd, SIOCGIFADDR, (caddr_t) &ifr) == -1)
+ if (ioctl(sockfd, SIOCGIFADDR, (caddr_t) &ifr) == -1)
syslog(LOG_ERR,"failed to get ppp local address: %m");
else
laddr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;

- if (ioctl(snoopfd, SIOCGIFDSTADDR, (caddr_t) &ifr) == -1)
+ if (ioctl(sockfd, SIOCGIFDSTADDR, (caddr_t) &ifr) == -1)
syslog(LOG_ERR,"failed to get ppp remote address: %m");
else
raddr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;
@@ -181,7 +188,7 @@
proxy_config(orig_local_ip,orig_remote_ip);
}
}
-
+ close (sockfd);
if (dynamic_addrs) {
/* only do the configuration in dynamic mode. */
struct in_addr addr;
@@ -192,6 +199,7 @@
local_addr = laddr;
syslog(LOG_INFO,"New addresses: local %s, remote %s.",
local_ip,remote_ip);
+ }
/* have to reset the proxy if we won't be rerouting... */
if (!do_reroute) {
/* If we are rerouting, then we have a window without
@@ -199,18 +207,19 @@
* clobbers all the routes.
*/
proxy_config(local_ip,remote_ip);
- set_ptp("sl",proxy_iface,remote_ip,1);
- add_routes("sl",proxy_iface,local_ip,remote_ip,1);
+ set_ptp("sl",proxy_iface,remote_ip,0);
+ add_routes("sl",proxy_iface,local_ip,remote_ip,0);
}
- }

/* This is redundant in normal operation, but if we
* have to restart the link, then this is necessary...
*/
- set_ptp("ppp",link_iface,remote_ip,0);
+ /* set_ptp("ppp",link_iface,remote_ip,0); */

- if (do_reroute)
+ if (do_reroute){
add_routes("ppp",link_iface,local_ip,remote_ip,0);
+ del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,0);
+ }
return 1;
}
return 0;
--- diald-0.16.dist/version.h Mon Dec 15 22:46:24 1997
+++ diald-0.16/version.h Thu Dec 18 15:45:16 1997
@@ -1 +1 @@
-#define VERSION "0.16.4"
+#define VERSION "0.16.4b"

--
Shaw Carruthers - shaw@shawc.demon.co.uk
London SW14 7JW UK
This is not a sig( with homage to Magritte).



\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.027 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site