| 1 |
disable unneeded code in the pppoatm plugin |
| 2 |
|
| 3 |
This patch halves the size of the PPPoA plugin by disabling features |
| 4 |
which are never used with normal DSL connections (i.e. parsing of QoS |
| 5 |
configuration directives and DNS resolution of VP/VC addresses). |
| 6 |
It is especially useful for install images and embedded systems. |
| 7 |
|
| 8 |
A next step could be removing text2qos.c, text2atm.c, misc.c and ans.c |
| 9 |
and encourage users interested in the complete features to link the |
| 10 |
plugin with the real libatm. I really doubt anybody cares, anyway. |
| 11 |
|
| 12 |
|
| 13 |
--- a/pppd/plugins/pppoatm/pppoatm.c |
| 14 |
+++ b/pppd/plugins/pppoatm/pppoatm.c |
| 15 |
@@ -149,8 +149,12 @@ static int connect_pppoatm(void) |
| 16 |
qos.txtp.traffic_class = qos.rxtp.traffic_class = ATM_UBR; |
| 17 |
/* TODO: support simplified QoS setting */ |
| 18 |
if (qosstr != NULL) |
| 19 |
+#ifdef USE_FULL_ATM_RESOLVER |
| 20 |
if (text2qos(qosstr, &qos, 0)) |
| 21 |
fatal("Can't parse QoS: \"%s\""); |
| 22 |
+#else |
| 23 |
+ fatal("qos support has not been compiled in"); |
| 24 |
+#endif |
| 25 |
qos.txtp.max_sdu = lcp_allowoptions[0].mru + pppoatm_overhead(); |
| 26 |
qos.rxtp.max_sdu = lcp_wantoptions[0].mru + pppoatm_overhead(); |
| 27 |
qos.aal = ATM_AAL5; |
| 28 |
--- a/pppd/plugins/pppoatm/text2atm.c |
| 29 |
+++ b/pppd/plugins/pppoatm/text2atm.c |
| 30 |
@@ -72,6 +72,7 @@ static int try_pvc(const char *text,stru |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
+#ifdef USE_FULL_ATM_RESOLVER |
| 35 |
static int do_try_nsap(const char *text,struct sockaddr_atmsvc *addr,int flags) |
| 36 |
{ |
| 37 |
const char *walk; |
| 38 |
@@ -221,6 +222,7 @@ static int try_name(const char *text,str |
| 39 |
(void) fclose(file); |
| 40 |
return result; |
| 41 |
} |
| 42 |
+#endif |
| 43 |
|
| 44 |
|
| 45 |
int text2atm(const char *text,struct sockaddr *addr,int length,int flags) |
| 46 |
@@ -234,6 +236,7 @@ int text2atm(const char *text,struct soc |
| 47 |
result = try_pvc(text,(struct sockaddr_atmpvc *) addr,flags); |
| 48 |
if (result != TRY_OTHER) return result; |
| 49 |
} |
| 50 |
+#ifdef USE_FULL_ATM_RESOLVER |
| 51 |
if ((flags & T2A_SVC) && length >= sizeof(struct sockaddr_atmsvc)) { |
| 52 |
result = try_nsap(text,(struct sockaddr_atmsvc *) addr,flags); |
| 53 |
if (result != TRY_OTHER) return result; |
| 54 |
@@ -245,5 +248,6 @@ int text2atm(const char *text,struct soc |
| 55 |
if (result == TRY_OTHER && !(flags & T2A_LOCAL)) |
| 56 |
result = ans_byname(text,(struct sockaddr_atmsvc *) addr,length,flags); |
| 57 |
if (result != TRY_OTHER) return result; |
| 58 |
+#endif |
| 59 |
return -1; |
| 60 |
} |
| 61 |
--- a/pppd/plugins/pppoatm/Makefile.am |
| 62 |
+++ b/pppd/plugins/pppoatm/Makefile.am |
| 63 |
@@ -13,6 +13,8 @@ pppoatm_la_SOURCES = pppoatm.c |
| 64 |
if WITH_LIBATM |
| 65 |
pppoatm_la_LIBADD = -latm |
| 66 |
else |
| 67 |
-pppoatm_la_SOURCES += text2qos.c text2atm.c misc.c ans.c |
| 68 |
-pppoatm_la_LIBADD = -lresolv |
| 69 |
+pppoatm_la_SOURCES += text2atm.c |
| 70 |
+#pppoatm_la_CPPFLAGS += -DUSE_FULL_ATM_RESOLVER |
| 71 |
+#pppoatm_la_SOURCES += text2qos.c misc.c ans.c |
| 72 |
+#pppoatm_la_LIBADD = -lresolv |
| 73 |
endif |