+/*
+ * ipcp_demand_conf - configure the interface as though
+ * IPCP were up, for use with dial-on-demand.
+ */
+int
+ipcp_demand_conf(u)
+ int u;
+{
+ ipcp_options *wo = &ipcp_wantoptions[u];
+
+ if (!sifaddr(u, wo->ouraddr, wo->hisaddr, GetMask(wo->ouraddr)))
+ return 0;
+ if (!sifup(u))
+ return 0;
+ if (wo->default_route)
+ if (sifdefaultroute(u, wo->hisaddr))
+ default_route_set[u] = 1;
+ if (wo->proxy_arp)
+ if (sifproxyarp(u, wo->hisaddr))
+ proxy_arp_set[u] = 1;
+
+ syslog(LOG_NOTICE, "local IP address %s", ip_ntoa(wo->ouraddr));
+ syslog(LOG_NOTICE, "remote IP address %s", ip_ntoa(wo->hisaddr));
+
+ return 1;
+}
+
+
+/*
+ * ipcp_demand_reset - reset the interface, which has been
+ * configured for dial-on-demand.
+ */
+void
+ipcp_demand_reset(u)
+ int u;
+{
+ ipcp_options *wo = &ipcp_wantoptions[u];
+
+ if (proxy_arp_set[u]) {
+ cifproxyarp(u, wo->hisaddr);
+ proxy_arp_set[u] = 0;
+ }
+ if (default_route_set[u]) {
+ cifdefaultroute(u, wo->hisaddr);
+ default_route_set[u] = 0;
+ }
+ sifdown(u);
+ cifaddr(u, wo->ouraddr, wo->hisaddr);
+}
+
+