diff options
| author | vivek <vivek@cumulusnetworks.com> | 2016-10-17 12:39:55 -0700 | 
|---|---|---|
| committer | vivek <vivek@cumulusnetworks.com> | 2016-10-17 12:39:55 -0700 | 
| commit | 1fdc9eae2d80ec361e2a22d588944013a5d9b0b7 (patch) | |
| tree | 69422d28f9d412a1e972569fd6d692121ff62a4a /zebra/kernel_netlink.h | |
| parent | 4deabffba554fdd9b25709438affcc6132f8e6b1 (diff) | |
zebra: Refactor netlink interactions
Separate core netlink functions and library functions from route-related
interactions and interface-related interactions.
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>
Ticket: CM-13199
Reviewed By: CCR-5254
Testing Done: bgp-min, ospf-min
Diffstat (limited to 'zebra/kernel_netlink.h')
| -rw-r--r-- | zebra/kernel_netlink.h | 53 | 
1 files changed, 53 insertions, 0 deletions
diff --git a/zebra/kernel_netlink.h b/zebra/kernel_netlink.h new file mode 100644 index 0000000000..0efd89f125 --- /dev/null +++ b/zebra/kernel_netlink.h @@ -0,0 +1,53 @@ +/* Declarations and definitions for kernel interaction over netlink + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Zebra; see the file COPYING.  If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA.   + */ + +#ifndef _ZEBRA_KERNEL_NETLINK_H +#define _ZEBRA_KERNEL_NETLINK_H + +#ifdef HAVE_NETLINK + +#define NL_PKT_BUF_SIZE         8192 + +extern void netlink_parse_rtattr (struct rtattr **tb, int max, +                                  struct rtattr *rta, int len); +extern int addattr_l (struct nlmsghdr *n, unsigned int maxlen, +                      int type, void *data, int alen); +extern int rta_addattr_l (struct rtattr *rta, unsigned int maxlen, +                          int type, void *data, int alen); +extern int addattr32 (struct nlmsghdr *n, unsigned int maxlen, +                      int type, int data); +extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type); +extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest); +extern struct rtattr * rta_nest(struct rtattr *rta, int maxlen, int type); +extern int rta_nest_end(struct rtattr *rta, struct rtattr *nest); +extern const char * nl_msg_type_to_str (uint16_t msg_type); +extern const char * nl_rtproto_to_str (u_char rtproto); + +extern int netlink_parse_info (int (*filter) (struct sockaddr_nl *, +                               struct nlmsghdr *, ns_id_t), struct nlsock *nl, +                               struct zebra_ns *zns, int count); +extern int netlink_talk (struct nlmsghdr *n, struct nlsock *nl, +                         struct zebra_ns *zns); +extern int netlink_request (int family, int type, struct nlsock *nl); + +#endif /* HAVE_NETLINK */ + +#endif /* _ZEBRA_KERNEL_NETLINK_H */  | 
