|
Lines 40-45
Link Here
|
| 40 |
#include <linux/netlink.h> |
40 |
#include <linux/netlink.h> |
| 41 |
#include <linux/sockios.h> |
41 |
#include <linux/sockios.h> |
| 42 |
#include <linux/rtnetlink.h> |
42 |
#include <linux/rtnetlink.h> |
|
|
43 |
#include <linux/version.h> |
| 43 |
|
44 |
|
| 44 |
#include <arpa/inet.h> |
45 |
#include <arpa/inet.h> |
| 45 |
#include <net/if.h> |
46 |
#include <net/if.h> |
|
Lines 1455-1461
if_address(unsigned char cmd, const struct ipv4_addr *addr)
Link Here
|
| 1455 |
{ |
1456 |
{ |
| 1456 |
struct nlma nlm; |
1457 |
struct nlma nlm; |
| 1457 |
int retval = 0; |
1458 |
int retval = 0; |
| 1458 |
#if defined(IFA_F_NOPREFIXROUTE) |
1459 |
#if defined(IFA_F_NOPREFIXROUTE) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) |
| 1459 |
uint32_t flags = 0; |
1460 |
uint32_t flags = 0; |
| 1460 |
#endif |
1461 |
#endif |
| 1461 |
|
1462 |
|
|
Lines 1480-1486
if_address(unsigned char cmd, const struct ipv4_addr *addr)
Link Here
|
| 1480 |
add_attr_l(&nlm.hdr, sizeof(nlm), IFA_BROADCAST, |
1481 |
add_attr_l(&nlm.hdr, sizeof(nlm), IFA_BROADCAST, |
| 1481 |
&addr->brd.s_addr, sizeof(addr->brd.s_addr)); |
1482 |
&addr->brd.s_addr, sizeof(addr->brd.s_addr)); |
| 1482 |
|
1483 |
|
| 1483 |
#ifdef IFA_F_NOPREFIXROUTE |
1484 |
#if defined(IFA_F_NOPREFIXROUTE) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) |
| 1484 |
if (nlm.ifa.ifa_prefixlen < 32) |
1485 |
if (nlm.ifa.ifa_prefixlen < 32) |
| 1485 |
flags |= IFA_F_NOPREFIXROUTE; |
1486 |
flags |= IFA_F_NOPREFIXROUTE; |
| 1486 |
if (flags) |
1487 |
if (flags) |