From 45158cfd721d1689edb6cd69b4c482eb68c7bea0 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Thu, 23 Dec 1999 01:25:33 +0000 Subject: [PATCH] add ip_{up,down}_hook --- pppd/ipcp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pppd/ipcp.c b/pppd/ipcp.c index d273f50..b5749ac 100644 --- a/pppd/ipcp.c +++ b/pppd/ipcp.c @@ -17,7 +17,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define RCSID "$Id: ipcp.c,v 1.51 1999/11/15 01:51:51 paulus Exp $" +#define RCSID "$Id: ipcp.c,v 1.52 1999/12/23 01:25:33 paulus Exp $" /* * TODO: @@ -47,6 +47,12 @@ ipcp_options ipcp_hisoptions[NUM_PPP]; /* Options that we ack'd */ bool disable_defaultip = 0; /* Don't use hostname for default IP adrs */ +/* Hook for a plugin to know when IP protocol has come up */ +void (*ip_up_hook) __P((void)) = NULL; + +/* Hook for a plugin to know when IP protocol has come down */ +void (*ip_down_hook) __P((void)) = NULL; + /* local vars */ static int default_route_set[NUM_PPP]; /* Have set up a default route */ static int proxy_arp_set[NUM_PPP]; /* Have created proxy arp entry */ @@ -1507,6 +1513,9 @@ ipcp_up(f) np_up(f->unit, PPP_IP); ipcp_is_up = 1; + if (ip_up_hook) + ip_up_hook(); + /* * Execute the ip-up script, like this: * /etc/ppp/ip-up interface tty speed local-IP remote-IP @@ -1532,6 +1541,8 @@ ipcp_down(f) /* XXX a bit IPv4-centric here, we only need to get the stats * before the interface is marked down. */ update_link_stats(f->unit); + if (ip_down_hook) + ip_down_hook(); if (ipcp_is_up) { ipcp_is_up = 0; np_down(f->unit, PPP_IP); -- 2.39.2