mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.1 KiB

  1. --- zebra-0.91a/zebra/rt_netlink.c.netlink Tue Jan 23 03:10:04 2001
  2. +++ zebra-0.91a/zebra/rt_netlink.c Wed Oct 29 22:46:44 2003
  3. @@ -46,9 +46,8 @@
  4. int seq;
  5. struct sockaddr_nl snl;
  6. char *name;
  7. -} netlink = { -1, 0, {0}, "netlink-listen" }, /* kernel messages */
  8. - netlink_cmd = { -1, 0, {0}, "netlink-cmd" }, /* command channel */
  9. - netlink_addr = {-1, 0, {0}, "netlink-addr" }; /* address channel */
  10. +} netlink_sock ={ -1, 0, {0}, "netlink-listen" }, /* kernel messages */
  11. + netlink_cmd = { -1, 0, {0}, "netlink-cmd" }; /* command channel */
  12. struct message nlmsg_str[] =
  13. {
  14. @@ -206,6 +205,13 @@
  15. return -1;
  16. }
  17. + /* JF: Ignore messages that aren't from the kernel */
  18. + if ( snl.nl_pid != 0 )
  19. + {
  20. + zlog ( NULL, LOG_ERR, "Ignoring message from pid %u", snl.nl_pid );
  21. + continue;
  22. + }
  23. +
  24. for (h = (struct nlmsghdr *) buf; NLMSG_OK (h, status);
  25. h = NLMSG_NEXT (h, status))
  26. {
  27. @@ -1052,7 +1058,7 @@
  28. snl.nl_family = AF_NETLINK;
  29. /* Talk to netlink socket. */
  30. - ret = netlink_talk (&req.n, &netlink);
  31. + ret = netlink_talk (&req.n, &netlink_sock);
  32. if (ret < 0)
  33. return -1;
  34. @@ -1270,7 +1276,7 @@
  35. if (family == AF_INET)
  36. nl = &netlink_cmd;
  37. else
  38. - nl = &netlink;
  39. + nl = &netlink_sock;
  40. /* Talk to netlink socket. */
  41. return netlink_talk (&req.n, nl);
  42. @@ -1384,8 +1390,8 @@
  43. int sock;
  44. sock = THREAD_FD (thread);
  45. - ret = netlink_parse_info (netlink_information_fetch, &netlink);
  46. - thread_add_read (master, kernel_read, NULL, netlink.sock);
  47. + ret = netlink_parse_info (netlink_information_fetch, &netlink_sock);
  48. + thread_add_read (master, kernel_read, NULL, netlink_sock.sock);
  49. return 0;
  50. }
  51. @@ -1401,10 +1407,10 @@
  52. #ifdef HAVE_IPV6
  53. groups |= RTMGRP_IPV6_ROUTE|RTMGRP_IPV6_IFADDR;
  54. #endif /* HAVE_IPV6 */
  55. - netlink_socket (&netlink, groups);
  56. + netlink_socket (&netlink_sock, groups);
  57. netlink_socket (&netlink_cmd, 0);
  58. /* Register kernel socket. */
  59. - if (netlink.sock > 0)
  60. - thread_add_read (master, kernel_read, NULL, netlink.sock);
  61. + if (netlink_sock.sock > 0)
  62. + thread_add_read (master, kernel_read, NULL, netlink_sock.sock);
  63. }