Browse Source

pptpd: fix musl compatibility

 - Ship a net/ppp_defs.h replacement header since musl does not provide one
   but pppd/pppd.h provided by pppd is needing it.
 - Replace deprecated MSG_TRYHARD flag with the proper MSG_DONTROUTE one
 - Unconditionally include string.h in bcrelay to avoid undeclared memset()
   and strcpy() warnings.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Jo-Philipp Wich 9 years ago
parent
commit
ba31ff7d5e
2 changed files with 39 additions and 1 deletions
  1. 1
    1
      net/pptpd/Makefile
  2. 38
    0
      net/pptpd/patches/100-musl-compat.patch

+ 1
- 1
net/pptpd/Makefile View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=pptpd
11 11
 PKG_VERSION:=1.4.0
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 15
 PKG_SOURCE_URL:=@SF/poptop

+ 38
- 0
net/pptpd/patches/100-musl-compat.patch View File

@@ -0,0 +1,38 @@
1
+--- a/bcrelay.c
2
++++ b/bcrelay.c
3
+@@ -667,7 +667,7 @@ static void mainloop(int argc, char **ar
4
+                  * there is no need to concern about the physical/link layer header because it is
5
+                  * filled in automatically (based on the contents of sa).
6
+                  */
7
+-                if ((nrsent = sendto(cur_ifsnr[j].sock_nr, ipp_p, rlen, MSG_DONTWAIT|MSG_TRYHARD, (struct sockaddr *)&sa, salen)) < 0)
8
++                if ((nrsent = sendto(cur_ifsnr[j].sock_nr, ipp_p, rlen, MSG_DONTWAIT|MSG_DONTROUTE, (struct sockaddr *)&sa, salen)) < 0)
9
+                 {
10
+                   if (errno == ENETDOWN) {
11
+                     syslog(LOG_NOTICE, "ignored ENETDOWN from sendto(), a network interface was going down?");
12
+--- a/compat.c
13
++++ b/compat.c
14
+@@ -11,10 +11,10 @@
15
+ #include "compat.h"
16
+ #include "our_syslog.h"
17
+ 
18
+-#ifndef HAVE_STRLCPY
19
+ #include <string.h>
20
+ #include <stdio.h>
21
+ 
22
++#ifndef HAVE_STRLCPY
23
+ void strlcpy(char *dst, const char *src, size_t size)
24
+ {
25
+         strncpy(dst, src, size - 1);
26
+--- /dev/null
27
++++ b/net/ppp_defs.h
28
+@@ -0,0 +1,10 @@
29
++#ifndef _NET_PPP_DEFS_H
30
++#define _NET_PPP_DEFS_H 1
31
++
32
++#define __need_time_t
33
++#include <time.h>
34
++
35
++#include <asm/types.h>
36
++#include <linux/ppp_defs.h>
37
++
38
++#endif /* net/ppp_defs.h */