Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 296267 | Differences between
and this patch

Collapse All | Expand All

(-)ppp-2.4.4.orig/pppd/options.c (+8 lines)
Lines 100-105 Link Here
100
char	user[MAXNAMELEN];	/* Username for PAP */
100
char	user[MAXNAMELEN];	/* Username for PAP */
101
char	passwd[MAXSECRETLEN];	/* Password for PAP */
101
char	passwd[MAXSECRETLEN];	/* Password for PAP */
102
bool	persist = 0;		/* Reopen link after it goes down */
102
bool	persist = 0;		/* Reopen link after it goes down */
103
bool	killoldaddr = 0;		/* If our IP is reassigned on
104
				    reconnect, kill active TCP
105
				     connections using the old IP. */
103
char	our_name[MAXNAMELEN];	/* Our name for authentication purposes */
106
char	our_name[MAXNAMELEN];	/* Our name for authentication purposes */
104
bool	demand = 0;		/* do dial-on-demand */
107
bool	demand = 0;		/* do dial-on-demand */
105
char	*ipparam = NULL;	/* Extra parameter for ip up/down scripts */
108
char	*ipparam = NULL;	/* Extra parameter for ip up/down scripts */
Lines 231-236 Link Here
231
    { "demand", o_bool, &demand,
234
    { "demand", o_bool, &demand,
232
      "Dial on demand", OPT_INITONLY | 1, &persist },
235
      "Dial on demand", OPT_INITONLY | 1, &persist },
233
236
237
    { "killoldaddr", o_bool, &killoldaddr,
238
      "Kill connections from an old source address", 1},
239
    { "nokilloldaddr", o_bool,&killoldaddr,
240
      "Don't kill connections from an old source address" },
241
234
    { "--version", o_special_noarg, (void *)showversion,
242
    { "--version", o_special_noarg, (void *)showversion,
235
      "Show version number" },
243
      "Show version number" },
236
    { "--help", o_special_noarg, (void *)showhelp,
244
    { "--help", o_special_noarg, (void *)showhelp,
(-)ppp-2.4.4.orig/pppd/pppd.h (+3 lines)
Lines 297-302 Link Here
297
extern char	remote_name[MAXNAMELEN]; /* Peer's name for authentication */
297
extern char	remote_name[MAXNAMELEN]; /* Peer's name for authentication */
298
extern bool	explicit_remote;/* remote_name specified with remotename opt */
298
extern bool	explicit_remote;/* remote_name specified with remotename opt */
299
extern bool	demand;		/* Do dial-on-demand */
299
extern bool	demand;		/* Do dial-on-demand */
300
extern bool	killoldaddr;	/* If our IP is reassigned on
301
				    reconnect, kill active TCP
302
				     connections using the old IP. */
300
extern char	*ipparam;	/* Extra parameter for ip up/down scripts */
303
extern char	*ipparam;	/* Extra parameter for ip up/down scripts */
301
extern bool	cryptpap;	/* Others' PAP passwords are encrypted */
304
extern bool	cryptpap;	/* Others' PAP passwords are encrypted */
302
extern int	idle_time_limit;/* Shut down link if idle for this long */
305
extern int	idle_time_limit;/* Shut down link if idle for this long */
(-)ppp-2.4.4.orig/pppd/sys-linux.c (-7 / +42 lines)
Lines 165-170 Link Here
165
165
166
#endif /* INET6 */
166
#endif /* INET6 */
167
167
168
#ifndef SIOCKILLADDR
169
#define SIOCKILLADDR	0x8939
170
#endif
171
168
/* We can get an EIO error on an ioctl if the modem has hung up */
172
/* We can get an EIO error on an ioctl if the modem has hung up */
169
#define ok_error(num) ((num)==EIO)
173
#define ok_error(num) ((num)==EIO)
170
174
Lines 209-214 Link Here
209
static u_int32_t proxy_arp_addr;	/* Addr for proxy arp entry added */
213
static u_int32_t proxy_arp_addr;	/* Addr for proxy arp entry added */
210
static char proxy_arp_dev[16];		/* Device for proxy arp entry */
214
static char proxy_arp_dev[16];		/* Device for proxy arp entry */
211
static u_int32_t our_old_addr;		/* for detecting address changes */
215
static u_int32_t our_old_addr;		/* for detecting address changes */
216
static u_int32_t our_current_addr;
212
static int	dynaddr_set;		/* 1 if ip_dynaddr set */
217
static int	dynaddr_set;		/* 1 if ip_dynaddr set */
213
static int	looped;			/* 1 if using loop */
218
static int	looped;			/* 1 if using loop */
214
static int	link_mtu;		/* mtu for the link (not bundle) */
219
static int	link_mtu;		/* mtu for the link (not bundle) */
Lines 537-542 Link Here
537
    return -1;
542
    return -1;
538
}
543
}
539
544
545
static void do_killaddr(u_int32_t oldaddr)
546
{
547
    struct ifreq   ifr; 
548
549
    memset(&ifr,0,sizeof ifr);
550
551
    SET_SA_FAMILY (ifr.ifr_addr,    AF_INET); 
552
    SET_SA_FAMILY (ifr.ifr_dstaddr, AF_INET); 
553
    SET_SA_FAMILY (ifr.ifr_netmask, AF_INET); 
554
    
555
    SIN_ADDR(ifr.ifr_addr) = oldaddr;
556
557
    strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
558
    
559
    if(ioctl(sock_fd,SIOCKILLADDR,&ifr) < 0) {
560
      if (!ok_error (errno))
561
	error("ioctl(SIOCKILLADDR): %m(%d)", errno);
562
      return;
563
    }
564
}
565
540
/********************************************************************
566
/********************************************************************
541
 *
567
 *
542
 * tty_disestablish_ppp - Restore the serial port to normal operation.
568
 * tty_disestablish_ppp - Restore the serial port to normal operation.
Lines 2366-2386 Link Here
2366
	}
2392
	}
2367
    }
2393
    }
2368
2394
2369
    /* set ip_dynaddr in demand mode if address changes */
2395
    if(persist && our_old_addr && our_old_addr != our_adr) {
2370
    if (demand && tune_kernel && !dynaddr_set
2396
2371
	&& our_old_addr && our_old_addr != our_adr) {
2397
      if(killoldaddr)
2398
	do_killaddr(our_old_addr);
2399
2400
	
2401
      /* set ip_dynaddr in persist mode if address changes */
2402
      if (tune_kernel && !dynaddr_set) {
2372
	/* set ip_dynaddr if possible */
2403
	/* set ip_dynaddr if possible */
2373
	char *path;
2404
	char *path;
2374
	int fd;
2405
	int fd;
2375
2406
2376
	path = path_to_procfs("/sys/net/ipv4/ip_dynaddr");
2407
	path = path_to_procfs("/sys/net/ipv4/ip_dynaddr");
2377
	if (path != 0 && (fd = open(path, O_WRONLY)) >= 0) {
2408
	if (path != 0 && (fd = open(path, O_WRONLY)) >= 0) {
2378
	    if (write(fd, "1", 1) != 1)
2409
	  if (write(fd, "1", 1) != 1)
2379
		error("Couldn't enable dynamic IP addressing: %m");
2410
	    error("Couldn't enable dynamic IP addressing: %m");
2380
	    close(fd);
2411
	  close(fd);
2381
	}
2412
	}
2382
	dynaddr_set = 1;	/* only 1 attempt */
2413
	dynaddr_set = 1;	/* only 1 attempt */
2414
      }
2383
    }
2415
    }
2416
2417
    our_current_addr = our_adr;
2384
    our_old_addr = 0;
2418
    our_old_addr = 0;
2385
2419
2386
    return 1;
2420
    return 1;
Lines 2436-2442 Link Here
2436
    }
2470
    }
2437
2471
2438
    our_old_addr = our_adr;
2472
    our_old_addr = our_adr;
2439
2473
    our_current_addr = 0;
2474
    
2440
    return 1;
2475
    return 1;
2441
}
2476
}
2442
2477

Return to bug 296267