Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
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
Valentin Platzgummer
qgroundcontrol
Commits
e61162c2
Commit
e61162c2
authored
May 28, 2015
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UDP link handling on IPV6 systems
parent
57d5f386
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
UDPLink.cc
src/comm/UDPLink.cc
+10
-3
No files found.
src/comm/UDPLink.cc
View file @
e61162c2
...
@@ -42,9 +42,12 @@ This file is part of the QGROUNDCONTROL project
...
@@ -42,9 +42,12 @@ This file is part of the QGROUNDCONTROL project
static
bool
is_ip
(
const
QString
&
address
)
static
bool
is_ip
(
const
QString
&
address
)
{
{
int
a
,
b
,
c
,
d
;
int
a
,
b
,
c
,
d
;
if
(
sscanf
(
address
.
toStdString
().
c_str
(),
"%d.%d.%d.%d"
,
&
a
,
&
b
,
&
c
,
&
d
)
!=
4
)
if
(
sscanf
(
address
.
toStdString
().
c_str
(),
"%d.%d.%d.%d"
,
&
a
,
&
b
,
&
c
,
&
d
)
!=
4
&&
strcmp
(
"::1"
,
address
.
toStdString
().
c_str
()))
{
return
false
;
return
false
;
}
else
{
return
true
;
return
true
;
}
}
}
static
QString
get_ip_address
(
const
QString
&
address
)
static
QString
get_ip_address
(
const
QString
&
address
)
...
@@ -134,6 +137,10 @@ void UDPLink::removeHost(const QString& host)
...
@@ -134,6 +137,10 @@ void UDPLink::removeHost(const QString& host)
void
UDPLink
::
writeBytes
(
const
char
*
data
,
qint64
size
)
void
UDPLink
::
writeBytes
(
const
char
*
data
,
qint64
size
)
{
{
if
(
!
_socket
)
{
return
;
}
// Broadcast to all connected systems
// Broadcast to all connected systems
QString
host
;
QString
host
;
int
port
;
int
port
;
...
@@ -349,7 +356,7 @@ void UDPConfiguration::addHost(const QString& host, int port)
...
@@ -349,7 +356,7 @@ void UDPConfiguration::addHost(const QString& host, int port)
}
else
{
}
else
{
QString
ipAdd
=
get_ip_address
(
host
);
QString
ipAdd
=
get_ip_address
(
host
);
if
(
ipAdd
.
isEmpty
())
{
if
(
ipAdd
.
isEmpty
())
{
qWarning
()
<<
"UDP:"
<<
"Could not resolve
"
<<
hos
t
;
qWarning
()
<<
"UDP:"
<<
"Could not resolve
host:"
<<
host
<<
"port:"
<<
por
t
;
}
else
{
}
else
{
_hosts
[
ipAdd
]
=
port
;
_hosts
[
ipAdd
]
=
port
;
qDebug
()
<<
"UDP:"
<<
"Adding Host:"
<<
ipAdd
<<
":"
<<
port
;
qDebug
()
<<
"UDP:"
<<
"Adding Host:"
<<
ipAdd
<<
":"
<<
port
;
...
...
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