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