Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pppd: Add ip-pre-up-script option #510

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pppd/ipcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ ip_demand_conf(int u)
}
if (!sifaddr(u, wo->ouraddr, wo->hisaddr, GetMask(wo->ouraddr)))
return 0;
ipcp_script(PPP_PATH_IPPREUP, 1);
ipcp_script(path_ippreup, 1);
if (!sifup(u))
return 0;
if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
Expand Down Expand Up @@ -1932,7 +1932,7 @@ ipcp_up(fsm *f)
ifindex = if_nametoindex(ifname);

/* run the pre-up script, if any, and wait for it to finish */
ipcp_script(PPP_PATH_IPPREUP, 1);
ipcp_script(path_ippreup, 1);

/* check if preup script renamed the interface */
if (!if_indextoname(ifindex, ifname)) {
Expand Down
1 change: 1 addition & 0 deletions pppd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ main(int argc, char *argv[])

strlcpy(path_ipup, PPP_PATH_IPUP, MAXPATHLEN);
strlcpy(path_ipdown, PPP_PATH_IPDOWN, MAXPATHLEN);
strlcpy(path_ippreup, PPP_PATH_IPPREUP, MAXPATHLEN);

#ifdef PPP_WITH_IPV6CP
strlcpy(path_ipv6up, PPP_PATH_IPV6UP, MAXPATHLEN);
Expand Down
4 changes: 4 additions & 0 deletions pppd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ int connect_delay = 1000; /* wait this many ms after connect script */
int req_unit = -1; /* requested interface unit */
char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
char path_ippreup[MAXPATHLEN]; /* pathname of ip-pre-up script */
char req_ifname[IFNAMSIZ]; /* requested interface name */
bool multilink = 0; /* Enable multilink operation */
char *bundle_name = NULL; /* bundle name for multilink */
Expand Down Expand Up @@ -337,6 +338,9 @@ struct option general_options[] = {
{ "ip-down-script", o_string, path_ipdown,
"Set pathname of ip-down script",
OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },
{ "ip-pre-up-script", o_string, path_ippreup,
"Set pathname of ip-pre-up script",
OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN },

#ifdef PPP_WITH_IPV6CP
{ "ipv6-up-script", o_string, path_ipv6up,
Expand Down
1 change: 1 addition & 0 deletions pppd/pppd-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ extern int max_data_rate; /* max bytes/sec through charshunt */
extern int req_unit; /* interface unit number to use */
extern char path_ipup[]; /* pathname of ip-up script */
extern char path_ipdown[]; /* pathname of ip-down script */
extern char path_ippreup[]; /* pathname of ip-pre-up script */
extern char req_ifname[]; /* interface name to use (IFNAMSIZ) */
extern bool multilink; /* enable multilink operation (options.c) */
extern bool noendpoint; /* don't send or accept endpt. discrim. */
Expand Down