1d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes/* 277c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr> 377c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com> 439bac055674d23770b9a724221b728e443196ea7Elliott Hughes * Copyright (c) 2016-2017 The strace developers. 5d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * All rights reserved. 6d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * 7d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * Redistribution and use in source and binary forms, with or without 8d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * modification, are permitted provided that the following conditions 9d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * are met: 10d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * 1. Redistributions of source code must retain the above copyright 11d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * notice, this list of conditions and the following disclaimer. 12d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * 2. Redistributions in binary form must reproduce the above copyright 13d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * notice, this list of conditions and the following disclaimer in the 14d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * documentation and/or other materials provided with the distribution. 15d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * 3. The name of the author may not be used to endorse or promote products 16d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * derived from this software without specific prior written permission. 17d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * 18d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes */ 29d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes 30d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes#include "defs.h" 31d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes 3277c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#ifdef HAVE_STRUCT_NETCONFMSG 33d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes 3477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include "netlink_route.h" 3577c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include "nlattr.h" 3677c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include "print_fields.h" 37d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes 3877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include <linux/netconf.h> 3977c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include "netlink.h" 4077c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes 4177c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes# include "xlat/rtnl_netconf_attrs.h" 4277c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes 4377c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughesstatic const nla_decoder_t netconfmsg_nla_decoders[] = { 4477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_IFINDEX] = decode_nla_ifindex, 4577c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_FORWARDING] = decode_nla_s32, 4677c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_RP_FILTER] = decode_nla_s32, 4777c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_MC_FORWARDING] = decode_nla_s32, 4877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_PROXY_NEIGH] = decode_nla_s32, 4977c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN] = decode_nla_s32, 5077c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes [NETCONFA_INPUT] = decode_nla_s32 5177c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes}; 52d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes 5377c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott HughesDECL_NETLINK_ROUTE_DECODER(decode_netconfmsg) 5477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes{ 5577c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes struct netconfmsg ncm = { .ncm_family = family }; 56d35df493b4e7684c50d2d2fa032ee3a7ac228009Elliott Hughes 5777c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes PRINT_FIELD_XVAL("{", ncm, ncm_family, addrfams, "AF_???"); 5877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes tprints("}"); 5977c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes 6077c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes const size_t offset = NLMSG_ALIGN(sizeof(ncm)); 6177c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes if (len > offset) { 6277c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes tprints(", "); 6377c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes decode_nlattr(tcp, addr + offset, len - offset, 6477c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes rtnl_netconf_attrs, "NETCONFA_???", 6577c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes netconfmsg_nla_decoders, 6677c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes ARRAY_SIZE(netconfmsg_nla_decoders), NULL); 6777c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes } 6877c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes} 6977c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes 7077c3ff8e0644f1e120e4b2ebc7222150b0446f3bElliott Hughes#endif 71