5 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <netinet/in.h>
27 #include <arpa/inet.h>
29 #include <pppd/pppd.h>
31 #include <pppd/ipcp.h>
33 static void notifier_phasechange(void *data, int arg)
35 printf("phasechange: data %p arg %d\n", data, arg);
38 static void notifier_exit(void *data, int arg)
40 printf("exitnotify: data %p arg %d\n", data, arg);
43 static void notifier_ipup(void *data, int arg)
45 ipcp_options opts = ipcp_gotoptions[0];
46 ipcp_options peer = ipcp_hisoptions[0];
48 printf("ipup: data %p arg %d\n", data, arg);
50 printf("%s: %s -> %s\n", ifname,
51 inet_ntoa(*((struct in_addr *) &opts.ouraddr)),
52 inet_ntoa(*((struct in_addr *) &peer.hisaddr)));
54 script_unsetenv("USEPEERDNS");
55 script_unsetenv("DNS1");
56 script_unsetenv("DNS2");
59 static void notifier_ipdown(void *data, int arg)
61 printf("ipdown: data %p arg %d\n", data, arg);
64 char pppd_version[] = VERSION;
66 int plugin_init(void);
71 path_ipdown[0] = '\0';
73 add_notifier(&phasechange, notifier_phasechange, NULL);
74 add_notifier(&exitnotify, notifier_exit, NULL);
76 add_notifier(&ip_up_notifier, notifier_ipup, NULL);
77 add_notifier(&ip_down_notifier, notifier_ipdown, NULL);