Package: ppp / 2.4.6-3.1

pppoatm_resolver_light Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
disable unneeded code in the pppoatm plugin

This patch halves the size of the PPPoA plugin by disabling features
which are never used with normal DSL connections (i.e. parsing of QoS
configuration directives and DNS resolution of VP/VC addresses).
It is especially useful for install images and embedded systems.

A next step could be removing text2qos.c, text2atm.c, misc.c and ans.c
and encourage users interested in the complete features to link the
plugin with the real libatm. I really doubt anybody cares, anyway.


--- a/pppd/plugins/pppoatm/Makefile.linux
+++ b/pppd/plugins/pppoatm/Makefile.linux
@@ -25,9 +25,13 @@ ifdef HAVE_LIBATM
 LIBS := -latm
 else
 CFLAGS += -I.
+PLUGIN_OBJS += text2atm.o
+ifdef USE_FULL_ATM_RESOLVER
+CFLAGS += -DUSE_FULL_ATM_RESOLVER
 PLUGIN_OBJS += text2qos.o text2atm.o misc.o ans.o
 LIBS := -lresolv
 endif
+endif
 
 #*********
 all: $(PLUGIN)
--- a/pppd/plugins/pppoatm/pppoatm.c
+++ b/pppd/plugins/pppoatm/pppoatm.c
@@ -142,8 +142,12 @@ static int connect_pppoatm(void)
 	qos.txtp.traffic_class = qos.rxtp.traffic_class = ATM_UBR;
 	/* TODO: support simplified QoS setting */
 	if (qosstr != NULL)
+#ifdef USE_FULL_ATM_RESOLVER
 		if (text2qos(qosstr, &qos, 0))
 			fatal("Can't parse QoS: \"%s\"");
+#else
+		fatal("qos support has not been compiled in");
+#endif
 	qos.txtp.max_sdu = lcp_allowoptions[0].mru + pppoatm_overhead();
 	qos.rxtp.max_sdu = lcp_wantoptions[0].mru + pppoatm_overhead();
 	qos.aal = ATM_AAL5;
--- a/pppd/plugins/pppoatm/text2atm.c
+++ b/pppd/plugins/pppoatm/text2atm.c
@@ -72,6 +72,7 @@ static int try_pvc(const char *text,stru
 }
 
 
+#ifdef USE_FULL_ATM_RESOLVER
 static int do_try_nsap(const char *text,struct sockaddr_atmsvc *addr,int flags)
 {
     const char *walk;
@@ -221,6 +222,7 @@ static int try_name(const char *text,str
     (void) fclose(file);
     return result;
 }
+#endif
 
 
 int text2atm(const char *text,struct sockaddr *addr,int length,int flags)
@@ -234,6 +236,7 @@ int text2atm(const char *text,struct soc
 	result = try_pvc(text,(struct sockaddr_atmpvc *) addr,flags);
 	if (result != TRY_OTHER) return result;
     }
+#ifdef USE_FULL_ATM_RESOLVER
     if ((flags & T2A_SVC) && length >= sizeof(struct sockaddr_atmsvc)) {
 	result = try_nsap(text,(struct sockaddr_atmsvc *) addr,flags);
 	if (result != TRY_OTHER) return result;
@@ -245,5 +248,6 @@ int text2atm(const char *text,struct soc
     if (result == TRY_OTHER && !(flags & T2A_LOCAL))
 	result = ans_byname(text,(struct sockaddr_atmsvc *) addr,length,flags);
     if (result != TRY_OTHER) return result;
+#endif
     return -1;
 }