Skip to content

Commit

Permalink
net-pre-up: permit interface name changing.
Browse files Browse the repository at this point in the history
This allows the net-pre-up script to use external tools to rename
interfaces, for example:

newname="${IFNAME}-${PEERNAME:0:$(( 15 - ${#IFNAME} ))}"
ip li set dev "${IFNAME}" name "${newname}"

Signed-off-by: Jaco Kroon <[email protected]>
  • Loading branch information
jkroonza committed Aug 24, 2022
1 parent 6c56f53 commit 0d12ca7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pppd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,13 @@ set_ifup(const char* name)
const char** t;

if (!up_protos) {
char iftmpname[IFNAMSIZ];
int ifindex = if_nametoindex(ifname);
run_net_script(PPP_PATH_NET_PREUP, 1);
if (if_indextoname(ifindex, iftmpname) && strcmp(iftmpname, ifname)) {
info("Detected interface name change from %s to %s.", ifname, iftmpname);
strcpy(ifname, iftmpname);
}
if (!netif_set_state(1))
return 0;
}
Expand Down

0 comments on commit 0d12ca7

Please sign in to comment.