Lines 197-202
Link Here
|
197 |
"disable defaultroute option", OPT_ALIAS | OPT_A2CLR, |
197 |
"disable defaultroute option", OPT_ALIAS | OPT_A2CLR, |
198 |
&ipcp_wantoptions[0].default_route }, |
198 |
&ipcp_wantoptions[0].default_route }, |
199 |
|
199 |
|
|
|
200 |
{ "replacedefaultroute", o_bool, |
201 |
&ipcp_wantoptions[0].replace_default_route, |
202 |
"Replace default route", 1 |
203 |
}, |
204 |
{ "noreplacedefaultroute", o_bool, |
205 |
&ipcp_allowoptions[0].replace_default_route, |
206 |
"Never replace default route", OPT_A2COPY, |
207 |
&ipcp_wantoptions[0].replace_default_route }, |
200 |
{ "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp, |
208 |
{ "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp, |
201 |
"Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp }, |
209 |
"Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp }, |
202 |
{ "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp, |
210 |
{ "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp, |
Lines 263-269
Link Here
|
263 |
ip_active_pkt |
271 |
ip_active_pkt |
264 |
}; |
272 |
}; |
265 |
|
273 |
|
266 |
static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t)); |
274 |
static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool)); |
267 |
static void ipcp_script __P((char *, int)); /* Run an up/down script */ |
275 |
static void ipcp_script __P((char *, int)); /* Run an up/down script */ |
268 |
static void ipcp_script_done __P((void *)); |
276 |
static void ipcp_script_done __P((void *)); |
269 |
|
277 |
|
Lines 1660-1666
Link Here
|
1660 |
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE)) |
1668 |
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE)) |
1661 |
return 0; |
1669 |
return 0; |
1662 |
if (wo->default_route) |
1670 |
if (wo->default_route) |
1663 |
if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr)) |
1671 |
if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr, |
|
|
1672 |
wo->replace_default_route)) |
1664 |
default_route_set[u] = 1; |
1673 |
default_route_set[u] = 1; |
1665 |
if (wo->proxy_arp) |
1674 |
if (wo->proxy_arp) |
1666 |
if (sifproxyarp(u, wo->hisaddr)) |
1675 |
if (sifproxyarp(u, wo->hisaddr)) |
Lines 1742-1748
Link Here
|
1742 |
*/ |
1751 |
*/ |
1743 |
if (demand) { |
1752 |
if (demand) { |
1744 |
if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) { |
1753 |
if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) { |
1745 |
ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr); |
1754 |
ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr, |
|
|
1755 |
wo->replace_default_route); |
1746 |
if (go->ouraddr != wo->ouraddr) { |
1756 |
if (go->ouraddr != wo->ouraddr) { |
1747 |
warn("Local IP address changed to %I", go->ouraddr); |
1757 |
warn("Local IP address changed to %I", go->ouraddr); |
1748 |
script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0); |
1758 |
script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0); |
Lines 1767-1773
Link Here
|
1767 |
|
1777 |
|
1768 |
/* assign a default route through the interface if required */ |
1778 |
/* assign a default route through the interface if required */ |
1769 |
if (ipcp_wantoptions[f->unit].default_route) |
1779 |
if (ipcp_wantoptions[f->unit].default_route) |
1770 |
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) |
1780 |
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, |
|
|
1781 |
wo->replace_default_route)) |
1771 |
default_route_set[f->unit] = 1; |
1782 |
default_route_set[f->unit] = 1; |
1772 |
|
1783 |
|
1773 |
/* Make a proxy ARP entry if requested. */ |
1784 |
/* Make a proxy ARP entry if requested. */ |
Lines 1817-1823
Link Here
|
1817 |
|
1828 |
|
1818 |
/* assign a default route through the interface if required */ |
1829 |
/* assign a default route through the interface if required */ |
1819 |
if (ipcp_wantoptions[f->unit].default_route) |
1830 |
if (ipcp_wantoptions[f->unit].default_route) |
1820 |
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) |
1831 |
if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, |
|
|
1832 |
wo->replace_default_route)) |
1821 |
default_route_set[f->unit] = 1; |
1833 |
default_route_set[f->unit] = 1; |
1822 |
|
1834 |
|
1823 |
/* Make a proxy ARP entry if requested. */ |
1835 |
/* Make a proxy ARP entry if requested. */ |
Lines 1894-1900
Link Here
|
1894 |
sifnpmode(f->unit, PPP_IP, NPMODE_DROP); |
1906 |
sifnpmode(f->unit, PPP_IP, NPMODE_DROP); |
1895 |
sifdown(f->unit); |
1907 |
sifdown(f->unit); |
1896 |
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, |
1908 |
ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, |
1897 |
ipcp_hisoptions[f->unit].hisaddr); |
1909 |
ipcp_hisoptions[f->unit].hisaddr, 0); |
1898 |
} |
1910 |
} |
1899 |
|
1911 |
|
1900 |
/* Execute the ip-down script */ |
1912 |
/* Execute the ip-down script */ |
Lines 1910-1925
Link Here
|
1910 |
* proxy arp entries, etc. |
1922 |
* proxy arp entries, etc. |
1911 |
*/ |
1923 |
*/ |
1912 |
static void |
1924 |
static void |
1913 |
ipcp_clear_addrs(unit, ouraddr, hisaddr) |
1925 |
ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute) |
1914 |
int unit; |
1926 |
int unit; |
1915 |
u_int32_t ouraddr; /* local address */ |
1927 |
u_int32_t ouraddr; /* local address */ |
1916 |
u_int32_t hisaddr; /* remote address */ |
1928 |
u_int32_t hisaddr; /* remote address */ |
|
|
1929 |
bool replacedefaultroute; |
1917 |
{ |
1930 |
{ |
1918 |
if (proxy_arp_set[unit]) { |
1931 |
if (proxy_arp_set[unit]) { |
1919 |
cifproxyarp(unit, hisaddr); |
1932 |
cifproxyarp(unit, hisaddr); |
1920 |
proxy_arp_set[unit] = 0; |
1933 |
proxy_arp_set[unit] = 0; |
1921 |
} |
1934 |
} |
1922 |
if (default_route_set[unit]) { |
1935 |
/* If replacedefaultroute, sifdefaultroute will be called soon |
|
|
1936 |
* with replacedefaultroute set and that will overwrite the current |
1937 |
* default route. This is the case only when doing demand, otherwise |
1938 |
* during demand, this cifdefaultroute would restore the old default |
1939 |
* route which is not what we want in this case. In the non-demand |
1940 |
* case, we'll delete the default route and restore the old if there |
1941 |
* is one saved by an sifdefaultroute with replacedefaultroute. |
1942 |
*/ |
1943 |
if (!replacedefaultroute && default_route_set[unit]) { |
1923 |
cifdefaultroute(unit, ouraddr, hisaddr); |
1944 |
cifdefaultroute(unit, ouraddr, hisaddr); |
1924 |
default_route_set[unit] = 0; |
1945 |
default_route_set[unit] = 0; |
1925 |
} |
1946 |
} |