| 1 |
/* SPDX-License-Identifier: LGPL-2.1-only */ |
| 2 |
|
| 3 |
#include "nl-default.h" |
| 4 |
|
| 5 |
#include <netlink/netlink.h> |
| 6 |
|
| 7 |
int main(int argc, char *argv[]) |
| 8 |
{ |
| 9 |
struct nl_sock *h[1025]; |
| 10 |
int i; |
| 11 |
|
| 12 |
h[0] = nl_socket_alloc(); |
| 13 |
printf("Created handle with port 0x%x\n", |
| 14 |
nl_socket_get_local_port(h[0])); |
| 15 |
nl_socket_free(h[0]); |
| 16 |
h[0] = nl_socket_alloc(); |
| 17 |
printf("Created handle with port 0x%x\n", |
| 18 |
nl_socket_get_local_port(h[0])); |
| 19 |
nl_socket_free(h[0]); |
| 20 |
|
| 21 |
for (i = 0; i < 1025; i++) { |
| 22 |
h[i] = nl_socket_alloc(); |
| 23 |
if (h[i] == NULL) |
| 24 |
nl_perror(ENOMEM, "Unable to allocate socket"); |
| 25 |
else |
| 26 |
printf("Created handle with port 0x%x\n", |
| 27 |
nl_socket_get_local_port(h[i])); |
| 28 |
} |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |