-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
204 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ | |
|
||
enable_color = True | ||
log_level = logging.INFO | ||
# TODO: RE-Enable | ||
enable_generic_prober_in_capture = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
ping_count = 2 | ||
dnssd_browsing_time_seconds = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import probe.probe as p | ||
from capture.utils.host_platform import get_ll_interface | ||
from . import config | ||
from log import get_logger | ||
|
||
logger = get_logger(__file__) | ||
|
||
|
||
class ProberLinuxHost(p.GenericMatterProber): | ||
|
||
def __init__(self, artifact_dir: str, dnssd_artifact_dir: str) -> None: | ||
super(ProberLinuxHost, self).__init__(artifact_dir, dnssd_artifact_dir) | ||
self.logger = logger | ||
|
||
def probe_v4(self, ipv4: str, port: str) -> None: | ||
self.run_command(f"ping -c {config.ping_count} {ipv4}") | ||
|
||
def probe_v6(self, ipv6: str, port: str) -> None: | ||
self.run_command(f"ping -c {config.ping_count} -6 {ipv6}") | ||
|
||
def probe_v6_ll(self, ipv6_ll: str, port: str) -> None: | ||
interface = get_ll_interface() | ||
self.run_command(f"ping -c {config.ping_count} -6 {ipv6_ll}%{interface}") | ||
|
||
def discover_targets_by_neighbor(self) -> None: | ||
pass | ||
|
||
def check_routes(self) -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import probe.probe as p | ||
from capture.utils.host_platform import get_ll_interface | ||
from log import get_logger | ||
from . import config | ||
|
||
logger = get_logger(__file__) | ||
|
||
|
||
class ProberMacHost(p.GenericMatterProber): | ||
|
||
def __init__(self, artifact_dir: str, dnssd_artifact_dir: str) -> None: | ||
super(ProberMacHost, self).__init__(artifact_dir, dnssd_artifact_dir) | ||
self.logger = logger | ||
|
||
def probe_v4(self, ipv4: str, port: str) -> None: | ||
self.run_command(f"ping -c {config.ping_count} {ipv4}") | ||
|
||
def probe_v6(self, ipv6: str, port: str) -> None: | ||
self.run_command(f"ping6 -c {config.ping_count} {ipv6}") | ||
|
||
def probe_v6_ll(self, ipv6_ll: str, port: str) -> None: | ||
interface = get_ll_interface() | ||
self.run_command(f"ping6 -c {config.ping_count} -I {interface} {ipv6_ll}") | ||
|
||
def discover_targets_by_neighbor(self) -> None: | ||
self.run_command("arp -a") # v4 | ||
self.run_command("ndp -an") # v6 | ||
|
||
def check_routes(self) -> None: | ||
self.run_command("netstat -r -f inet6 -n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from capture.utils.host_platform import is_mac | ||
from .mac import ProberMacHost | ||
from .linux import ProberLinuxHost | ||
|
||
|
||
def run_probes(artifact_dir: str, dnssd_dir: str) -> None: | ||
if is_mac(): | ||
ProberMacHost(artifact_dir, dnssd_dir).probe() | ||
else: | ||
ProberLinuxHost(artifact_dir, dnssd_dir).probe() |