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
fdc754e4
Commit
fdc754e4
authored
Nov 03, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) cleanup, loosly related to
https://github.com/opnsense/core/issues/451
parent
288bc8cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
68 deletions
+55
-68
rc.linkup
src/etc/rc.linkup
+55
-68
No files found.
src/etc/rc.linkup
View file @
fdc754e4
...
@@ -39,77 +39,64 @@ require_once("unbound.inc");
...
@@ -39,77 +39,64 @@ require_once("unbound.inc");
require_once
(
"services.inc"
);
require_once
(
"services.inc"
);
function
handle_argument_group
(
$iface
,
$argument2
)
{
function
handle_argument_group
(
$iface
,
$argument2
)
{
global
$config
;
global
$config
;
if
(
!
is_array
(
$config
[
'interfaces'
][
$iface
]))
return
;
if
(
isset
(
$config
[
'interfaces'
][
$iface
][
'ipaddr'
]))
{
if
(
isset
(
$config
[
'interfaces'
][
$iface
]))
{
$ipaddr
=
$config
[
'interfaces'
][
$iface
][
'ipaddr'
];
// set defaults
}
else
{
$ipaddr
=
null
;
$ipaddr
=
null
;
$ip6addr
=
null
;
}
if
(
isset
(
$config
[
'interfaces'
][
$iface
][
'ipaddr'
]))
{
if
(
isset
(
$config
[
'interfaces'
][
$iface
][
'ipaddrv6'
]))
{
$ipaddr
=
$config
[
'interfaces'
][
$iface
][
'ipaddr'
];
$ip6addr
=
$config
[
'interfaces'
][
$iface
][
'ipaddrv6'
];
}
}
else
{
if
(
isset
(
$config
[
'interfaces'
][
$iface
][
'ipaddrv6'
]))
{
$ip6addr
=
null
;
$ip6addr
=
$config
[
'interfaces'
][
$iface
][
'ipaddrv6'
];
}
}
$staticv4
=
false
;
if
(
is_ipaddrv4
(
$ipaddr
)
&&
is_ipaddrv6
(
$ip6addr
))
{
if
(
empty
(
$ipaddr
))
$friendly
=
convert_friendly_interface_to_friendly_descr
(
$iface
);
$staticv4
=
true
;
log_error
(
"Hotplug event detected for
{
$friendly
}
(
{
$iface
}
) but ignoring since interface is configured with static IP (
{
$ipaddr
}
{
$ip6addr
}
)"
);
else
interfaces_staticarp_configure
(
$iface
);
$staticv4
=
is_ipaddrv4
(
$ipaddr
);
/* NOTE: Do not generate event for OpenVPN since the daemon does that for us. */
$staticv6
=
false
;
if
(
substr
(
$iface
,
0
,
4
)
!=
"ovpn"
)
{
if
(
empty
(
$ip6addr
))
if
(
$argument2
==
"start"
||
$argument2
==
"up"
)
{
$staticv6
=
true
;
$iface
=
get_real_interface
(
$iface
);
else
configd_run
(
"interface newip
{
$iface
}
"
);
$staticv6
=
is_ipaddrv6
(
$ip6addr
);
}
if
(
$staticv4
===
true
&&
$staticv6
===
true
)
{
}
$friendly
=
convert_friendly_interface_to_friendly_descr
(
$iface
);
}
else
{
log_error
(
"Hotplug event detected for
{
$friendly
}
(
{
$iface
}
) but ignoring since interface is configured with static IP (
{
$ipaddr
}
{
$ip6addr
}
)"
);
switch
(
$argument2
)
{
interfaces_staticarp_configure
(
$iface
);
case
"stop"
:
$iface
=
get_real_interface
(
$iface
);
log_error
(
"DEVD Ethernet detached event for
{
$iface
}
"
);
interfaces_bring_up
(
$iface
);
interface_bring_down
(
$iface
);
/* NOTE: Do not generate event for OpenVPN since the daemon does that for us. */
break
;
if
((
$argument2
==
"start"
||
$argument2
==
"up"
)
&&
substr
(
$iface
,
0
,
4
)
!=
"ovpn"
)
case
"start"
:
configd_run
(
"interface newip
{
$iface
}
"
);
log_error
(
"DEVD Ethernet attached event for
{
$iface
}
"
);
}
else
{
log_error
(
"HOTPLUG: Configuring interface
{
$iface
}
"
);
switch
(
$argument2
)
{
require_once
(
"vpn.inc"
);
case
"stop"
:
// Do not try to readd to bridge otherwise em(4) has problems
case
"down"
:
interface_configure
(
$iface
,
true
,
true
);
log_error
(
"DEVD Ethernet detached event for
{
$iface
}
"
);
break
;
interface_bring_down
(
$iface
);
}
break
;
}
case
"start"
:
}
case
"up"
:
log_error
(
"DEVD Ethernet attached event for
{
$iface
}
"
);
log_error
(
"HOTPLUG: Configuring interface
{
$iface
}
"
);
require_once
(
"vpn.inc"
);
// Do not try to readd to bridge otherwise em(4) has problems
interface_configure
(
$iface
,
true
,
true
);
break
;
}
}
}
}
if
(
!
file_exists
(
"/var/run/booting"
))
{
if
(
!
file_exists
(
"/var/run/booting"
))
{
if
(
$argc
<
3
)
{
if
(
$argc
<
3
)
{
log_error
(
"HOTPLUG event: The number of required parameters not passed!"
);
log_error
(
"HOTPLUG event: The number of required parameters not passed!"
);
exit
;
exit
;
}
}
$action
=
$argv
[
1
];
$action
=
$argv
[
1
];
switch
(
$action
)
{
switch
(
$action
)
{
case
"start"
:
case
"start"
:
case
"stop"
:
case
"stop"
:
break
;
$interface
=
convert_real_interface_to_friendly_interface_name
(
$argv
[
2
]);
default
:
if
(
!
empty
(
$interface
))
{
log_error
(
"HOTPLUG event: The action parameter passed is wrong(
$action
) only start/stop/up/down are allowed!"
);
handle_argument_group
(
$interface
,
$action
);
exit
;
}
/* NOTREACHED */
break
;
break
;
default
:
}
log_error
(
"HOTPLUG event: The action parameter passed is wrong(
$action
) only start/stop/up/down are allowed!"
);
$interface
=
convert_real_interface_to_friendly_interface_name
(
$argv
[
2
]);
break
;
if
(
!
empty
(
$interface
))
{
}
handle_argument_group
(
$interface
,
$action
);
}
}
}
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