Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
611d9722
Commit
611d9722
authored
May 31, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system: add system_host_route(), later we also want system_default_route()
parent
2a2bca91
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
interfaces.inc
src/etc/inc/interfaces.inc
+1
-9
system.inc
src/etc/inc/system.inc
+14
-0
No files found.
src/etc/inc/interfaces.inc
View file @
611d9722
...
...
@@ -985,15 +985,7 @@ function interface_gif_configure(&$gif, $gifkey = "")
file_put_contents
(
"/tmp/
{
$gifif
}
_routerv6"
,
$gif
[
'tunnel-remote-addr'
]);
}
if
(
is_ipaddrv4
(
$realifgw
))
{
mwexec
(
"/sbin/route delete -host "
.
escapeshellarg
(
$gif
[
'remote-addr'
]));
mwexec
(
"/sbin/route add -host "
.
escapeshellarg
(
$gif
[
'remote-addr'
])
.
"
{
$realifgw
}
"
);
}
if
(
is_ipaddrv6
(
$realifgw
))
{
mwexec
(
"/sbin/route delete -host -inet6 "
.
escapeshellarg
(
$gif
[
'remote-addr'
]));
mwexec
(
"/sbin/route add -host -inet6 "
.
escapeshellarg
(
$gif
[
'remote-addr'
])
.
"
{
$realifgw
}
"
);
}
system_host_route
(
$gif
[
'remote-addr'
],
$realifgw
);
interfaces_bring_up
(
$gifif
);
return
$gifif
;
...
...
src/etc/inc/system.inc
View file @
611d9722
...
...
@@ -425,6 +425,20 @@ function system_hostname_configure($verbose = false)
}
}
function
system_host_route
(
$host
,
$gateway
)
{
if
(
is_ipaddrv4
(
$realifgw
))
{
$family
=
'inet'
;
}
elseif
(
is_ipaddrv6
(
$realifgw
))
{
$family
=
'inet6'
;
}
else
{
return
;
}
mwexecf
(
'/sbin/route delete -host -%s %s'
,
array
(
$family
,
$host
),
true
);
mwexecf
(
'/sbin/route add -host -%s %s %s'
,
array
(
$family
,
$host
,
$gateway
));
}
function
system_routing_configure
(
$interface
=
''
,
$verbose
=
false
)
{
global
$config
;
...
...
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