5 * Copyright (C) 2007-2009 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
27 #include <netinet/in.h>
28 #include <arpa/inet.h>
30 #include <pppd/pppd.h>
32 #include <pppd/ipcp.h>
34 static void notifier_phasechange(void *data, int arg)
36 printf("phasechange: data %p arg %d\n", data, arg);
39 static void notifier_exit(void *data, int arg)
41 printf("exitnotify: data %p arg %d\n", data, arg);
44 static void notifier_ipup(void *data, int arg)
46 ipcp_options opts = ipcp_gotoptions[0];
47 ipcp_options peer = ipcp_hisoptions[0];
48 struct in_addr ouraddr, hisaddr;
50 printf("ipup: data %p arg %d\n", data, arg);
52 memcpy(&ouraddr, &opts.ouraddr, sizeof(ouraddr));
53 memcpy(&hisaddr, &peer.hisaddr, sizeof(hisaddr));
55 printf("%s: %s -> %s\n",
56 ifname, inet_ntoa(ouraddr), inet_ntoa(hisaddr));
58 script_unsetenv("USEPEERDNS");
59 script_unsetenv("DNS1");
60 script_unsetenv("DNS2");
63 static void notifier_ipdown(void *data, int arg)
65 printf("ipdown: data %p arg %d\n", data, arg);
68 char pppd_version[] = VERSION;
70 int plugin_init(void);
76 path_ipdown[0] = '\0';
79 add_notifier(&phasechange, notifier_phasechange, NULL);
80 add_notifier(&exitnotify, notifier_exit, NULL);
82 add_notifier(&ip_up_notifier, notifier_ipup, NULL);
83 add_notifier(&ip_down_notifier, notifier_ipdown, NULL);