]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmp-libnl.patch
- adjusted libnl patch and dependencies for libnl 3.2.x
[packages/net-snmp.git] / net-snmp-libnl.patch
1 --- net-snmp-5.6.1/agent/mibgroup/mibII/tcpTable.c.org  2011-03-27 22:39:13.428728506 +0200
2 +++ net-snmp-5.6.1/agent/mibgroup/mibII/tcpTable.c      2011-03-27 22:39:47.606956561 +0200
3 @@ -555,8 +555,9 @@
4  static int
5  tcpTable_load_netlink(void)
6  {
7 +       int err;
8         /*  TODO: perhaps use permanent nl handle? */
9 -       struct nl_handle *nl = nl_handle_alloc();
10 +       struct nl_sock *nl = nl_socket_alloc();
11  
12         if (nl == NULL) {
13                 DEBUGMSGTL(("mibII/tcpTable", "Failed to allocate netlink handle\n"));
14 @@ -564,10 +565,10 @@
15                 return -1;
16         }
17  
18 -       if (nl_connect(nl, NETLINK_INET_DIAG) < 0) {
19 -               DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror()));
20 -               snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror());
21 -               nl_handle_destroy(nl);
22 +       if ((err = nl_connect(nl, NETLINK_INET_DIAG)) < 0) {
23 +               DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror(err)));
24 +               snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror(err));
25 +               nl_socket_free(nl);
26                 return -1;
27         }
28  
29 @@ -579,10 +580,10 @@
30         struct nl_msg *nm = nlmsg_alloc_simple(TCPDIAG_GETSOCK, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST);
31         nlmsg_append(nm, &req, sizeof(struct inet_diag_req), 0);
32  
33 -       if (nl_send_auto_complete(nl, nm) < 0) {
34 -               DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror()));
35 -               snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror());
36 -               nl_handle_destroy(nl);
37 +       if ((err = nl_send_auto_complete(nl, nm)) < 0) {
38 +               DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror(err)));
39 +               snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror(err));
40 +               nl_socket_free(nl);
41                 return -1;
42         }
43         nlmsg_free(nm);
44 @@ -593,9 +594,9 @@
45  
46         while (running) {
47                 if ((len = nl_recv(nl, &peer, &buf, NULL)) <= 0) {
48 -                       DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror()));
49 -                       snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror());
50 -                       nl_handle_destroy(nl);
51 +                       DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror(len)));
52 +                       snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror(len));
53 +                       nl_socket_free(nl);
54                         return -1;
55                 }
56  
57 @@ -644,7 +645,7 @@
58                 free(buf);
59         }
60  
61 -       nl_handle_destroy(nl);
62 +       nl_socket_free(nl);
63  
64         if (tcp_head) {
65                 DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table using netlink\n"));
66 --- net-snmp-5.7.1/configure.d/config_os_libs2.orig     2011-09-28 06:53:47.000000000 +0200
67 +++ net-snmp-5.7.1/configure.d/config_os_libs2  2011-10-30 12:25:15.940463045 +0100
68 @@ -222,10 +222,11 @@
69  #
70  
71  if test "x$with_nl" != "xno"; then
72 +    CPPFLAGS="$CPPFLAGS -I/usr/include/libnl3"
73      case $target_os in
74      linux*) # Check for libnl (linux)
75         NETSNMP_SEARCH_LIBS(
76 -           nl_connect, nl,
77 +           nl_connect, nl-3,
78             [AC_CHECK_HEADERS(netlink/netlink.h)],,, LMIBLIBS)
79      ;;
80      esac
This page took 0.032891 seconds and 4 git commands to generate.