Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
04e8cc38
Commit
04e8cc38
authored
Jun 23, 2023
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compile extended ack reporting only for kernel >= 4.12
parent
c6c00908
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
kernel_netlink.c
kernel_netlink.c
+9
-0
No files found.
kernel_netlink.c
View file @
04e8cc38
...
@@ -39,6 +39,7 @@ THE SOFTWARE.
...
@@ -39,6 +39,7 @@ THE SOFTWARE.
#include <sys/socket.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/rtnetlink.h>
#include <linux/version.h>
#include <net/if_arp.h>
#include <net/if_arp.h>
/* From <linux/if_bridge.h> */
/* From <linux/if_bridge.h> */
...
@@ -73,6 +74,10 @@ THE SOFTWARE.
...
@@ -73,6 +74,10 @@ THE SOFTWARE.
memcpy(d, RTA_DATA(rta), 16); \
memcpy(d, RTA_DATA(rta), 16); \
} while(0)
} while(0)
/* extended ACK reporting was introduced in Linux by commit
2d4bc93368f5a0ddb57c8c885cdad9c9b7a10ed5 first released as 4.12 */
#define EXTENDED_ACK_REPORTING (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
int
export_table
=
-
1
,
import_tables
[
MAX_IMPORT_TABLES
],
import_table_count
=
0
;
int
export_table
=
-
1
,
import_tables
[
MAX_IMPORT_TABLES
],
import_table_count
=
0
;
struct
sysctl_setting
{
struct
sysctl_setting
{
...
@@ -319,10 +324,12 @@ netlink_socket(struct netlink *nl, uint32_t groups)
...
@@ -319,10 +324,12 @@ netlink_socket(struct netlink *nl, uint32_t groups)
}
}
}
}
#if EXTENDED_ACK_REPORTING
rc
=
setsockopt
(
nl
->
sock
,
SOL_NETLINK
,
NETLINK_EXT_ACK
,
rc
=
setsockopt
(
nl
->
sock
,
SOL_NETLINK
,
NETLINK_EXT_ACK
,
&
one
,
sizeof
(
one
));
&
one
,
sizeof
(
one
));
if
(
rc
<
0
)
if
(
rc
<
0
)
perror
(
"Warning: couldn't enable netlink extended acks"
);
perror
(
"Warning: couldn't enable netlink extended acks"
);
#endif
rc
=
bind
(
nl
->
sock
,
(
struct
sockaddr
*
)
&
nl
->
sockaddr
,
nl
->
socklen
);
rc
=
bind
(
nl
->
sock
,
(
struct
sockaddr
*
)
&
nl
->
sockaddr
,
nl
->
socklen
);
if
(
rc
<
0
)
if
(
rc
<
0
)
...
@@ -354,6 +361,7 @@ netlink_socket(struct netlink *nl, uint32_t groups)
...
@@ -354,6 +361,7 @@ netlink_socket(struct netlink *nl, uint32_t groups)
static
int
netlink_get_extack
(
struct
nlmsghdr
*
nh
,
int
len
,
int
done
)
static
int
netlink_get_extack
(
struct
nlmsghdr
*
nh
,
int
len
,
int
done
)
{
{
#if EXTENDED_ACK_REPORTING
const
char
*
msg
=
NULL
;
const
char
*
msg
=
NULL
;
struct
nlattr
*
nla
;
struct
nlattr
*
nla
;
...
@@ -378,6 +386,7 @@ static int netlink_get_extack(struct nlmsghdr *nh, int len, int done)
...
@@ -378,6 +386,7 @@ static int netlink_get_extack(struct nlmsghdr *nh, int len, int done)
if
(
msg
&&
*
msg
!=
'\0'
)
if
(
msg
&&
*
msg
!=
'\0'
)
kdebugf
(
" extack: '%s' "
,
msg
);
kdebugf
(
" extack: '%s' "
,
msg
);
#endif
return
0
;
return
0
;
}
}
...
...
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