Revision b6c9d8eb

View differences:

sysdep/linux/netlink/krt-scan.h
22 22
#endif
23 23

  
24 24
struct krt_scan_params {
25
  int async;				/* Allow asynchronous events */
26 25
  int table_id;				/* Kernel table ID we sync with */
27 26
};
28 27

  
......
32 31

  
33 32
static inline int krt_scan_params_same(struct krt_scan_params *o, struct krt_scan_params *n)
34 33
{
35
  return o->async == n->async && o->table_id == n->table_id;
34
  return o->table_id == n->table_id;
36 35
}
37 36

  
38 37
#endif
sysdep/linux/netlink/netlink.Y
1 1
/*
2 2
 *	BIRD -- Linux Netlink Configuration
3 3
 *
4
 *	(c) 1999 Martin Mares <mj@ucw.cz>
4
 *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
5 5
 *
6 6
 *	Can be freely distributed and used under the terms of the GNU GPL.
7 7
 */
......
17 17
CF_ADDTO(kern_proto, kern_proto nl_item ';')
18 18

  
19 19
nl_item:
20
   ASYNC bool { THIS_KRT->scan.async = $2; }
21
 | KERNEL TABLE expr {
20
   KERNEL TABLE expr {
22 21
	if ($3 <= 0 || $3 >= NL_NUM_TABLES)
23 22
	  cf_error("Kernel routing table number out of range");
24 23
	THIS_KRT->scan.table_id = $3;
sysdep/linux/netlink/netlink.c
768 768
  x = recvmsg(sk->fd, &m, 0);
769 769
  if (x < 0)
770 770
    {
771
      if (errno != EWOULDBLOCK)
771
      if (errno == ENOBUFS)
772
	{
773
	  /*
774
	   *  Netlink reports some packets have been thrown away.
775
	   *  One day we might react to it by asking for route table
776
	   *  scan in near future.
777
	   */
778
	  return 1;	/* More data are likely to be ready */
779
	}
780
      else if (errno != EWOULDBLOCK)
772 781
	log(L_ERR "Netlink recvmsg: %m");
773 782
      return 0;
774 783
    }
......
800 809
  sock *sk;
801 810
  struct sockaddr_nl sa;
802 811
  int fd;
812
  static int nl_open_tried = 0;
813

  
814
  if (nl_open_tried)
815
    return;
816
  nl_open_tried = 1;
803 817

  
804 818
  DBG("KRT: Opening async netlink socket\n");
805 819

  
......
859 873
void
860 874
krt_scan_construct(struct krt_config *x)
861 875
{
862
  x->scan.async = 1;
863 876
#ifndef IPV6
864 877
  x->scan.table_id = RT_TABLE_MAIN;
865 878
#endif
866
  /* FIXME: Use larger defaults for scanning times? */
867 879
}
868 880

  
869 881
void
......
874 886
  if (first)
875 887
    {
876 888
      nl_open();
877
      if (KRT_CF->scan.async)	/* FIXME: Async is for debugging only. Get rid of it some day. */
878
	nl_open_async();
889
      nl_open_async();
879 890
    }
880 891
}
881 892

  
......
888 899
krt_if_start(struct kif_proto *p)
889 900
{
890 901
  nl_open();
891
  /* FIXME: nl_open_async() after scan.async is gone */
902
  nl_open_async();
892 903
}

Also available in: Unified diff