Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NetworkManager-l2tp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CeRiAl
NetworkManager-l2tp
Commits
75330f5e
Commit
75330f5e
authored
Feb 07, 2012
by
Сергей Прохоров
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy-pasted code (pppd options) refactored
parent
743dfd21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
53 deletions
+30
-53
nm-l2tp-service.c
src/nm-l2tp-service.c
+30
-53
No files found.
src/nm-l2tp-service.c
View file @
75330f5e
...
@@ -1116,6 +1116,30 @@ write_config_option (int fd, const char *format, ...)
...
@@ -1116,6 +1116,30 @@ write_config_option (int fd, const char *format, ...)
va_end
(
args
);
va_end
(
args
);
}
}
typedef
struct
{
const
char
*
name
;
GType
type
;
const
char
*
write_to_config
;
}
PPPOpt
;
static
PPPOpt
ppp_options
[]
=
{
{
NM_L2TP_KEY_REFUSE_EAP
,
G_TYPE_BOOLEAN
,
"refuse-eap
\n
"
},
{
NM_L2TP_KEY_REFUSE_PAP
,
G_TYPE_BOOLEAN
,
"refuse-pap
\n
"
},
{
NM_L2TP_KEY_REFUSE_CHAP
,
G_TYPE_BOOLEAN
,
"refuse-chap
\n
"
},
{
NM_L2TP_KEY_REFUSE_MSCHAP
,
G_TYPE_BOOLEAN
,
"refuse-mschap
\n
"
},
{
NM_L2TP_KEY_REFUSE_MSCHAPV2
,
G_TYPE_BOOLEAN
,
"refuse-mschap-v2
\n
"
},
{
NM_L2TP_KEY_REQUIRE_MPPE
,
G_TYPE_BOOLEAN
,
"require-mppe
\n
"
},
{
NM_L2TP_KEY_REQUIRE_MPPE_40
,
G_TYPE_BOOLEAN
,
"require-mppe-40
\n
"
},
{
NM_L2TP_KEY_REQUIRE_MPPE_128
,
G_TYPE_BOOLEAN
,
"require-mppe-128
\n
"
},
{
NM_L2TP_KEY_MPPE_STATEFUL
,
G_TYPE_BOOLEAN
,
"mppe-stateful
\n
"
},
{
NM_L2TP_KEY_NOBSDCOMP
,
G_TYPE_BOOLEAN
,
"nobsdcomp
\n
"
},
{
NM_L2TP_KEY_NODEFLATE
,
G_TYPE_BOOLEAN
,
"nodeflate
\n
"
},
{
NM_L2TP_KEY_NO_VJ_COMP
,
G_TYPE_BOOLEAN
,
"novj
\n
"
},
{
NM_L2TP_KEY_NO_PCOMP
,
G_TYPE_BOOLEAN
,
"nopcomp
\n
"
},
/* negate {NM_L2TP_KEY_USE_ACCOMP, G_TYPE_BOOLEAN, "noaccomp\n"}, */
{
NULL
,
G_TYPE_NONE
,
NULL
}
};
static
gboolean
static
gboolean
nm_l2tp_config_write
(
NML2tpPlugin
*
plugin
,
nm_l2tp_config_write
(
NML2tpPlugin
*
plugin
,
NMSettingVPN
*
s_vpn
,
NMSettingVPN
*
s_vpn
,
...
@@ -1130,6 +1154,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
...
@@ -1130,6 +1154,7 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
gint
conf_fd
=
-
1
;
gint
conf_fd
=
-
1
;
gint
ipsec_fd
=
-
1
;
gint
ipsec_fd
=
-
1
;
gint
pppopt_fd
=
-
1
;
gint
pppopt_fd
=
-
1
;
int
i
;
filename
=
g_strdup_printf
(
"/var/run/nm-ipsec-l2tp.%d"
,
pid
);
filename
=
g_strdup_printf
(
"/var/run/nm-ipsec-l2tp.%d"
,
pid
);
mkdir
(
filename
,
0700
);
mkdir
(
filename
,
0700
);
...
@@ -1245,63 +1270,15 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
...
@@ -1245,63 +1270,15 @@ nm_l2tp_config_write (NML2tpPlugin *plugin,
/* Don't need to auth the L2TP server */
/* Don't need to auth the L2TP server */
write_config_option
(
pppopt_fd
,
"noauth
\n
"
);
write_config_option
(
pppopt_fd
,
"noauth
\n
"
);
if
(
priv
->
service
)
service_priv
=
NM_L2TP_PPP_SERVICE_GET_PRIVATE
(
priv
->
service
);
if
(
service_priv
&&
strlen
(
service_priv
->
username
))
{
if
(
service_priv
&&
strlen
(
service_priv
->
username
))
{
write_config_option
(
pppopt_fd
,
"name %s
\n
"
,
service_priv
->
username
);
write_config_option
(
pppopt_fd
,
"name %s
\n
"
,
service_priv
->
username
);
}
}
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REFUSE_EAP
);
for
(
i
=
0
;
ppp_options
[
i
].
name
;
i
++
){
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
ppp_options
[
i
].
name
);
write_config_option
(
pppopt_fd
,
"refuse-eap
\n
"
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
ppp_options
[
i
].
write_to_config
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REFUSE_PAP
);
}
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"refuse-pap
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REFUSE_CHAP
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"refuse-chap
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REFUSE_MSCHAP
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"refuse-mschap
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REFUSE_MSCHAPV2
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"refuse-mschap-v2
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REQUIRE_MPPE
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"require-mppe
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REQUIRE_MPPE_40
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"require-mppe-40
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_REQUIRE_MPPE_128
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"require-mppe-128
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_MPPE_STATEFUL
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"mppe-stateful
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_NOBSDCOMP
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"nobsdcomp
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_NODEFLATE
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"nodeflate
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_NO_VJ_COMP
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"novj
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_NO_PCOMP
);
if
(
value
&&
!
strcmp
(
value
,
"yes"
))
write_config_option
(
pppopt_fd
,
"nopcomp
\n
"
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_USE_ACCOMP
);
value
=
nm_setting_vpn_get_data_item
(
s_vpn
,
NM_L2TP_KEY_USE_ACCOMP
);
if
(
!
(
value
&&
!
strcmp
(
value
,
"yes"
)))
if
(
!
(
value
&&
!
strcmp
(
value
,
"yes"
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment