diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-04-14 23:46:45 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-04-14 23:46:45 +0100 |
commit | 437bd70f28c6d5b2f34cba67ba2bb581025f56ea (patch) | |
tree | 2d214076649e4e70ba6eb77af98668deb83ac46e /net-dialup/ppp/files | |
parent | 234dc35b5df19cfe20396a10855ce4e70b8b43bc (diff) |
gentoo auto-resync : 14:04:2023 - 23:46:45
Diffstat (limited to 'net-dialup/ppp/files')
3 files changed, 309 insertions, 0 deletions
diff --git a/net-dialup/ppp/files/ppp-2.5.0-dhcp/0001-Convert-sys_errlist-to-strerror.patch b/net-dialup/ppp/files/ppp-2.5.0-dhcp/0001-Convert-sys_errlist-to-strerror.patch new file mode 100644 index 000000000000..193e90b78a9a --- /dev/null +++ b/net-dialup/ppp/files/ppp-2.5.0-dhcp/0001-Convert-sys_errlist-to-strerror.patch @@ -0,0 +1,148 @@ +From e21d256cded13a625bc28d3fe812141a202be696 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Thu, 13 Apr 2023 14:59:35 -0400 +Subject: [PATCH 1/3] Convert sys_errlist to strerror + +--- + dhcpc.c | 8 ++++---- + packet.c | 6 +++--- + socket.c | 14 +++++++------- + 3 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/dhcpc.c b/dhcpc.c +index fcff8b9..ff83b53 100644 +--- a/dhcpc.c ++++ b/dhcpc.c +@@ -144,7 +144,7 @@ void change_mode(int new_mode) + fd = raw_socket(client_config.ifindex); + + if (listen_mode != LISTEN_NONE && fd < 0) { +- fatal("DHCPC: couldn't listen on socket, %s", sys_errlist[errno]); ++ fatal("DHCPC: couldn't listen on socket, %s", strerror(errno)); + } + + } +@@ -208,7 +208,7 @@ void dhcp_rx(void *dummy) { + len = get_packet(&packet, fd); + + if (len == -1 && errno != EINTR) { +- dbglog("DHCPC: error on read, %s, reopening socket", sys_errlist[errno]); ++ dbglog("DHCPC: error on read, %s, reopening socket", strerror(errno)); + change_mode(LISTEN_KERNEL); + } + if (len < 0) continue; +@@ -380,7 +380,7 @@ void dhcp_request_new() { + else len = get_raw_packet(&packet, fd); + + if (len == -1 && errno != EINTR) { +- dbglog("DHCPC: error on read, %s, reopening socket", sys_errlist[errno]); ++ dbglog("DHCPC: error on read, %s, reopening socket", strerror(errno)); + change_mode(listen_mode); /* just close and reopen */ + } + if (len < 0) continue; +@@ -445,7 +445,7 @@ void dhcp_request_new() { + + } else { + /* An error occured */ +- dbglog("DHCPC: error on select, %s, reopening socket", sys_errlist[errno]); ++ dbglog("DHCPC: error on select, %s, reopening socket", strerror(errno)); + change_mode(listen_mode); /* just close and reopen */ + } + +diff --git a/packet.c b/packet.c +index 00b5202..07a1aac 100644 +--- a/packet.c ++++ b/packet.c +@@ -125,7 +125,7 @@ int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port + return kernel_packet(payload,payload->giaddr,CLIENT_PORT,dest_ip,dest_port); + + if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) { +- DEBUG(LOG_ERR, "socket call failed: %s", sys_errlist[errno]); ++ DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno)); + return -1; + } + +@@ -138,7 +138,7 @@ int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port + dest.sll_halen = 6; + memcpy(dest.sll_addr, dest_arp, 6); + if (bind(fd, (struct sockaddr *)&dest, sizeof(struct sockaddr_ll)) < 0) { +- DEBUG(LOG_ERR, "bind call failed: %s", sys_errlist[errno]); ++ DEBUG(LOG_ERR, "bind call failed: %s", strerror(errno)); + close(fd); + return -1; + } +@@ -161,7 +161,7 @@ int raw_packet(struct dhcpMessage *payload, u_int32_t source_ip, int source_port + + result = sendto(fd, &packet, sizeof(struct udp_dhcp_packet), 0, (struct sockaddr *) &dest, sizeof(dest)); + if (result <= 0) { +- DEBUG(LOG_ERR, "write on socket failed: %s", sys_errlist[errno]); ++ DEBUG(LOG_ERR, "write on socket failed: %s", strerror(errno)); + } + close(fd); + return result; +diff --git a/socket.c b/socket.c +index 0234350..a6799d5 100644 +--- a/socket.c ++++ b/socket.c +@@ -60,7 +60,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char + *addr = sin->sin_addr.s_addr; + DEBUG(LOG_INFO, "%s (our ip) = %s", ifr.ifr_name, inet_ntoa(sin->sin_addr)); + } else { +- LOG(LOG_ERR, "SIOCGIFADDR failed!: %s", sys_errlist[errno]); ++ LOG(LOG_ERR, "SIOCGIFADDR failed!: %s", strerror(errno)); + return -1; + } + } +@@ -69,7 +69,7 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char + DEBUG(LOG_INFO, "adapter index %d", ifr.ifr_ifindex); + *ifindex = ifr.ifr_ifindex; + } else { +- LOG(LOG_ERR, "SIOCGIFINDEX failed!: %s", sys_errlist[errno]); ++ LOG(LOG_ERR, "SIOCGIFINDEX failed!: %s", strerror(errno)); + return -1; + } + if (ioctl(fd, SIOCGIFHWADDR, &ifr) == 0) { +@@ -77,11 +77,11 @@ int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char + DEBUG(LOG_INFO, "adapter hardware address %02x:%02x:%02x:%02x:%02x:%02x", + arp[0], arp[1], arp[2], arp[3], arp[4], arp[5]); + } else { +- LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %s", sys_errlist[errno]); ++ LOG(LOG_ERR, "SIOCGIFHWADDR failed!: %s", strerror(errno)); + return -1; + } + } else { +- LOG(LOG_ERR, "socket failed!: %s", sys_errlist[errno]); ++ LOG(LOG_ERR, "socket failed!: %s", strerror(errno)); + return -1; + } + close(fd); +@@ -98,7 +98,7 @@ int listen_socket(unsigned int ip, int port, char *inf) + + DEBUG(LOG_INFO, "Opening listen socket on 0x%08x:%d %s\n", ip, port, inf ? inf : "*"); + if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { +- DEBUG(LOG_ERR, "socket call failed: %s", sys_errlist[errno]); ++ DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno)); + return -1; + } + +@@ -144,7 +144,7 @@ int raw_socket(int ifindex) + + DEBUG(LOG_INFO, "Opening raw socket on ifindex %d\n", ifindex); + if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) { +- DEBUG(LOG_ERR, "socket call failed: %s", sys_errlist[errno]); ++ DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno)); + return -1; + } + +@@ -152,7 +152,7 @@ int raw_socket(int ifindex) + sock.sll_protocol = htons(ETH_P_IP); + sock.sll_ifindex = ifindex; + if (bind(fd, (struct sockaddr *) &sock, sizeof(sock)) < 0) { +- DEBUG(LOG_ERR, "bind call failed: %s", sys_errlist[errno]); ++ DEBUG(LOG_ERR, "bind call failed: %s", strerror(errno)); + close(fd); + return -1; + } +-- +2.40.0 + diff --git a/net-dialup/ppp/files/ppp-2.5.0-dhcp/0002-Add-Makefile.am.patch b/net-dialup/ppp/files/ppp-2.5.0-dhcp/0002-Add-Makefile.am.patch new file mode 100644 index 000000000000..5009c4eb3469 --- /dev/null +++ b/net-dialup/ppp/files/ppp-2.5.0-dhcp/0002-Add-Makefile.am.patch @@ -0,0 +1,35 @@ +From 9fa2696fa7348e647289e08ce299bb27ab97356d Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Thu, 13 Apr 2023 15:20:30 -0400 +Subject: [PATCH 2/3] Add Makefile.am + +--- + Makefile | 1 - + Makefile.am | 6 ++++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + delete mode 120000 Makefile + create mode 100644 Makefile.am + +diff --git a/Makefile b/Makefile +deleted file mode 120000 +index 8bad27d..0000000 +--- a/Makefile ++++ /dev/null +@@ -1 +0,0 @@ +-Makefile.linux +\ No newline at end of file +diff --git a/Makefile.am b/Makefile.am +new file mode 100644 +index 0000000..195435a +--- /dev/null ++++ b/Makefile.am +@@ -0,0 +1,6 @@ ++pppd_plugin_LTLIBRARIES = dhcpc.la ++pppd_plugindir = $(PPPD_PLUGIN_DIR) ++ ++dhcpc_la_CPPFLAGS = -I${top_srcdir} ++dhcpc_la_LDFLAGS = -module -avoid-version ++dhcpc_la_SOURCES = dhcpc.c clientpacket.c options.c packet.c socket.c +-- +2.40.0 + diff --git a/net-dialup/ppp/files/ppp-2.5.0-dhcp/0003-Fix-build-with-ppp-2.5.0.patch b/net-dialup/ppp/files/ppp-2.5.0-dhcp/0003-Fix-build-with-ppp-2.5.0.patch new file mode 100644 index 000000000000..9d3585dbb6ac --- /dev/null +++ b/net-dialup/ppp/files/ppp-2.5.0-dhcp/0003-Fix-build-with-ppp-2.5.0.patch @@ -0,0 +1,126 @@ +From f3707ff09fb17e6d6b851f6cda66e2bdfa4b9108 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Thu, 13 Apr 2023 16:09:45 -0400 +Subject: [PATCH 3/3] Fix build with ppp-2.5.0 + +--- + debug.h | 1 + + dhcpc.c | 26 +++++++++++++++----------- + 2 files changed, 16 insertions(+), 11 deletions(-) + +diff --git a/debug.h b/debug.h +index e01bd0b..674dffb 100644 +--- a/debug.h ++++ b/debug.h +@@ -2,6 +2,7 @@ + #define _DEBUG_H + + #include <stdio.h> ++#include <pppd/pppd.h> + + #define DEBUG + #ifdef DEBUG +diff --git a/dhcpc.c b/dhcpc.c +index ff83b53..d383793 100644 +--- a/dhcpc.c ++++ b/dhcpc.c +@@ -33,7 +33,6 @@ + #include <sys/types.h> + #include <sys/file.h> + #include <unistd.h> +-#include <getopt.h> + #include <stdlib.h> + #include <sys/socket.h> + #include <netinet/in.h> +@@ -44,9 +43,12 @@ + #include <net/if.h> + #include <errno.h> + +-#include "pppd.h" ++#include <pppd/pppd.h> ++#include <pppd/options.h> ++#include <pppd/fsm.h> ++#include <pppd/ipcp.h> + +-char pppd_version[] = VERSION; ++char pppd_version[] = PPPD_VERSION; + + #include "dhcpd.h" + #include "dhcpc.h" +@@ -237,8 +239,8 @@ void dhcp_rx(void *dummy) { + if (requested_ip != assigned_ip) { + fatal("DHCPC: Terminating because address has changed!"); + } +- untimeout(&dhcp_renew,NULL); +- timeout(&dhcp_renew, NULL, lease / 2,0); ++ ppp_untimeout(&dhcp_renew,NULL); ++ ppp_timeout(&dhcp_renew, NULL, lease / 2,0); + return; + } else if (*message == DHCPNAK) { + /* return to init state */ +@@ -248,7 +250,7 @@ void dhcp_rx(void *dummy) { + } + } + } +- timeout(&dhcp_rx,NULL,DHCP_RX_POLL_INTERVAL,0); ++ ppp_timeout(&dhcp_rx,NULL,DHCP_RX_POLL_INTERVAL,0); + + } + +@@ -272,7 +274,7 @@ void dhcp_renew(void *dummy) { + if (dhcp_state == BOUND) { + dhcp_state = RENEWING; + change_mode(LISTEN_KERNEL); +- timeout(&dhcp_rx,NULL,3,0); ++ ppp_timeout(&dhcp_rx,NULL,3,0); + dbglog("DHCPC: Entering renew state"); + /* 1/2 of lease used on entry, timeout renew after another 3/8 of lease */ + dhcp_renew_timeout = (lease * 0x3) >> 3; +@@ -299,7 +301,7 @@ void dhcp_renew(void *dummy) { + send_renew(xid, dhcp_state==REBINDING ? client_config.siaddr : server_addr, requested_ip); + + dhcp_renew_timeout-=dhcp_packet_interval; +- timeout(&dhcp_renew, NULL, dhcp_packet_interval,0); ++ ppp_timeout(&dhcp_renew, NULL, dhcp_packet_interval,0); + } + + void dhcp_request_new() { +@@ -312,6 +314,7 @@ void dhcp_request_new() { + int c, len; + struct dhcpMessage packet; + time_t now; ++ const char *peer_authname = ppp_peer_authname(NULL, 0); + + if (dhcp_state == BOUND || dhcp_state == RENEWING || dhcp_state == REBINDING) + return; +@@ -426,7 +429,7 @@ void dhcp_request_new() { + dhcp_process_ack(&packet); + assigned_ip = requested_ip; + dbglog("DHCPC: Setting renewal timer for %d seconds", lease /2); +- timeout(&dhcp_renew, NULL, lease / 2,0); ++ ppp_timeout(&dhcp_renew, NULL, lease / 2,0); + return; + } else if (*message == DHCPNAK) { + /* return to init state */ +@@ -455,6 +458,7 @@ void dhcp_request_new() { + + void dhcp_ip_choose(u_int32_t *addrp) { + u_int32_t entryvalue; ++ const char *peer_authname = ppp_peer_authname(NULL, 0); + + dbglog("DHCPC: ip_choose_hook entered with peer name %s",peer_authname); + +@@ -489,8 +493,8 @@ void plugin_init(void) + /* we save pointer to ip_choose_hook so we can defer to other modules + that may specify an IP, e.g. radius */ + ip_choose_hook= dhcp_ip_choose; +- add_options(dhcpc_options); +- add_notifier(&exitnotify, dhcp_release, NULL); ++ ppp_add_options(dhcpc_options); ++ ppp_add_notify(NF_EXIT, dhcp_release, NULL); + info("DHCPC: plugin initialized"); + + } +-- +2.40.0 + |