Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 195461 | Differences between
and this patch

Collapse All | Expand All

(-)openl2tp-1.8.o/doc/openl2tp_rpc.4 (+4 lines)
Lines 774-779 Link Here
774
.B local_ip_addr
774
.B local_ip_addr
775
The IP address to assign to the local end of the PPP link.
775
The IP address to assign to the local end of the PPP link.
776
.TP
776
.TP
777
.B optionsfile
778
Passes a file parameter to the pppd daemon, allowing for loading a custom
779
options file.  See pppd(8) for more details.
780
.TP
777
.B peer_ip_addr
781
.B peer_ip_addr
778
The IP address to assign to the remote (peer) end of the PPP link.
782
The IP address to assign to the remote (peer) end of the PPP link.
779
.TP
783
.TP
(-)openl2tp-1.8.o/l2tp_common.c (+4 lines)
Lines 938-943 Link Here
938
	}
938
	}
939
	len += fprintf(file, "  multilink: %s, proxy arp: %s\n", 
939
	len += fprintf(file, "  multilink: %s, proxy arp: %s\n", 
940
		       pp->multilink ? "YES" : "NO", pp->proxy_arp ? "YES" : "NO");
940
		       pp->multilink ? "YES" : "NO", pp->proxy_arp ? "YES" : "NO");
941
	//if (OPTSTRING_PTR(pp->optionsfile) != NULL) {
942
		len += fprintf(file, "  optionsfile: %s\n", OPTSTRING(pp->optionsfile));
943
	//}
944
941
	len += fprintf(file, "  IP parameters:-\n");
945
	len += fprintf(file, "  IP parameters:-\n");
942
	ip_to_string(&local_ip[0], pp->local_ip_addr.s_addr);
946
	ip_to_string(&local_ip[0], pp->local_ip_addr.s_addr);
943
	ip_to_string(&peer_ip[0], pp->peer_ip_addr.s_addr);
947
	ip_to_string(&peer_ip[0], pp->peer_ip_addr.s_addr);
(-)openl2tp-1.8.o/l2tp_config.c (-1 / +20 lines)
Lines 3123-3128 Link Here
3123
	L2TP_PPP_ARGID_LOCAL_NAME,
3123
	L2TP_PPP_ARGID_LOCAL_NAME,
3124
	L2TP_PPP_ARGID_REMOTE_NAME,
3124
	L2TP_PPP_ARGID_REMOTE_NAME,
3125
	L2TP_PPP_ARGID_PROXY_ARP,
3125
	L2TP_PPP_ARGID_PROXY_ARP,
3126
	L2TP_PPP_ARGID_OPTIONSFILE,
3126
} l2tp_ppp_arg_ids_t;
3127
} l2tp_ppp_arg_ids_t;
3127
 
3128
 
3128
#undef ARG
3129
#undef ARG
Lines 3187-3193 Link Here
3187
	ARG(REMOTE_NAME,	"remote_name",		0,	string,	"Name to assume for the remote peer for authentication purposes"),		\
3188
	ARG(REMOTE_NAME,	"remote_name",		0,	string,	"Name to assume for the remote peer for authentication purposes"),		\
3188
	ARG(USE_AS_DEFAULT_ROUTE, "default_route",	0,	bool,	"Use link as default route"),							\
3189
	ARG(USE_AS_DEFAULT_ROUTE, "default_route",	0,	bool,	"Use link as default route"),							\
3189
	ARG(MULTILINK,		"multilink",		0, 	bool, 	"Enable PPP multilink connections."),						\
3190
	ARG(MULTILINK,		"multilink",		0, 	bool, 	"Enable PPP multilink connections."),						\
3190
	ARG(PROXY_ARP,		"proxy_arp",		0, 	bool, 	"Use proxy arp.")
3191
	ARG(PROXY_ARP,		"proxy_arp",		0, 	bool, 	"Use proxy arp."),								\
3192
	ARG(OPTIONSFILE,	"optionsfile",		0,	string, "ppp options file to use")
3191
3193
3192
3194
3193
static struct cli_arg_entry l2tp_args_ppp_profile_create[] = {
3195
static struct cli_arg_entry l2tp_args_ppp_profile_create[] = {
Lines 3267-3272 Link Here
3267
	FLG(USE_AS_DEFAULT_ROUTE, "default_route",	"Use link as default route"),							\
3269
	FLG(USE_AS_DEFAULT_ROUTE, "default_route",	"Use link as default route"),							\
3268
	FLG(MULTILINK,		"multilink",		"Enable PPP multilink connections."),						\
3270
	FLG(MULTILINK,		"multilink",		"Enable PPP multilink connections."),						\
3269
	FLG(PROXY_ARP,		"proxy_arp",		"Use proxy arp."),
3271
	FLG(PROXY_ARP,		"proxy_arp",		"Use proxy arp."),
3272
	FLG(OPTIONSFILE,	"optionsfile",		"ppp options file to use"),
3270
	{ NULL, },
3273
	{ NULL, },
3271
};
3274
};
3272
3275
Lines 3488-3493 Link Here
3488
		msg->remote_name.valid = 1;
3491
		msg->remote_name.valid = 1;
3489
		msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
3492
		msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
3490
		break;
3493
		break;
3494
	case L2TP_PPP_ARGID_OPTIONSFILE:
3495
		OPTSTRING(msg->optionsfile) = strdup(arg_value);
3496
		if (OPTSTRING(msg->optionsfile) == NULL) {
3497
			result = -ENOMEM;
3498
			goto out;
3499
		}
3500
		msg->optionsfile.valid = 1;
3501
		msg->flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
3502
		break;
3491
	}
3503
	}
3492
3504
3493
	result = 0;
3505
	result = 0;
Lines 3856-3861 Link Here
3856
		case L2TP_PPP_ARGID_REMOTE_NAME:
3868
		case L2TP_PPP_ARGID_REMOTE_NAME:
3857
			msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
3869
			msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME;
3858
			break;
3870
			break;
3871
		case L2TP_PPP_ARGID_OPTIONSFILE:
3872
			msg.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
3873
			break;
3859
		}
3874
		}
3860
	} L2TP_ACT_END();
3875
	} L2TP_ACT_END();
3861
3876
Lines 4867-4872 Link Here
4867
 			    L2TP_API_PPP_PROFILE_FLAG_LOCAL_NAME |
4882
 			    L2TP_API_PPP_PROFILE_FLAG_LOCAL_NAME |
4868
 			    L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME |
4883
 			    L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME |
4869
 			    L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP |
4884
 			    L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP |
4885
 			    L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE |
4870
			    L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE |
4886
			    L2TP_API_PPP_PROFILE_FLAG_AUTH_NONE |
4871
			    L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP |
4887
			    L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_EAP |
4872
			    L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 |
4888
			    L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_MSCHAPV2 |
Lines 5028-5033 Link Here
5028
		if (cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP) {
5044
		if (cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_PROXY_ARP) {
5029
			fprintf(file, "\tproxy_arp=%s \\\n", Y_OR_N(cfg->proxy_arp));
5045
			fprintf(file, "\tproxy_arp=%s \\\n", Y_OR_N(cfg->proxy_arp));
5030
		}
5046
		}
5047
		if ((cfg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(cfg->optionsfile) != NULL)) {
5048
			fprintf(file, "\toptionsfile=%s \\\n", OPTSTRING_PTR(cfg->optionsfile));
5049
		}
5031
		fprintf(file, "\n");
5050
		fprintf(file, "\n");
5032
	}
5051
	}
5033
}
5052
}
(-)openl2tp-1.8.o/l2tp_config_parse.y (+13 lines)
Lines 154-159 Link Here
154
%token QUOTEDSTRING
154
%token QUOTEDSTRING
155
%token BOOL
155
%token BOOL
156
%token IPADDRESS
156
%token IPADDRESS
157
%token OPTIONSFILE
157
158
158
%token INITIAL_RCVD_LCP_CONFREQ
159
%token INITIAL_RCVD_LCP_CONFREQ
159
%token CALLING_NUMBER
160
%token CALLING_NUMBER
Lines 1167-1172 Link Here
1167
			OPTSTRING(ppp_profile.remote_name) = $3.buf;
1168
			OPTSTRING(ppp_profile.remote_name) = $3.buf;
1168
			ppp_profile.remote_name.valid = 1;
1169
			ppp_profile.remote_name.valid = 1;
1169
		}
1170
		}
1171
	|	OPTIONSFILE EQUALS STRING
1172
		{
1173
			ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
1174
			OPTSTRING(ppp_profile.optionsfile) = $3.buf;
1175
			ppp_profile.optionsfile.valid = 1;
1176
		}
1177
	|	OPTIONSFILE EQUALS QUOTEDSTRING
1178
		{
1179
			ppp_profile.flags2 |= L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE;
1180
			OPTSTRING(ppp_profile.optionsfile) = $3.buf;
1181
			ppp_profile.optionsfile.valid = 1;
1182
		}
1170
	;
1183
	;
1171
1184
1172
tunnel_command
1185
tunnel_command
(-)openl2tp-1.8.o/l2tp_config_token.l (+1 lines)
Lines 191-196 Link Here
191
auth_eap				{ return(AUTH_EAP); }
191
auth_eap				{ return(AUTH_EAP); }
192
auth_none				{ return(AUTH_NOAUTH); }
192
auth_none				{ return(AUTH_NOAUTH); }
193
auth_peer				{ return(AUTH_PEER); }
193
auth_peer				{ return(AUTH_PEER); }
194
optionsfile				{ return(OPTIONSFILE); }
194
195
195
{ws}		{ }
196
{ws}		{ }
196
{linecont}	{ lineno++; }
197
{linecont}	{ lineno++; }
(-)openl2tp-1.8.o/l2tp_ppp.c (+56 lines)
Lines 70-75 Link Here
70
	int				auth_refuse_mschap:1;
70
	int				auth_refuse_mschap:1;
71
	int				auth_refuse_mschapv2:1;
71
	int				auth_refuse_mschapv2:1;
72
	int				auth_refuse_eap:1;
72
	int				auth_refuse_eap:1;
73
	char				*optionsfile;
73
};
74
};
74
75
75
static struct l2tp_ppp_profile *l2tp_ppp_defaults;
76
static struct l2tp_ppp_profile *l2tp_ppp_defaults;
Lines 241-246 Link Here
241
	if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME) {
242
	if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_REMOTE_NAME) {
242
		L2TP_SET_OPTSTRING_VAR(profile, remote_name);
243
		L2TP_SET_OPTSTRING_VAR(profile, remote_name);
243
	}
244
	}
245
	if (msg->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
246
		L2TP_SET_OPTSTRING_VAR(profile, optionsfile);
247
	}
244
248
245
out:
249
out:
246
	return result;
250
	return result;
Lines 346-351 Link Here
346
		}
350
		}
347
	}
351
	}
348
352
353
	if (l2tp_ppp_defaults->optionsfile != NULL) {
354
		profile->optionsfile = strdup(l2tp_ppp_defaults->optionsfile);
355
		if (profile->optionsfile == NULL) {
356
			*result = -ENOMEM;
357
			goto err;
358
		}
359
	}
360
349
	/* Override defaults by user-supplied params */
361
	/* Override defaults by user-supplied params */
350
	*result = l2tp_ppp_profile_modify(&msg, profile);
362
	*result = l2tp_ppp_profile_modify(&msg, profile);
351
363
Lines 379-384 Link Here
379
	*result = -ENOMEM;
391
	*result = -ENOMEM;
380
	goto out;
392
	goto out;
381
err:
393
err:
394
	if (profile->radius_hint != NULL) {
395
		free(profile->radius_hint);
396
	}
397
	if (profile->ip_pool_name != NULL) {
398
		free(profile->ip_pool_name);
399
	}
400
	if (profile->profile_name != NULL) {
401
		free(profile->profile_name);
402
	}
403
	if (profile->local_name != NULL) {
404
		free(profile->local_name);
405
	}
406
	if (profile->remote_name != NULL) {
407
		free(profile->remote_name);
408
	}
409
	if (profile->optionsfile != NULL) {
410
		free(profile->optionsfile);
411
	}
382
	free(profile);
412
	free(profile);
383
	goto out;
413
	goto out;
384
}
414
}
Lines 430-435 Link Here
430
	if (profile->remote_name != NULL) {
460
	if (profile->remote_name != NULL) {
431
		free(profile->remote_name);
461
		free(profile->remote_name);
432
	}
462
	}
463
	if (profile->optionsfile != NULL) {
464
		free(profile->optionsfile);
465
	}
433
	USL_POISON_MEMORY(profile, 0xe5, sizeof(*profile));
466
	USL_POISON_MEMORY(profile, 0xe5, sizeof(*profile));
434
	free(profile);
467
	free(profile);
435
	*result = 0;
468
	*result = 0;
Lines 578-583 Link Here
578
		}
611
		}
579
		result->remote_name.valid = 1;
612
		result->remote_name.valid = 1;
580
	}
613
	}
614
	if (profile->optionsfile != NULL) {
615
		OPTSTRING(result->optionsfile) = strdup(profile->optionsfile);
616
		if (OPTSTRING(result->optionsfile) == NULL) {
617
			result->result_code = -ENOMEM;
618
			goto out;
619
		}
620
		result->optionsfile.valid = 1;
621
	}
581
622
582
out:
623
out:
583
	L2TP_DEBUG(L2TP_API, "%s: flags=%x/%x result=%d", __func__, result->flags, result->flags2, result->result_code);
624
	L2TP_DEBUG(L2TP_API, "%s: flags=%x/%x result=%d", __func__, result->flags, result->flags2, result->result_code);
Lines 598-603 Link Here
598
	if (OPTSTRING_PTR(msg->remote_name) != NULL) {
639
	if (OPTSTRING_PTR(msg->remote_name) != NULL) {
599
		free(OPTSTRING(msg->remote_name));
640
		free(OPTSTRING(msg->remote_name));
600
	}
641
	}
642
	if (OPTSTRING_PTR(msg->optionsfile) != NULL) {
643
		free(OPTSTRING(msg->optionsfile));
644
	}
601
	if (msg->profile_name != NULL) {
645
	if (msg->profile_name != NULL) {
602
		free(msg->profile_name);
646
		free(msg->profile_name);
603
	}
647
	}
Lines 843-848 Link Here
843
		}
887
		}
844
		profile->remote_name = NULL;
888
		profile->remote_name = NULL;
845
	}
889
	}
890
	if (msg.flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) {
891
		if (profile->optionsfile != NULL) {
892
			free(profile->optionsfile);
893
		}
894
		profile->optionsfile = NULL;
895
	}
846
896
847
	/* Clear all requested flags */
897
	/* Clear all requested flags */
848
	profile->flags &= ~(msg.flags);
898
	profile->flags &= ~(msg.flags);
Lines 937-942 Link Here
937
	}
987
	}
938
	l2tp_ppp_defaults->local_name = NULL;
988
	l2tp_ppp_defaults->local_name = NULL;
939
	l2tp_ppp_defaults->remote_name = NULL;
989
	l2tp_ppp_defaults->remote_name = NULL;
990
	if (strlen(L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE) > 0) {
991
		l2tp_ppp_defaults->optionsfile = strdup(L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE);
992
		if (l2tp_ppp_defaults->optionsfile == NULL) {
993
			goto nomem;
994
		}
995
	}
940
996
941
	USL_LIST_HEAD_INIT(&l2tp_ppp_defaults->list);
997
	USL_LIST_HEAD_INIT(&l2tp_ppp_defaults->list);
942
	usl_list_add(&l2tp_ppp_defaults->list, &l2tp_ppp_profile_list);
998
	usl_list_add(&l2tp_ppp_defaults->list, &l2tp_ppp_profile_list);
(-)openl2tp-1.8.o/l2tp_rpc.x (+3 lines)
Lines 946-951 Link Here
946
const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_CHAP		= 65536;
946
const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_CHAP		= 65536;
947
const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP			= 131072;
947
const L2TP_API_PPP_PROFILE_FLAG_AUTH_REFUSE_PAP			= 131072;
948
const L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER			= 262144;
948
const L2TP_API_PPP_PROFILE_FLAG_AUTH_PEER			= 262144;
949
const L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE			= 524288;
949
950
950
/* Default values for PPP profile attributes.
951
/* Default values for PPP profile attributes.
951
 * These are used if an explicit value is not provided by the user.
952
 * These are used if an explicit value is not provided by the user.
Lines 993-998 Link Here
993
const L2TP_API_PPP_PROFILE_DEFAULT_USE_AS_DEFAULT_ROUTE		= 0;
994
const L2TP_API_PPP_PROFILE_DEFAULT_USE_AS_DEFAULT_ROUTE		= 0;
994
const L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK			= 0;
995
const L2TP_API_PPP_PROFILE_DEFAULT_MULTILINK			= 0;
995
const L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP			= 0;
996
const L2TP_API_PPP_PROFILE_DEFAULT_PROXY_ARP			= 0;
997
const L2TP_API_PPP_PROFILE_DEFAULT_OPTIONSFILE			= "";
996
998
997
enum l2tp_api_ppp_sync_mode {
999
enum l2tp_api_ppp_sync_mode {
998
	L2TP_API_PPP_SYNCMODE_SYNC_ASYNC,
1000
	L2TP_API_PPP_SYNCMODE_SYNC_ASYNC,
Lines 1051-1056 Link Here
1051
	optstring			local_name;
1053
	optstring			local_name;
1052
	optstring			remote_name;
1054
	optstring			remote_name;
1053
	bool				proxy_arp;
1055
	bool				proxy_arp;
1056
	optstring			optionsfile;
1054
};
1057
};
1055
1058
1056
struct l2tp_api_ppp_profile_list_entry {
1059
struct l2tp_api_ppp_profile_list_entry {
(-)openl2tp-1.8.o/plugins/ppp_unix.c (+7 lines)
Lines 282-287 Link Here
282
		}
282
		}
283
	}
283
	}
284
284
285
	syslog(LOG_ERR, "checking for optionsfile");
286
	if ((params->flags2 & L2TP_API_PPP_PROFILE_FLAG_OPTIONSFILE) && (OPTSTRING_PTR(params->optionsfile) != NULL)) {
287
		syslog(LOG_ERR, "setting options=%s", OPTSTRING(params->optionsfile));
288
		argv[arg++] = "file";
289
		argv[arg++] = strdup(OPTSTRING(params->optionsfile));
290
	}
291
285
	/* By default, use sync mode */
292
	/* By default, use sync mode */
286
	if (!((params->flags & L2TP_API_PPP_PROFILE_FLAG_SYNC_MODE) &&
293
	if (!((params->flags & L2TP_API_PPP_PROFILE_FLAG_SYNC_MODE) &&
287
	      (params->sync_mode == L2TP_API_PPP_SYNCMODE_ASYNC))) {
294
	      (params->sync_mode == L2TP_API_PPP_SYNCMODE_ASYNC))) {

Return to bug 195461