pax_global_header00006660000000000000000000000064147010011030014475gustar00rootroot0000000000000052 comment=cd96f76a1bd83e13dbb9e4eb6747db5033acbc71 nield-0.6.2/000077500000000000000000000000001470100110300125755ustar00rootroot00000000000000nield-0.6.2/.gitignore000066400000000000000000000003371470100110300145700ustar00rootroot00000000000000# Object files *.o *.ko *.obj *.elf # Precompiled Headers *.gch *.pch # Libraries *.lib *.a *.la *.lo # Shared objects (inc. Windows DLLs) *.dll *.so *.so.* *.dylib # Executables *.exe *.out *.app *.i*86 *.x86_64 *.hex nield-0.6.2/COPYING000066400000000000000000000432541470100110300136400ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. nield-0.6.2/ChangeLog000066400000000000000000000141411470100110300143500ustar00rootroot000000000000002024-10-08 Tetsumune KISO * Release - nield 0.6.2 released * Fix - handling of retired TC 2016-01-21 Tetsumune KISO * Update - update copyrights. 2015-08-29 Tetsumune KISO * Fix - deleted the unreferred function "parse_tca_baseclass". * Fix - fixed some compiler warnings. 2015-05-09 Tetsumune KISO * Update - don't exit in case of ENOBUF or ENOMEM. 2015-04-28 Tetsumune KISO * Release - nield 0.6.1 released. 2015-02-18 Tetsumune KISO * Bug fix - too few arguments in function 'rec_dbg'. 2015-01-04 Tetsumune KISO * Bug fix - undefined reference to `conv_br_state'. * Bug fix - "TCA_CHOKE_MAX_P" undeclared. 2015-01-03 Tetsumune KISO * Bug fix - repeatedly generated the same log when configured IPv4 address via DHCP or IPv6 address via SLAAC. 2014-12-21 Tetsumune KISO * Bug fix - 'IFLA_BOND_XMIT_HASH_POLICY' undeclared. Thanks to navitiello for the bug report. 2014-12-20 Tetsumune KISO * Update - added an Upstart job for nield contributed by Cameron Norman. 2014-12-10 Tetsumune KISO * Release - nield 0.6.0 released. * News - moved from sourceforge to github. 2014-10-05 Tetsumune KISO * Update - added a support for "IFLA_BRPORT_*" attributes. 2014-04-28 Tetsumune KISO * Release - nield 0.5.1 released. 2014-04-24 Tetsumune KISO * Update - added a code to verify whether a message originates from kernel. * Update - deleted kernel header files. 2014-04-18 Tetsumune KISO * Update - "contrib/fedora/nield.service" added. 2014-02-26 Tetsumune KISO * Release - nield 0.5.0 released. 2014-01-22 Tetsumune KISO * Update - "-s" option added. It change a receive buffer size of socket. 2013-10-10 Tetsumune KISO * Bug fix - can't display a routing table id properly. 2013-08-07 Tetsumune KISO * Release - nield 0.4.0 released. This release includes traffic control support. 2013-04-14 Tetsumune KISO * Update - log fromat changed. 2013-04-11 Tetsumune KISO * Update - add a SIGUSR1 signal handler to print a list of current interfaces(/tmp/nield.list). * Update - add a SIGUSR2 signal handler to print a list of deleted interfaces(/tmp/nield.hist). 2013-03-08 Tetsumune KISO * Update - "unresolved" message in neighbor cache added. 2012-08-17 Tetsumune KISO * Bug fix - Display an old usage. 2012-06-23 Tetsumune KISO * Release - nield 0.3.0 * Update - syslog support * Update - man page 2012-04-28 Tetsumune KISO * Update - It was updated a man page. 2012-04-25 Tetsumune KISO * Update - It was updated to monitor a promiscuous mode of an interface. 2012-04-11 Tetsumune KISO * Release - nield 0.23 was released. * Bug fix - ARP & NDP of multiple interfaces in the same segment cannot be handled properly. 2012-04-02 Tetsumune KISO * -p option to make possible to run more processes was added. 2012-02-10 Tetsumune KISO * nield 0.22 released. * It changed use variable "extra_commands" instead of "OPTIONS" in "contrib/gentoo/nield". 2012-01-24 Tetsumune KISO * It changed to display an interface name of IFLA_LINK. 2012-01-20 Tetsumune KISO * It changed to compare ifi_index with IFLA_MASTER in ifimsg.c if ifi_family is PF_BRIDGE (workaround: "ovs-vsctl add-br" command). 2011-12-27 Tetsumune KISO * nield 0.21 released. 2011-12-25 Tetsumune KISO * It changed to debug __ifi_pad. 2011-12-24 Tetsumune KISO * It changed to debug IFLA_VLAN_*, IFLA_VLAN_QOS_*. 2011-12-23 Tetsumune KISO * It improved the code. 2011-12-22 Tetsumune KISO * "linux/*.h" was replaced the ones of linux 3.1.5. * It added a suuport for gretap interface. 2011-11-30 Tetsumune KISO * The bug that it can't dispay an address of a TUN device correctly was fixed. 2011-09-28 Tetsumune KISO * It changed a format of unknown ifam_scope value. 2011-08-21 Tetsumune KISO * Invalid format of rec_log in nield.c is fixed. 2011-08-17 Tetsumune KISO * nield 0.20 released. * It added new events to display the state of the bonding interface. 2011-08-16 Tetsumune KISO * It added new events to display the state of the ehternet bridge. * IFLA_MASTER "master" was added to the interface list "iflist_entry". 2011-08-15 Tetsumune KISO * IFLA_INFO_KIND "kind" was added to the interface list "iflist_entry". * It changed to debug IFLA_AF_SPEC(but ignored). * "linux/if_link.h" was changed the one of linux 3.0. * It added the ability to display the interface name when debug IFLA_MASTER. 2011-08-14 Tetsumune KISO * It changed to debug IFLA_STATS64, IFLA_VF_PORTS and IFLA_PORT_SELF(but ignored). 2011-08-13 Tetsumune KISO * It chaned not to display an error even if there is a message related to other than AF_INET and AF_INET6 in neighbor discovery messages(for linux 3.0). * It changed the order of operations to parse attributes and debug messages. * It changed a debug format. 2011-08-12 Tetsumune KISO * "__func__" was added in ERROR message. 2011-08-03 Tetsumune KISO * Kinds of IFLA_INFO_KIND other than vlan, bond, tun were able to be displayed. 2011-07-30 Tetsumune KISO * The bug that is not able to generate a log correctly for IPV6CP was fixed. 2011-06-21 Tetsumune KISO * nield 0.11 released. * It fixed to debug rtm_flags and check RTM_F_CLONED. 2011-01-23 Tetsumune KISO * nield 0.10 released. nield-0.6.2/INSTALL000066400000000000000000000007251470100110300136320ustar00rootroot00000000000000 01. Building / Installation --------------------------- To install/build nield: tar xvzf nield-x.x.x.tar.gz cd nield-x.x.x ./configure make make install 02. Startup Script ------------------ To install startup script: CentOS, Redhat, Fedora: cp -p contrib/redhat/nield /etc/init.d/ chkconfig --add nield Ubuntu: sudo cp -p contrib/ubuntu/nield /etc/init.d/ sudo sysrc-conf nield on Gentoo: cp -p contrib/gentoo/nield /etc/init.d/ rc-update add nield default nield-0.6.2/LICENSE000066400000000000000000000431531470100110300136100ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {description} Copyright (C) {year} {fullname} This program 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 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. nield-0.6.2/Makefile.am000066400000000000000000000002071470100110300146300ustar00rootroot00000000000000SUBDIRS = src man EXTRA_DIST = \ contrib/gentoo/nield \ contrib/redhat/nield \ contrib/ubuntu/nield \ contrib/fedora/nield.service nield-0.6.2/Makefile.in000066400000000000000000000615361470100110300146550ustar00rootroot00000000000000# Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \ ChangeLog INSTALL README.md compile config.guess config.sub \ depcomp install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \ ; rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = -9 DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = \ find . \( -type f -a \! \ \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src man EXTRA_DIST = \ contrib/gentoo/nield \ contrib/redhat/nield \ contrib/ubuntu/nield \ contrib/fedora/nield.service all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status $(AM_V_at)rm -f stamp-h1 $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) $(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER)) $(AM_V_at)rm -f stamp-h1 $(AM_V_at)touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) $(AM_V_at)$(MKDIR_P) "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ dist-zstd distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% nield-0.6.2/README.md000066400000000000000000000302111470100110300140510ustar00rootroot00000000000000##![nield image](img/nield.jpg) nield (Network Interface Events Logging Daemon) is a tool to receive notifications from kernel through netlink socket, and generate logs related to interfaces, neighbor cache (ARP,NDP), IP address (IPv4,IPv6), routing, FIB rules, traffic control. ##Requirements linux ##Download ###git command $ git clone https://github.com/t2mune/nield.git ##Install $ ./configure $ make # make install ##Usage nield [-vh46inarft] [-p lock_file] [-s buffer_size] [-l log_file] [-L syslog_facility] [-d debug_file] ##Options Standard options: -v Displays the version and exit. -h Displays the usage and exit. -p lock_file Specifies the lock file to use. Default is "/var/run/nield.pid", if not specified. -s buffer_size Specifies the maximum socket receive buffer in bytes. Logging options: It uses the log file "/var/log/nield.log", if neither "-l" nor "-L" specified. -l log_file Specifies the log file to use. -L syslog_facility Specifies the facility to use logging events via syslog. The standard syslog facilities are as follows: auth, authpriv, cron, daemon, ftp, kern, lpr, mail, mark, news, security, syslog, user, uucp, local0, local1, local2, local3, local4, local5, local6, local7 -d debug_file Specifies the debug file to use. Event options: All events are received, if any event option not specified. -4 Logging events related to IPv4. -6 Logging events related to IPv6. -i Logging events related to interfaces. -n Logging events related to neigbour cache(ARP, NDP). -a Logging events related to IP address. -r Logging events related to routing. -f Logging events related to fib rules. -t Logging events related to traffic control. ##Files /usr/sbin/nield /var/run/nield.pid /var/log/nield.log /usr/share/man/man8/nield.8 ##Examples ###Interface When an interface was disabled by command: [2013-08-07 04:27:31.537101] interface eth0 state changed to disabled When an interface has gone down: [2013-08-07 04:27:31.537125] interface eth0 state changed to down When an interface was enabled by command: [2013-08-07 04:27:37.639079] interface eth0 state changed to enabled When an interface has come up: [2013-08-07 04:27:40.267577] interface eth0 state changed to up When link layer address of an interface changed: [2013-08-07 04:27:43.645661] interface eth0 link layer address changed from f6:af:fc:41:9e:7d to be:ee:bd:3d:22:68 When mtu of an interface changed: [2013-08-07 04:27:49.775200] interface eth0 mtu changed from 1500 to 1400 When a vlan interface was added: [2013-08-07 04:27:55.904868] interface added: name=eth0.100 link=eth0 lladdr=f6:af:fc:41:9e:7d mtu=1500 kind=vlan vid=100 state=disabled,linkdown When a vlan interface was deleted: [2013-08-07 04:28:13.924831] interface deleted: name=eth0.100 link=eth0 lladdr=f6:af:fc:41:9e:7d mtu=1500 kind=vlan vid=100 state=disabled,linkdown When a vxlan interface was added: [2013-08-07 06:30:08.938025] interface added: name=vxlan0 lladdr=9e:c5:83:a8:ea:00 mtu=1500 kind=vxlan vnid=100 local=192.168.1.100 group=224.0.0.100 state=disabled,linkdown When a vxlan interface was deleted: [2013-08-07 06:30:27.378033] interface deleted: name=vxlan0 lladdr=9e:c5:83:a8:ea:00 mtu=1500 kind=vxlan vnid=100 local=192.168.1.100 group=224.0.0.100 state=disabled,linkdown When a bridge interface was added: [2013-08-07 04:28:19.938136] interface added: name=br0 lladdr=f2:60:df:71:d0:ae mtu=1500 kind=bridge state=disabled,linkdown When a tap interface was added: [2013-08-07 04:28:31.951485] interface added: name=tap0 lladdr=52:4e:47:b3:e2:00 mtu=1500 kind=tun state=disabled,linkdown When a tap interface was attached to an ethernet bridge: [2013-08-07 04:28:37.958396] interface tap0 attached to bridge br0 When a tap interface was detached to an ethernet bridge: [2013-08-07 04:28:55.977159] interface tap0 detached from bridge br0 When a tap interface was deleted: [2013-08-07 04:29:01.983806] interface deleted: name=tap0 lladdr=52:4e:47:b3:e2:00 mtu=1500 kind=tun state=disabled,linkdown When a bridge interface was deleted: [2013-08-07 04:29:14.006774] interface deleted: name=br0 lladdr=00:00:00:00:00:00 mtu=1500 kind=bridge state=disabled,linkdown When a bonding interface was added: [2013-08-07 04:29:20.027673] interface added: name=bond0 lladdr=00:00:00:00:00:00 mtu=1500 kind=bond state=disabled,linkdown When an interface was attached to a bonding interface: [2013-08-07 04:29:32.085061] interface eth0 attached to bonding bond0 When an interface was detached to a bonding interface: [2013-08-07 04:30:09.101576] interface eth0 detached from bonding bond0 When a bonding interface was deleted: [2013-08-07 04:30:27.644523] interface deleted: name=bond0 lladdr=00:00:00:00:00:00 mtu=1500 kind=bond state=disabled,linkdown When a gre interface was added: [2013-08-07 04:30:33.678351] interface added: name=gre0 local=192.168.1.100 remote=192.168.2.100 mtu=1476 kind=gre state=disabled,linkdown When a gre interface was deleted: [2013-08-07 04:30:51.698009] interface deleted: name=gre0 local=192.168.1.100 remote=192.168.2.100 mtu=1476 kind=gre state=disabled,linkdown When a gretap interface was added: [2013-08-07 04:30:57.716615] interface added: name=gretap0 lladdr=a2:52:ec:ec:78:60 mtu=1462 kind=gretap local=192.168.1.100 remote=192.168.2.100 state=disabled,linkdown When a gretap interface was deleted: [2013-08-07 04:31:15.736468] interface deleted: name=gretap0 lladdr=a2:52:ec:ec:78:60 mtu=1462 kind=gretap local=192.168.1.100 remote=192.168.2.100 state=disabled,linkdown When an IPv4 tunnel interface(ipip,sit,isatap) was added: [2013-08-07 04:31:21.755082] interface added: name=iptnl0 local=192.168.1.100 remote=192.168.2.100 mtu=1480 state=disabled,linkdown When an IPv4 tunnel interface(ipip,sit,isatap) was deleted: [2013-08-07 04:31:39.774847] interface deleted: name=iptnl0 local=192.168.1.100 remote=192.168.2.100 mtu=1480 kind=ipip state=disabled,linkdown When an IPv6 tunnel interface(ip6ip6,ipip6) was added: [2013-08-07 04:32:58.112423] interface added: name=ip6tnl0 local=2001:db8:10::1 remote=2001:db8:20::1 mtu=1452 state=disabled,linkdown When an IPv6 tunnel interface(ip6ip6,ipip6) was deleted: [2013-08-07 04:33:16.132706] interface deleted: name=ip6tnl0 local=2001:db8:10::1 remote=2001:db8:20::1 mtu=1452 kind=ip6tnl state=disabled,linkdown ###IPv4 ARP When an ARP cache entry was created: [2013-08-07 04:33:28.157183] arp cache added: ip=192.168.1.2 mac=00:1b:8b:84:36:dc interface=eth0 When an ARP cache entry has expired: [2013-08-07 06:11:14.516780] arp cache deleted: ip=192.168.1.2 mac=00:1b:8b:84:36:dc interface=eth0 When an ARP cache entry was cleared by command: [2013-08-07 04:33:34.164063] arp cache invalidated: ip=192.168.1.2 mac=00:00:00:00:00:00 interface=eth0 When an ARP cache entry was unresolved: [2013-08-07 06:10:06.204374] arp cache unresolved: ip=192.168.1.2 mac=00:00:00:00:00:00 interface=eth0 When link layer address of an entry in the ARP cache table has changed: [2013-08-07 06:17:50.355827] arp cache changed: ip=192.168.1.2 mac=00:1b:8b:84:36:dc interface=eth0 ###IPv6 NDP When a NDP cache entry was created: [2013-08-07 04:34:28.221875] ndp cache added: ip=2001:db8::2 mac=00:1b:8b:84:36:dc interface=eth0 When a NDP cache entry has expired: [2013-08-07 06:20:00.084350] ndp cache deleted: ip=2001:db8::2 mac=00:1b:8b:84:36:dc interface=eth0 When a NDP cache entry was cleared by command: [2013-08-07 04:34:34.229066] ndp cache invalidated: ip=2001:db8::2 mac=00:00:00:00:00:00 interface=eth0 When a NDP cache entry was unresolved: [2013-08-07 04:34:34.229066] ndp cache unresolved: ip=2001:db8::2 mac=00:00:00:00:00:00 interface=eth0 When link layer address of an entry in the NDP cache table has changed: [2013-08-07 06:21:57.396102] ndp cache changed: ip=2001:db8::2 mac=00:1b:8b:84:36:dc interface=eth0 ###IPv4 Address When an IPv4 address was assigned: [2013-08-07 04:33:22.150078] ipv4 address added: interface=eth0 ip=192.168.1.1/24 socpe=global When an IPv4 address was removed: [2013-08-07 04:34:04.195166] ipv4 address deleted: interface=eth0 ip=192.168.1.1/24 socpe=global ###IPv6 Address When an IPv6 address was assigned: [2013-08-07 04:34:23.810337] ipv6 address added: interface=eth0 ip=2001:db8::1/64 socpe=global When an IPv6 address was removed: [2013-08-07 04:35:04.262540] ipv6 address deleted: interface=eth0 ip=2001:db8::1/64 socpe=global ###IPv4 Route When an IPv4 route was added: [2013-08-07 04:33:40.170235] ipv4 route added: destination=172.16.1.0/24 nexthop=192.168.1.2 interface=eth0 type=unicast protocol=boot table=main When an IPv4 route was removed: [2013-08-07 04:33:46.176411] ipv4 route deleted: destination=172.16.1.0/24 nexthop=192.168.1.2 interface=eth0 type=unicast proto=boot table=main ###IPv6 Route When an IPv6 route was added: [2013-08-07 04:34:40.235651] ipv6 route added: destination=2001:db8:1::/64 nexthop=2001:db8::2 interface=eth0 metric=1024 type=unicast protocol=boot table=main When an IPv6 route was removed: [2013-08-07 04:34:46.242398] ipv6 route deleted: destination=2001:db8:1::/64 nexthop=2001:db8::2 interface=eth0 metric=1024 type=unicast proto=boot table=main ###IPv4 FIB Rule When an IPv4 rule was added: [2013-08-07 04:35:22.281834] ipv4 rule added: from=192.168.1.0/24 table=unknown priority=32765 action=to_tbl When an IPv4 rule was deleted: [2013-08-07 04:35:28.288220] ipv4 rule deleted: from=192.168.1.0/24 table=unknown priority=32765 action=to_tbl ###IPv6 FIB Rule When an IPv6 rule was added: [2013-08-07 04:35:34.294521] ipv6 rule added: from=2001:db8:1::/64 table=unknown priority=16383 action=to_tbl When an IPv6 rule was deleted: [2013-08-07 04:35:40.300824] ipv6 rule deleted: from=2001:db8:1::/64 table=unknown priority=16383 action=to_tbl ###Traffic Control When a qdisc was added: [2013-08-07 04:37:46.502234] tc qdisc added: interface=eth0 parent=root classid=1: qdisc=htb rate2quantum=10 default-class=0x12 When a qdisc was deleted: [2013-08-07 04:37:52.516665] tc qdisc deleted: interface=eth0 parent=root classid=1: qdisc=htb rate2quantum=10 default-class=0x12 When a class was added: [2013-08-07 04:37:46.503530] tc class added: interface=eth0 parent=root classid=1:1 qdisc=htb rate=800.000(kbit/s) burst=1.562(Kbyte) ceil=1.600(Mbit/s) cburst=3.125(Kbyte) level=0 prio=0 When a class was deleted: [2013-08-07 04:37:52.515528] tc class deleted: interface=eth0 parent=root classid=1:1 qdisc=htb rate=800.000(kbit/s) burst=1.562(Kbyte) ceil=1.600(Mbit/s) cburst=3.125(Kbyte) level=0 prio=0 When a filter was added: [2013-08-07 04:40:28.814964] tc filter added: interface=eth0 handle=801::800 priority=10 protocol=ip filter=u32 classid=1:2 hash(table/bucket)=0x801/0x0 [2013-08-07 04:40:28.814990] tc filter added: interface=eth0 handle=801::800 priority=10 protocol=ip filter=u32 flags=terminal offshift=0 nkeys=2 offmask=0x0000 off=0 offoff=0 hoff=0 hmask=0x00000000 [2013-08-07 04:40:28.815007] tc filter added: interface=eth0 handle=801::800 priority=10 protocol=ip filter=u32 key=1 value=0xc0a86404 mask=0xffffffff offset=16 offmask=0x00000000 [2013-08-07 04:40:28.815020] tc filter added: interface=eth0 handle=801::800 priority=10 protocol=ip filter=u32 key=2 value=0xc0a86403 mask=0xffffffff offset=12 offmask=0x00000000 [2013-08-07 04:40:28.815099] tc filter added: interface=eth0 handle=801::800 priority=10 protocol=ip filter=u32 order=1 action=police index=1 rate=1.000(Mbit/s) burst=128.000(Kbyte) latency=0.000(us) exceed=drop When a filter was deleted: [2013-08-07 04:40:34.830414] tc filter deleted: interface=eth0 handle=:: priority=10 protocol=ip filter=u32 When an action was added: [2013-08-07 04:40:10.769257] tc action added: order=1 action=nat index=20 from=192.168.1.0/24 to=192.168.2.1 direction=ingress nield-0.6.2/aclocal.m4000066400000000000000000001370051470100110300144430ustar00rootroot00000000000000# generated automatically by aclocal 1.17 -*- Autoconf -*- # Copyright (C) 1996-2024 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],, [m4_warning([this file was generated for autoconf 2.72. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.17' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.17], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.17])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([_AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl AC_REQUIRE([_AM_PROG_RM_F]) AC_REQUIRE([_AM_PROG_XARGS_N]) dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2022-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_RM_F # --------------- # Check whether 'rm -f' without any arguments works. # https://bugs.gnu.org/10828 AC_DEFUN([_AM_PROG_RM_F], [am__rm_f_notfound= AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) AC_SUBST(am__rm_f_notfound) ]) # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SLEEP_FRACTIONAL_SECONDS # ---------------------------- AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl AC_CACHE_CHECK([whether sleep supports fractional seconds], am_cv_sleep_fractional_seconds, [dnl AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes], [am_cv_sleep_fractional_seconds=no]) ])]) # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION # ----------------------------------- # Determine the filesystem's resolution for file modification # timestamps. The coarsest we know of is FAT, with a resolution # of only two seconds, even with the most recent "exFAT" extensions. # The finest (e.g. ext4 with large inodes, XFS, ZFS) is one # nanosecond, matching clock_gettime. However, it is probably not # possible to delay execution of a shell script for less than one # millisecond, due to process creation overhead and scheduling # granularity, so we don't check for anything finer than that. (See below.) AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) AC_CACHE_CHECK([filesystem timestamp resolution], am_cv_filesystem_timestamp_resolution, [dnl # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 # Only try to go finer than 1 sec if sleep can do it. # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, # - 1 sec is not much of a win compared to 2 sec, and # - it takes 2 seconds to perform the test whether 1 sec works. # # Instead, just use the default 2s on platforms that have 1s resolution, # accept the extra 1s delay when using $sleep in the Automake tests, in # exchange for not incurring the 2s delay for running the test for all # packages. # am_try_resolutions= if test "$am_cv_sleep_fractional_seconds" = yes; then # Even a millisecond often causes a bunch of false positives, # so just try a hundredth of a second. The time saved between .001 and # .01 is not terribly consequential. am_try_resolutions="0.01 0.1 $am_try_resolutions" fi # In order to catch current-generation FAT out, we must *modify* files # that already exist; the *creation* timestamp is finer. Use names # that make ls -t sort them differently when they have equal # timestamps than when they have distinct timestamps, keeping # in mind that ls -t prints the *newest* file first. rm -f conftest.ts? : > conftest.ts1 : > conftest.ts2 : > conftest.ts3 # Make sure ls -t actually works. Do 'set' in a subshell so we don't # clobber the current shell's arguments. (Outer-level square brackets # are removed by m4; they're present so that m4 does not expand # ; be careful, easy to get confused.) if ( set X `[ls -t conftest.ts[12]]` && { test "$[]*" != "X conftest.ts1 conftest.ts2" || test "$[]*" != "X conftest.ts2 conftest.ts1"; } ); then :; else # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". _AS_ECHO_UNQUOTED( ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], [AS_MESSAGE_LOG_FD]) AC_MSG_FAILURE([ls -t produces unexpected output. Make sure there is not a broken ls alias in your environment.]) fi for am_try_res in $am_try_resolutions; do # Any one fine-grained sleep might happen to cross the boundary # between two values of a coarser actual resolution, but if we do # two fine-grained sleeps in a row, at least one of them will fall # entirely within a coarse interval. echo alpha > conftest.ts1 sleep $am_try_res echo beta > conftest.ts2 sleep $am_try_res echo gamma > conftest.ts3 # We assume that 'ls -t' will make use of high-resolution # timestamps if the operating system supports them at all. if (set X `ls -t conftest.ts?` && test "$[]2" = conftest.ts3 && test "$[]3" = conftest.ts2 && test "$[]4" = conftest.ts1); then # # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, # because we don't need to test make. make_ok=true if test $am_try_res != 1; then # But if we've succeeded so far with a subsecond resolution, we # have one more thing to check: make. It can happen that # everything else supports the subsecond mtimes, but make doesn't; # notably on macOS, which ships make 3.81 from 2006 (the last one # released under GPLv2). https://bugs.gnu.org/68808 # # We test $MAKE if it is defined in the environment, else "make". # It might get overridden later, but our hope is that in practice # it does not matter: it is the system "make" which is (by far) # the most likely to be broken, whereas if the user overrides it, # probably they did so with a better, or at least not worse, make. # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html # # Create a Makefile (real tab character here): rm -f conftest.mk echo 'conftest.ts1: conftest.ts2' >conftest.mk echo ' touch conftest.ts2' >>conftest.mk # # Now, running # touch conftest.ts1; touch conftest.ts2; make # should touch ts1 because ts2 is newer. This could happen by luck, # but most often, it will fail if make's support is insufficient. So # test for several consecutive successes. # # (We reuse conftest.ts[12] because we still want to modify existing # files, not create new ones, per above.) n=0 make=${MAKE-make} until test $n -eq 3; do echo one > conftest.ts1 sleep $am_try_res echo two > conftest.ts2 # ts2 should now be newer than ts1 if $make -f conftest.mk | grep 'up to date' >/dev/null; then make_ok=false break # out of $n loop fi n=`expr $n + 1` done fi # if $make_ok; then # Everything we know to check worked out, so call this resolution good. am_cv_filesystem_timestamp_resolution=$am_try_res break # out of $am_try_res loop fi # Otherwise, we'll go on to check the next resolution. fi done rm -f conftest.ts? # (end _am_filesystem_timestamp_resolution) ])]) # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) # This check should not be cached, as it may vary across builds of # different projects. AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). am_build_env_is_sane=no am_has_slept=no rm -f conftest.file for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[]*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi test "$[]2" = conftest.file ); then am_build_env_is_sane=yes break fi # Just in case. sleep "$am_cv_filesystem_timestamp_resolution" am_has_slept=yes done AC_MSG_RESULT([$am_build_env_is_sane]) if test "$am_build_env_is_sane" = no; then AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! ]) AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SILENT_RULES # ---------------- # Enable less verbose build rules support. AC_DEFUN([_AM_SILENT_RULES], [AM_DEFAULT_VERBOSITY=1 AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls dnl to AM_SILENT_RULES to change the default value. AC_CONFIG_COMMANDS_PRE([dnl case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; esac if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi ])dnl ]) # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or # empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_REQUIRE([_AM_SILENT_RULES]) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])]) # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test x$am_uid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) elif test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test x$gm_gid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) elif test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR # Copyright (C) 2022-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_XARGS_N # ---------------- # Check whether 'xargs -n' works. It should work everywhere, so the fallback # is not optimized at all as we never expect to use it. AC_DEFUN([_AM_PROG_XARGS_N], [AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])]) AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }' ])dnl AC_SUBST(am__xargs_n) ]) nield-0.6.2/config.guess000066400000000000000000001301001470100110300151050ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-24' # This file 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 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' HUP INT TERM # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-tilera-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: nield-0.6.2/config.h.in000066400000000000000000000400171470100110300146220ustar00rootroot00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the header file. */ #undef HAVE_ASM_TYPES_H /* Define to 1 if you have the declaration of 'FLOW_KEY_RXHASH', and to 0 if you don't. */ #undef HAVE_DECL_FLOW_KEY_RXHASH /* Define to 1 if you have the declaration of 'FRA_GOTO', and to 0 if you don't. */ #undef HAVE_DECL_FRA_GOTO /* Define to 1 if you have the declaration of 'FRA_OIFNAME', and to 0 if you don't. */ #undef HAVE_DECL_FRA_OIFNAME /* Define to 1 if you have the declaration of 'FR_ACT_GOTO', and to 0 if you don't. */ #undef HAVE_DECL_FR_ACT_GOTO /* Define to 1 if you have the declaration of 'FR_ACT_NOP', and to 0 if you don't. */ #undef HAVE_DECL_FR_ACT_NOP /* Define to 1 if you have the declaration of 'FR_ACT_RES1', and to 0 if you don't. */ #undef HAVE_DECL_FR_ACT_RES1 /* Define to 1 if you have the declaration of 'FR_ACT_RES2', and to 0 if you don't. */ #undef HAVE_DECL_FR_ACT_RES2 /* Define to 1 if you have the declaration of 'IFLA_AF_SPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_AF_SPEC /* Define to 1 if you have the declaration of 'IFLA_BOND_MIIMON', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_BOND_MIIMON /* Define to 1 if you have the declaration of 'IFLA_BOND_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_BOND_UNSPEC /* Define to 1 if you have the declaration of 'IFLA_BRPORT_LEARNING', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_BRPORT_LEARNING /* Define to 1 if you have the declaration of 'IFLA_BRPORT_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_BRPORT_UNSPEC /* Define to 1 if you have the declaration of 'IFLA_CARRIER', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_CARRIER /* Define to 1 if you have the declaration of 'IFLA_EXT_MASK', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_EXT_MASK /* Define to 1 if you have the declaration of 'IFLA_GRE_ENCAP_LIMIT', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_GRE_ENCAP_LIMIT /* Define to 1 if you have the declaration of 'IFLA_GRE_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_GRE_UNSPEC /* Define to 1 if you have the declaration of 'IFLA_GROUP', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_GROUP /* Define to 1 if you have the declaration of 'IFLA_IFALIAS', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_IFALIAS /* Define to 1 if you have the declaration of 'IFLA_INFO_SLAVE_KIND', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_INFO_SLAVE_KIND /* Define to 1 if you have the declaration of 'IFLA_LINKINFO', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_LINKINFO /* Define to 1 if you have the declaration of 'IFLA_MACVLAN_FLAGS', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_MACVLAN_FLAGS /* Define to 1 if you have the declaration of 'IFLA_MACVLAN_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_MACVLAN_UNSPEC /* Define to 1 if you have the declaration of 'IFLA_NET_NS_FD', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_NET_NS_FD /* Define to 1 if you have the declaration of 'IFLA_NET_NS_PID', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_NET_NS_PID /* Define to 1 if you have the declaration of 'IFLA_NUM_RX_QUEUES', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_NUM_RX_QUEUES /* Define to 1 if you have the declaration of 'IFLA_NUM_TX_QUEUES', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_NUM_TX_QUEUES /* Define to 1 if you have the declaration of 'IFLA_NUM_VF', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_NUM_VF /* Define to 1 if you have the declaration of 'IFLA_PHYS_PORT_ID', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_PHYS_PORT_ID /* Define to 1 if you have the declaration of 'IFLA_PORT_SELF', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_PORT_SELF /* Define to 1 if you have the declaration of 'IFLA_PROMISCUITY', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_PROMISCUITY /* Define to 1 if you have the declaration of 'IFLA_STATS64', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_STATS64 /* Define to 1 if you have the declaration of 'IFLA_VFINFO_LIST', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VFINFO_LIST /* Define to 1 if you have the declaration of 'IFLA_VF_PORTS', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VF_PORTS /* Define to 1 if you have the declaration of 'IFLA_VLAN_PROTOCOL', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VLAN_PROTOCOL /* Define to 1 if you have the declaration of 'IFLA_VLAN_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VLAN_UNSPEC /* Define to 1 if you have the declaration of 'IFLA_VXLAN_GROUP', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VXLAN_GROUP /* Define to 1 if you have the declaration of 'IFLA_VXLAN_GROUP6', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VXLAN_GROUP6 /* Define to 1 if you have the declaration of 'IFLA_VXLAN_PORT', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VXLAN_PORT /* Define to 1 if you have the declaration of 'IFLA_VXLAN_PROXY', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VXLAN_PROXY /* Define to 1 if you have the declaration of 'IFLA_VXLAN_REMOTE', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VXLAN_REMOTE /* Define to 1 if you have the declaration of 'IFLA_VXLAN_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_IFLA_VXLAN_UNSPEC /* Define to 1 if you have the declaration of 'MACVLAN_MODE_PASSTHRU', and to 0 if you don't. */ #undef HAVE_DECL_MACVLAN_MODE_PASSTHRU /* Define to 1 if you have the declaration of 'RTA_MARK', and to 0 if you don't. */ #undef HAVE_DECL_RTA_MARK /* Define to 1 if you have the declaration of 'RTPROT_DHCP', and to 0 if you don't. */ #undef HAVE_DECL_RTPROT_DHCP /* Define to 1 if you have the declaration of 'RT_TABLE_COMPAT', and to 0 if you don't. */ #undef HAVE_DECL_RT_TABLE_COMPAT /* Define to 1 if you have the declaration of 'TCA_CBQ_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_CBQ_UNSPEC /* Define to 1 if you have the declaration of 'TCA_CGROUP_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_CGROUP_UNSPEC /* Define to 1 if you have the declaration of 'TCA_CHOKE_MAX_P', and to 0 if you don't. */ #undef HAVE_DECL_TCA_CHOKE_MAX_P /* Define to 1 if you have the declaration of 'TCA_CHOKE_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_CHOKE_UNSPEC /* Define to 1 if you have the declaration of 'TCA_CODEL_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_CODEL_UNSPEC /* Define to 1 if you have the declaration of 'TCA_DRR_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_DRR_UNSPEC /* Define to 1 if you have the declaration of 'TCA_DSMARK_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_DSMARK_UNSPEC /* Define to 1 if you have the declaration of 'TCA_FLOW_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_FLOW_UNSPEC /* Define to 1 if you have the declaration of 'TCA_FQ_CODEL_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_FQ_CODEL_UNSPEC /* Define to 1 if you have the declaration of 'TCA_FW_MASK', and to 0 if you don't. */ #undef HAVE_DECL_TCA_FW_MASK /* Define to 1 if you have the declaration of 'TCA_GRED_MAX_P', and to 0 if you don't. */ #undef HAVE_DECL_TCA_GRED_MAX_P /* Define to 1 if you have the declaration of 'TCA_NETEM_ECN', and to 0 if you don't. */ #undef HAVE_DECL_TCA_NETEM_ECN /* Define to 1 if you have the declaration of 'TCA_NETEM_LOSS', and to 0 if you don't. */ #undef HAVE_DECL_TCA_NETEM_LOSS /* Define to 1 if you have the declaration of 'TCA_NETEM_RATE', and to 0 if you don't. */ #undef HAVE_DECL_TCA_NETEM_RATE /* Define to 1 if you have the declaration of 'TCA_QFQ_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_QFQ_UNSPEC /* Define to 1 if you have the declaration of 'TCA_RED_MAX_P', and to 0 if you don't. */ #undef HAVE_DECL_TCA_RED_MAX_P /* Define to 1 if you have the declaration of 'TCA_RSVP_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_RSVP_UNSPEC /* Define to 1 if you have the declaration of 'TCA_SFB_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_SFB_UNSPEC /* Define to 1 if you have the declaration of 'TCA_SKBEDIT_MARK', and to 0 if you don't. */ #undef HAVE_DECL_TCA_SKBEDIT_MARK /* Define to 1 if you have the declaration of 'TCA_STAB_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_STAB_UNSPEC /* Define to 1 if you have the declaration of 'TCA_TCINDEX_UNSPEC', and to 0 if you don't. */ #undef HAVE_DECL_TCA_TCINDEX_UNSPEC /* Define to 1 if you have the declaration of 'TCF_EM_CANID', and to 0 if you don't. */ #undef HAVE_DECL_TCF_EM_CANID /* Define to 1 if you have the declaration of 'TCF_EM_IPSET', and to 0 if you don't. */ #undef HAVE_DECL_TCF_EM_IPSET /* Define to 1 if you have the declaration of 'TCF_EM_VLAN', and to 0 if you don't. */ #undef HAVE_DECL_TCF_EM_VLAN /* Define to 1 if you have the declaration of 'TCF_META_ID_RXHASH', and to 0 if you don't. */ #undef HAVE_DECL_TCF_META_ID_RXHASH /* Define to 1 if you have the declaration of 'VLAN_FLAG_GVRP', and to 0 if you don't. */ #undef HAVE_DECL_VLAN_FLAG_GVRP /* Define to 1 if you have the declaration of 'VLAN_FLAG_LOOSE_BINDING', and to 0 if you don't. */ #undef HAVE_DECL_VLAN_FLAG_LOOSE_BINDING /* Define to 1 if you have the declaration of 'VLAN_FLAG_REORDER_HDR', and to 0 if you don't. */ #undef HAVE_DECL_VLAN_FLAG_REORDER_HDR /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the 'gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the 'm' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FIB_RULES_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_GEN_STATS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_ARP_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_BONDING /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_BRIDGE_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_ETHER_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_TUNNEL_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IF_VLAN_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IP_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_PKT_CLS_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_RTNETLINK_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_CSUM_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_GACT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_IPT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_MIRRED_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_NAT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_PEDIT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_EMATCH_TC_EM_META_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TC_EMATCH_TC_EM_TEXT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TYPES_H /* Define to 1 if your system has a GNU libc compatible 'malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the 'memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_ETHERNET_H /* Define to 1 if you have the 'pow' function. */ #undef HAVE_POW /* Define to 1 if you have the 'socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the 'strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the 'strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if 'bands' is a member of 'struct tc_multiq_qopt'. */ #undef HAVE_STRUCT_TC_MULTIQ_QOPT_BANDS /* Define to 1 if 'action' is a member of 'struct tc_plug_qopt'. */ #undef HAVE_STRUCT_TC_PLUG_QOPT_ACTION /* Define to 1 if 'addend' is a member of 'struct tc_ratespec'. */ #undef HAVE_STRUCT_TC_RATESPEC_ADDEND /* Define to 1 if 'cell_align' is a member of 'struct tc_ratespec'. */ #undef HAVE_STRUCT_TC_RATESPEC_CELL_ALIGN /* Define to 1 if 'feature' is a member of 'struct tc_ratespec'. */ #undef HAVE_STRUCT_TC_RATESPEC_FEATURE /* Define to 1 if 'linklayer' is a member of 'struct tc_ratespec'. */ #undef HAVE_STRUCT_TC_RATESPEC_LINKLAYER /* Define to 1 if 'overhead' is a member of 'struct tc_ratespec'. */ #undef HAVE_STRUCT_TC_RATESPEC_OVERHEAD /* Define to 1 if '__reserved' is a member of 'struct tc_ratespec'. */ #undef HAVE_STRUCT_TC_RATESPEC___RESERVED /* Define to 1 if 'v0' is a member of 'struct tc_sfq_qopt_v1'. */ #undef HAVE_STRUCT_TC_SFQ_QOPT_V1_V0 /* Define to 1 if 'allot' is a member of 'struct tc_sfq_xstats'. */ #undef HAVE_STRUCT_TC_SFQ_XSTATS_ALLOT /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if all of the C89 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to '__inline__' or '__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define as 'unsigned int' if doesn't define. */ #undef size_t nield-0.6.2/config.sub000066400000000000000000001043761470100110300145700ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-09-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: nield-0.6.2/configure000077500000000000000000007227101470100110300145150ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.72 for nield 0.6.2. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case e in #( e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else case e in #( e) exitcode=1; echo positional parameters were not saved. ;; esac fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else case e in #( e) as_have_required=no ;; esac fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else case e in #( e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi ;; esac fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and t2mune@gmail.com $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi ;; esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' t clear :clear s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='nield' PACKAGE_TARNAME='nield' PACKAGE_VERSION='0.6.2' PACKAGE_STRING='nield 0.6.2' PACKAGE_BUGREPORT='t2mune@gmail.com' PACKAGE_URL='' ac_unique_file="config.h.in" ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__xargs_n am__rm_f_notfound AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: '$ac_option' Try '$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: '$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF 'configure' configures nield 0.6.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, 'make install' will install all the files in '$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify an installation prefix other than '$ac_default_prefix' using '--prefix', for instance '--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/nield] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of nield 0.6.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF nield configure 0.6.2 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else case e in #( e) eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) eval "$3=yes" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR # ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else case e in #( e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS ;; esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_check_decl # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 printf %s "checking for $2.$3... " >&6; } if eval test \${$4+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" else case e in #( e) eval "$4=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi eval ac_res=\$$4 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status ;; esac fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (void); below. */ #include #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (void); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by nield $as_me 0.6.2, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See 'config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (char **p, int i) { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* C89 style stringification. */ #define noexpand_stringify(a) #a const char *stringified = noexpand_stringify(arbitrary+token=sequence); /* C89 style token pasting. Exercises some of the corner cases that e.g. old MSVC gets wrong, but not very hard. */ #define noexpand_concat(a,b) a##b #define expand_concat(a,b) noexpand_concat(a,b) extern int vA; extern int vbee; #define aye A #define bee B int *pvA = &expand_concat(v,aye); int *pvbee = &noexpand_concat(v,bee); /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' /* Does the compiler advertise C99 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif // See if C++-style comments work. #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); extern void free (void *); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Work around memory leak warnings. free (ia); // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' /* Does the compiler advertise C11 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" # Auxiliary files required by this configure script. ac_aux_files="compile missing install-sh config.guess config.sub" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else case e in #( e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; esac fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 printf %s "checking target system type... " >&6; } if test ${ac_cv_target+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 printf "%s\n" "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.17' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir ;; esac fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sleep supports fractional seconds" >&5 printf %s "checking whether sleep supports fractional seconds... " >&6; } if test ${am_cv_sleep_fractional_seconds+y} then : printf %s "(cached) " >&6 else case e in #( e) if sleep 0.001 2>/dev/null then : am_cv_sleep_fractional_seconds=yes else case e in #( e) am_cv_sleep_fractional_seconds=no ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_sleep_fractional_seconds" >&5 printf "%s\n" "$am_cv_sleep_fractional_seconds" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking filesystem timestamp resolution" >&5 printf %s "checking filesystem timestamp resolution... " >&6; } if test ${am_cv_filesystem_timestamp_resolution+y} then : printf %s "(cached) " >&6 else case e in #( e) # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 # Only try to go finer than 1 sec if sleep can do it. # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, # - 1 sec is not much of a win compared to 2 sec, and # - it takes 2 seconds to perform the test whether 1 sec works. # # Instead, just use the default 2s on platforms that have 1s resolution, # accept the extra 1s delay when using $sleep in the Automake tests, in # exchange for not incurring the 2s delay for running the test for all # packages. # am_try_resolutions= if test "$am_cv_sleep_fractional_seconds" = yes; then # Even a millisecond often causes a bunch of false positives, # so just try a hundredth of a second. The time saved between .001 and # .01 is not terribly consequential. am_try_resolutions="0.01 0.1 $am_try_resolutions" fi # In order to catch current-generation FAT out, we must *modify* files # that already exist; the *creation* timestamp is finer. Use names # that make ls -t sort them differently when they have equal # timestamps than when they have distinct timestamps, keeping # in mind that ls -t prints the *newest* file first. rm -f conftest.ts? : > conftest.ts1 : > conftest.ts2 : > conftest.ts3 # Make sure ls -t actually works. Do 'set' in a subshell so we don't # clobber the current shell's arguments. (Outer-level square brackets # are removed by m4; they're present so that m4 does not expand # ; be careful, easy to get confused.) if ( set X `ls -t conftest.ts[12]` && { test "$*" != "X conftest.ts1 conftest.ts2" || test "$*" != "X conftest.ts2 conftest.ts1"; } ); then :; else # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". printf "%s\n" ""Bad output from ls -t: \"`ls -t conftest.ts[12]`\""" >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "ls -t produces unexpected output. Make sure there is not a broken ls alias in your environment. See 'config.log' for more details" "$LINENO" 5; } fi for am_try_res in $am_try_resolutions; do # Any one fine-grained sleep might happen to cross the boundary # between two values of a coarser actual resolution, but if we do # two fine-grained sleeps in a row, at least one of them will fall # entirely within a coarse interval. echo alpha > conftest.ts1 sleep $am_try_res echo beta > conftest.ts2 sleep $am_try_res echo gamma > conftest.ts3 # We assume that 'ls -t' will make use of high-resolution # timestamps if the operating system supports them at all. if (set X `ls -t conftest.ts?` && test "$2" = conftest.ts3 && test "$3" = conftest.ts2 && test "$4" = conftest.ts1); then # # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, # because we don't need to test make. make_ok=true if test $am_try_res != 1; then # But if we've succeeded so far with a subsecond resolution, we # have one more thing to check: make. It can happen that # everything else supports the subsecond mtimes, but make doesn't; # notably on macOS, which ships make 3.81 from 2006 (the last one # released under GPLv2). https://bugs.gnu.org/68808 # # We test $MAKE if it is defined in the environment, else "make". # It might get overridden later, but our hope is that in practice # it does not matter: it is the system "make" which is (by far) # the most likely to be broken, whereas if the user overrides it, # probably they did so with a better, or at least not worse, make. # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html # # Create a Makefile (real tab character here): rm -f conftest.mk echo 'conftest.ts1: conftest.ts2' >conftest.mk echo ' touch conftest.ts2' >>conftest.mk # # Now, running # touch conftest.ts1; touch conftest.ts2; make # should touch ts1 because ts2 is newer. This could happen by luck, # but most often, it will fail if make's support is insufficient. So # test for several consecutive successes. # # (We reuse conftest.ts[12] because we still want to modify existing # files, not create new ones, per above.) n=0 make=${MAKE-make} until test $n -eq 3; do echo one > conftest.ts1 sleep $am_try_res echo two > conftest.ts2 # ts2 should now be newer than ts1 if $make -f conftest.mk | grep 'up to date' >/dev/null; then make_ok=false break # out of $n loop fi n=`expr $n + 1` done fi # if $make_ok; then # Everything we know to check worked out, so call this resolution good. am_cv_filesystem_timestamp_resolution=$am_try_res break # out of $am_try_res loop fi # Otherwise, we'll go on to check the next resolution. fi done rm -f conftest.ts? # (end _am_filesystem_timestamp_resolution) ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_filesystem_timestamp_resolution" >&5 printf "%s\n" "$am_cv_filesystem_timestamp_resolution" >&6; } # This check should not be cached, as it may vary across builds of # different projects. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). am_build_env_is_sane=no am_has_slept=no rm -f conftest.file for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi test "$2" = conftest.file ); then am_build_env_is_sane=yes break fi # Just in case. sleep "$am_cv_filesystem_timestamp_resolution" am_has_slept=yes done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_build_env_is_sane" >&5 printf "%s\n" "$am_build_env_is_sane" >&6; } if test "$am_build_env_is_sane" = no; then as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1 then : else case e in #( e) ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! ;; esac fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was 's,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ *'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS ;; esac fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use plain mkdir -p, # in the hope it doesn't have the bugs of ancient mkdir. MKDIR_P='mkdir -p' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else case e in #( e) cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make ;; esac fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AM_DEFAULT_VERBOSITY=1 # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else case e in #( e) if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } AM_BACKSLASH='\' am__rm_f_notfound= if (rm -f && rm -fr && rm -rf) 2>/dev/null then : else case e in #( e) am__rm_f_notfound='""' ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking xargs -n works" >&5 printf %s "checking xargs -n works... " >&6; } if test ${am_cv_xargs_n_works+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 3" then : am_cv_xargs_n_works=yes else case e in #( e) am_cv_xargs_n_works=no ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_xargs_n_works" >&5 printf "%s\n" "$am_cv_xargs_n_works" >&6; } if test "$am_cv_xargs_n_works" = yes then : am__xargs_n='xargs -n' else case e in #( e) am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "" "$am__xargs_n_arg"; done; }' ;; esac fi if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='nield' VERSION='0.6.2' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi case "$target" in *linux*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: linux" >&5 printf "%s\n" "linux" >&6; } arch=linux ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 printf "%s\n" "unknown" >&6; } as_fn_error $? "$target is not supported." "$LINENO" 5 ;; esac ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See 'config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. # So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an '-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else case e in #( e) ac_file='' ;; esac fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See 'config.log' for more details" "$LINENO" 5; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) # catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will # work properly (i.e., refer to 'conftest.exe'), while it won't with # 'rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else case e in #( e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See 'config.log' for more details" "$LINENO" 5; } ;; esac fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); if (!f) return 1; return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use '--host'. See 'config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext \ conftest.o conftest.obj conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See 'config.log' for more details" "$LINENO" 5; } ;; esac fi rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else case e in #( e) CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 ;; esac fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 ;; esac fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 ;; esac fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Checks for libraries. # Checks for header files. ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" if test "x$ac_cv_header_stddef_h" = xyes then : printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes then : printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes then : printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" if test "x$ac_cv_header_arpa_inet_h" = xyes then : printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" if test "x$ac_cv_header_netinet_in_h" = xyes then : printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes then : printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" if test "x$ac_cv_header_sys_socket_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" if test "x$ac_cv_header_netdb_h" = xyes then : printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "asm/types.h" "ac_cv_header_asm_types_h" "$ac_includes_default" if test "x$ac_cv_header_asm_types_h" = xyes then : printf "%s\n" "#define HAVE_ASM_TYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "net/ethernet.h" "ac_cv_header_net_ethernet_h" "$ac_includes_default" if test "x$ac_cv_header_net_ethernet_h" = xyes then : printf "%s\n" "#define HAVE_NET_ETHERNET_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/types.h" "ac_cv_header_linux_types_h" "$ac_includes_default" if test "x$ac_cv_header_linux_types_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TYPES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/rtnetlink.h" "ac_cv_header_linux_rtnetlink_h" "#ifdef HAVE_SYS_SOCKET_H # include #endif " if test "x$ac_cv_header_linux_rtnetlink_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_RTNETLINK_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if_arp.h" "ac_cv_header_linux_if_arp_h" "#ifdef HAVE_SYS_SOCKET_H # include #endif " if test "x$ac_cv_header_linux_if_arp_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_ARP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/fib_rules.h" "ac_cv_header_linux_fib_rules_h" "#ifdef HAVE_SYS_SOCKET_H # include #endif " if test "x$ac_cv_header_linux_fib_rules_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_FIB_RULES_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#ifdef HAVE_SYS_SOCKET_H # include #endif " if test "x$ac_cv_header_linux_if_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/ip.h" "ac_cv_header_linux_ip_h" "$ac_includes_default" if test "x$ac_cv_header_linux_ip_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if_vlan.h" "ac_cv_header_linux_if_vlan_h" "$ac_includes_default" if test "x$ac_cv_header_linux_if_vlan_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_VLAN_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if_tunnel.h" "ac_cv_header_linux_if_tunnel_h" "#ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_IF_H # include #endif #ifdef HAVE_LINUX_IP_H # include #endif " if test "x$ac_cv_header_linux_if_tunnel_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_TUNNEL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if_ether.h" "ac_cv_header_linux_if_ether_h" "$ac_includes_default" if test "x$ac_cv_header_linux_if_ether_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_ETHER_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if_bridge.h" "ac_cv_header_linux_if_bridge_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_if_bridge_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_BRIDGE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/if_bonding" "ac_cv_header_linux_if_bonding" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_if_bonding" = xyes then : printf "%s\n" "#define HAVE_LINUX_IF_BONDING 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/gen_stats.h" "ac_cv_header_linux_gen_stats_h" "$ac_includes_default" if test "x$ac_cv_header_linux_gen_stats_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_GEN_STATS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/pkt_cls.h" "ac_cv_header_linux_pkt_cls_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_pkt_cls_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_PKT_CLS_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_csum.h" "ac_cv_header_linux_tc_act_tc_csum_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_csum_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_CSUM_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_gact.h" "ac_cv_header_linux_tc_act_tc_gact_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_gact_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_GACT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_ipt.h" "ac_cv_header_linux_tc_act_tc_ipt_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_ipt_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_IPT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_mirred.h" "ac_cv_header_linux_tc_act_tc_mirred_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_mirred_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_MIRRED_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_nat.h" "ac_cv_header_linux_tc_act_tc_nat_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_nat_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_NAT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_pedit.h" "ac_cv_header_linux_tc_act_tc_pedit_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_pedit_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_PEDIT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_act/tc_skbedit.h" "ac_cv_header_linux_tc_act_tc_skbedit_h" "#ifdef HAVE_LINUX_TYPES_H # include #endif " if test "x$ac_cv_header_linux_tc_act_tc_skbedit_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_ACT_TC_SKBEDIT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_ematch/tc_em_cmp.h" "ac_cv_header_linux_tc_ematch_tc_em_cmp_h" "$ac_includes_default" if test "x$ac_cv_header_linux_tc_ematch_tc_em_cmp_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_ematch/tc_em_meta.h" "ac_cv_header_linux_tc_ematch_tc_em_meta_h" "$ac_includes_default" if test "x$ac_cv_header_linux_tc_ematch_tc_em_meta_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_EMATCH_TC_EM_META_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_ematch/tc_em_nbyte.h" "ac_cv_header_linux_tc_ematch_tc_em_nbyte_h" "$ac_includes_default" if test "x$ac_cv_header_linux_tc_ematch_tc_em_nbyte_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "linux/tc_ematch/tc_em_text.h" "ac_cv_header_linux_tc_ematch_tc_em_text_h" "$ac_includes_default" if test "x$ac_cv_header_linux_tc_ematch_tc_em_text_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_TC_EMATCH_TC_EM_TEXT_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "sys/syslog.h" "ac_cv_header_sys_syslog_h" "$ac_includes_default" if test "x$ac_cv_header_sys_syslog_h" = xyes then : printf "%s\n" "#define HAVE_SYS_SYSLOG_H 1" >>confdefs.h fi # Checks for typedefs, structures, and compiler characteristics. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo (void) {return 0; } $ac_kw foo_t foo (void) {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_pid_type='int' else case e in #( e) ac_pid_type='__int64' ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h ;; esac fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else case e in #( e) printf "%s\n" "#define size_t unsigned int" >>confdefs.h ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" # This test program should *not* compile successfully. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { (void) strchr; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the # off chance that they somehow elicit warnings. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include extern void ac_decl (int, char *); int main (void) { (void) ac_decl (0, (char *) 0); (void) ac_decl; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' else case e in #( e) ac_cv_c_undeclared_builtin_options=$ac_arg ;; esac fi break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins See 'config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; esac ac_fn_check_decl "$LINENO" "IFLA_LINKINFO" "ac_cv_have_decl_IFLA_LINKINFO" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_LINKINFO" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_LINKINFO $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_NET_NS_PID" "ac_cv_have_decl_IFLA_NET_NS_PID" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_NET_NS_PID" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_NET_NS_PID $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_IFALIAS" "ac_cv_have_decl_IFLA_IFALIAS" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_IFALIAS" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_IFALIAS $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_NUM_VF" "ac_cv_have_decl_IFLA_NUM_VF" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_NUM_VF" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_NUM_VF $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VFINFO_LIST" "ac_cv_have_decl_IFLA_VFINFO_LIST" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VFINFO_LIST" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VFINFO_LIST $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_STATS64" "ac_cv_have_decl_IFLA_STATS64" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_STATS64" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_STATS64 $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VF_PORTS" "ac_cv_have_decl_IFLA_VF_PORTS" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VF_PORTS" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VF_PORTS $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_PORT_SELF" "ac_cv_have_decl_IFLA_PORT_SELF" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_PORT_SELF" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_PORT_SELF $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_AF_SPEC" "ac_cv_have_decl_IFLA_AF_SPEC" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_AF_SPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_AF_SPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_GROUP" "ac_cv_have_decl_IFLA_GROUP" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_GROUP" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_GROUP $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_NET_NS_FD" "ac_cv_have_decl_IFLA_NET_NS_FD" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_NET_NS_FD" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_NET_NS_FD $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_EXT_MASK" "ac_cv_have_decl_IFLA_EXT_MASK" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_EXT_MASK" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_EXT_MASK $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_PROMISCUITY" "ac_cv_have_decl_IFLA_PROMISCUITY" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_PROMISCUITY" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_PROMISCUITY $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_NUM_TX_QUEUES" "ac_cv_have_decl_IFLA_NUM_TX_QUEUES" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_NUM_TX_QUEUES" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_NUM_TX_QUEUES $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_NUM_RX_QUEUES" "ac_cv_have_decl_IFLA_NUM_RX_QUEUES" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_NUM_RX_QUEUES" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_NUM_RX_QUEUES $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_CARRIER" "ac_cv_have_decl_IFLA_CARRIER" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_CARRIER" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_CARRIER $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_PHYS_PORT_ID" "ac_cv_have_decl_IFLA_PHYS_PORT_ID" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_PHYS_PORT_ID" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_PHYS_PORT_ID $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_BRPORT_UNSPEC" "ac_cv_have_decl_IFLA_BRPORT_UNSPEC" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_BRPORT_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_BRPORT_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_BRPORT_LEARNING" "ac_cv_have_decl_IFLA_BRPORT_LEARNING" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_BRPORT_LEARNING" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_BRPORT_LEARNING $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_INFO_SLAVE_KIND" "ac_cv_have_decl_IFLA_INFO_SLAVE_KIND" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_INFO_SLAVE_KIND" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_INFO_SLAVE_KIND $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VLAN_UNSPEC" "ac_cv_have_decl_IFLA_VLAN_UNSPEC" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VLAN_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VLAN_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VLAN_PROTOCOL" "ac_cv_have_decl_IFLA_VLAN_PROTOCOL" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VLAN_PROTOCOL" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VLAN_PROTOCOL $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_MACVLAN_UNSPEC" "ac_cv_have_decl_IFLA_MACVLAN_UNSPEC" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_MACVLAN_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_MACVLAN_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_MACVLAN_FLAGS" "ac_cv_have_decl_IFLA_MACVLAN_FLAGS" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_MACVLAN_FLAGS" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_MACVLAN_FLAGS $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "MACVLAN_MODE_PASSTHRU" "ac_cv_have_decl_MACVLAN_MODE_PASSTHRU" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_MACVLAN_MODE_PASSTHRU" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_MACVLAN_MODE_PASSTHRU $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VXLAN_UNSPEC" "ac_cv_have_decl_IFLA_VXLAN_UNSPEC" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VXLAN_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VXLAN_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VXLAN_REMOTE" "ac_cv_have_decl_IFLA_VXLAN_REMOTE" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VXLAN_REMOTE" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VXLAN_REMOTE $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VXLAN_GROUP" "ac_cv_have_decl_IFLA_VXLAN_GROUP" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VXLAN_GROUP" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VXLAN_GROUP $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VXLAN_PROXY" "ac_cv_have_decl_IFLA_VXLAN_PROXY" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VXLAN_PROXY" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VXLAN_PROXY $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VXLAN_PORT" "ac_cv_have_decl_IFLA_VXLAN_PORT" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VXLAN_PORT" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VXLAN_PORT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_VXLAN_GROUP6" "ac_cv_have_decl_IFLA_VXLAN_GROUP6" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_VXLAN_GROUP6" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_VXLAN_GROUP6 $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_BOND_UNSPEC" "ac_cv_have_decl_IFLA_BOND_UNSPEC" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_BOND_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_BOND_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_BOND_MIIMON" "ac_cv_have_decl_IFLA_BOND_MIIMON" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_BOND_MIIMON" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_BOND_MIIMON $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "RTA_MARK" "ac_cv_have_decl_RTA_MARK" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_RTA_MARK" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_RTA_MARK $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "RT_TABLE_COMPAT" "ac_cv_have_decl_RT_TABLE_COMPAT" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_RT_TABLE_COMPAT" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_RT_TABLE_COMPAT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "RTPROT_DHCP" "ac_cv_have_decl_RTPROT_DHCP" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_RTPROT_DHCP" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_RTPROT_DHCP $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "VLAN_FLAG_REORDER_HDR" "ac_cv_have_decl_VLAN_FLAG_REORDER_HDR" "#ifdef HAVE_LINUX_IF_VLAN_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_VLAN_FLAG_REORDER_HDR" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_VLAN_FLAG_REORDER_HDR $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "VLAN_FLAG_GVRP" "ac_cv_have_decl_VLAN_FLAG_GVRP" "#ifdef HAVE_LINUX_IF_VLAN_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_VLAN_FLAG_GVRP" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_VLAN_FLAG_GVRP $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "VLAN_FLAG_LOOSE_BINDING" "ac_cv_have_decl_VLAN_FLAG_LOOSE_BINDING" "#ifdef HAVE_LINUX_IF_VLAN_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_VLAN_FLAG_LOOSE_BINDING" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_VLAN_FLAG_LOOSE_BINDING $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_GRE_UNSPEC" "ac_cv_have_decl_IFLA_GRE_UNSPEC" "#ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_IF_H # include #endif #ifdef HAVE_LINUX_IP_H # include #endif #ifdef HAVE_LINUX_IF_TUNNEL_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_GRE_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_GRE_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "IFLA_GRE_ENCAP_LIMIT" "ac_cv_have_decl_IFLA_GRE_ENCAP_LIMIT" "#ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_IF_H # include #endif #ifdef HAVE_LINUX_IP_H # include #endif #ifdef HAVE_LINUX_IF_TUNNEL_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_IFLA_GRE_ENCAP_LIMIT" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_IFLA_GRE_ENCAP_LIMIT $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FRA_GOTO" "ac_cv_have_decl_FRA_GOTO" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FRA_GOTO" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FRA_GOTO $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FRA_OIFNAME" "ac_cv_have_decl_FRA_OIFNAME" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FRA_OIFNAME" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FRA_OIFNAME $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FR_ACT_GOTO" "ac_cv_have_decl_FR_ACT_GOTO" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FR_ACT_GOTO" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FR_ACT_GOTO $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FR_ACT_NOP" "ac_cv_have_decl_FR_ACT_NOP" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FR_ACT_NOP" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FR_ACT_NOP $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FR_ACT_RES1" "ac_cv_have_decl_FR_ACT_RES1" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FR_ACT_RES1" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FR_ACT_RES1 $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FR_ACT_RES2" "ac_cv_have_decl_FR_ACT_RES2" "#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FR_ACT_RES2" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FR_ACT_RES2 $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_RED_MAX_P" "ac_cv_have_decl_TCA_RED_MAX_P" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_RED_MAX_P" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_RED_MAX_P $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_GRED_MAX_P" "ac_cv_have_decl_TCA_GRED_MAX_P" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_GRED_MAX_P" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_GRED_MAX_P $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_CHOKE_UNSPEC" "ac_cv_have_decl_TCA_CHOKE_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_CHOKE_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_CHOKE_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_CHOKE_MAX_P" "ac_cv_have_decl_TCA_CHOKE_MAX_P" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_CHOKE_MAX_P" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_CHOKE_MAX_P $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_CBQ_UNSPEC" "ac_cv_have_decl_TCA_CBQ_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_CBQ_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_CBQ_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_DSMARK_UNSPEC" "ac_cv_have_decl_TCA_DSMARK_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_DSMARK_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_DSMARK_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_NETEM_LOSS" "ac_cv_have_decl_TCA_NETEM_LOSS" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_NETEM_LOSS" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_NETEM_LOSS $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_NETEM_RATE" "ac_cv_have_decl_TCA_NETEM_RATE" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_NETEM_RATE" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_NETEM_RATE $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_NETEM_ECN" "ac_cv_have_decl_TCA_NETEM_ECN" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_NETEM_ECN" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_NETEM_ECN $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_DRR_UNSPEC" "ac_cv_have_decl_TCA_DRR_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_DRR_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_DRR_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_SFB_UNSPEC" "ac_cv_have_decl_TCA_SFB_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_SFB_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_SFB_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_QFQ_UNSPEC" "ac_cv_have_decl_TCA_QFQ_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_QFQ_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_QFQ_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_CODEL_UNSPEC" "ac_cv_have_decl_TCA_CODEL_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_CODEL_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_CODEL_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_FQ_CODEL_UNSPEC" "ac_cv_have_decl_TCA_FQ_CODEL_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_FQ_CODEL_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_FQ_CODEL_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_STAB_UNSPEC" "ac_cv_have_decl_TCA_STAB_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_STAB_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_STAB_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_RSVP_UNSPEC" "ac_cv_have_decl_TCA_RSVP_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_RSVP_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_RSVP_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_TCINDEX_UNSPEC" "ac_cv_have_decl_TCA_TCINDEX_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_TCINDEX_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_TCINDEX_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_FLOW_UNSPEC" "ac_cv_have_decl_TCA_FLOW_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_FLOW_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_FLOW_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "FLOW_KEY_RXHASH" "ac_cv_have_decl_FLOW_KEY_RXHASH" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_FLOW_KEY_RXHASH" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_FLOW_KEY_RXHASH $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_FW_MASK" "ac_cv_have_decl_TCA_FW_MASK" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_FW_MASK" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_FW_MASK $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_CGROUP_UNSPEC" "ac_cv_have_decl_TCA_CGROUP_UNSPEC" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_CGROUP_UNSPEC" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_CGROUP_UNSPEC $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCF_EM_VLAN" "ac_cv_have_decl_TCF_EM_VLAN" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCF_EM_VLAN" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCF_EM_VLAN $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCF_EM_CANID" "ac_cv_have_decl_TCF_EM_CANID" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCF_EM_CANID" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCF_EM_CANID $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCF_EM_IPSET" "ac_cv_have_decl_TCF_EM_IPSET" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCF_EM_IPSET" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCF_EM_IPSET $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCA_SKBEDIT_MARK" "ac_cv_have_decl_TCA_SKBEDIT_MARK" "#ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCA_SKBEDIT_MARK" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCA_SKBEDIT_MARK $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "TCF_META_ID_RXHASH" "ac_cv_have_decl_TCF_META_ID_RXHASH" "#ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H # include #endif " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_TCF_META_ID_RXHASH" = xyes then : ac_have_decl=1 else case e in #( e) ac_have_decl=0 ;; esac fi printf "%s\n" "#define HAVE_DECL_TCF_META_ID_RXHASH $ac_have_decl" >>confdefs.h ac_fn_c_check_member "$LINENO" "struct tc_multiq_qopt" "bands" "ac_cv_member_struct_tc_multiq_qopt_bands" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_multiq_qopt_bands" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_MULTIQ_QOPT_BANDS 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_plug_qopt" "action" "ac_cv_member_struct_tc_plug_qopt_action" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_plug_qopt_action" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_PLUG_QOPT_ACTION 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_sfq_qopt_v1" "v0" "ac_cv_member_struct_tc_sfq_qopt_v1_v0" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_sfq_qopt_v1_v0" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_SFQ_QOPT_V1_V0 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_ratespec" "__reserved" "ac_cv_member_struct_tc_ratespec___reserved" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_ratespec___reserved" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_RATESPEC___RESERVED 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_ratespec" "linklayer" "ac_cv_member_struct_tc_ratespec_linklayer" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_ratespec_linklayer" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_RATESPEC_LINKLAYER 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_ratespec" "feature" "ac_cv_member_struct_tc_ratespec_feature" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_ratespec_feature" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_RATESPEC_FEATURE 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_ratespec" "overhead" "ac_cv_member_struct_tc_ratespec_overhead" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_ratespec_overhead" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_RATESPEC_OVERHEAD 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_ratespec" "addend" "ac_cv_member_struct_tc_ratespec_addend" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_ratespec_addend" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_RATESPEC_ADDEND 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_ratespec" "cell_align" "ac_cv_member_struct_tc_ratespec_cell_align" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_ratespec_cell_align" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_RATESPEC_CELL_ALIGN 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tc_sfq_xstats" "allot" "ac_cv_member_struct_tc_sfq_xstats_allot" "#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif " if test "x$ac_cv_member_struct_tc_sfq_xstats_allot" = xyes then : printf "%s\n" "#define HAVE_STRUCT_TC_SFQ_XSTATS_ALLOT 1" >>confdefs.h fi # Checks for library functions. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 printf %s "checking for GNU libc compatible malloc... " >&6; } if test ${ac_cv_func_malloc_0_nonnull+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "$cross_compiling" = yes then : case "$host_os" in # (( # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) ac_cv_func_malloc_0_nonnull=yes ;; # If we don't know, assume the worst. *) ac_cv_func_malloc_0_nonnull=no ;; esac else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { void *p = malloc (0); int result = !p; free (p); return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_malloc_0_nonnull=yes else case e in #( e) ac_cv_func_malloc_0_nonnull=no ;; esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes then : printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h else case e in #( e) printf "%s\n" "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac printf "%s\n" "#define malloc rpl_malloc" >>confdefs.h ;; esac fi ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = xyes then : printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" if test "x$ac_cv_func_memset" = xyes then : printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = xyes then : printf "%s\n" "#define HAVE_SOCKET 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes then : printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" if test "x$ac_cv_func_strstr" = xyes then : printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" if test "x$ac_cv_func_pow" = xyes then : printf "%s\n" "#define HAVE_POW 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 printf %s "checking for pow in -lm... " >&6; } if test ${ac_cv_lib_m_pow+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. The 'extern "C"' is for builds by C++ compilers; although this is not generally supported in C code supporting it here has little cost and some practical benefit (sr 110532). */ #ifdef __cplusplus extern "C" #endif char pow (void); int main (void) { return pow (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_m_pow=yes else case e in #( e) ac_cv_lib_m_pow=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 printf "%s\n" "$ac_cv_lib_m_pow" >&6; } if test "x$ac_cv_lib_m_pow" = xyes then : printf "%s\n" "#define HAVE_LIBM 1" >>confdefs.h LIBS="-lm $LIBS" fi ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # 'ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; esac if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by nield $as_me 0.6.2, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ '$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ nield config.status 0.6.2 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" Copyright (C) 2023 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: '$1' Try '$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: '$1' Try '$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with './config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script 'defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain ':'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is 'configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See 'config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi nield-0.6.2/configure.ac000066400000000000000000000122221470100110300150620ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) AC_INIT(nield, 0.6.2, [t2mune@gmail.com]) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([foreign]) case "$target" in *linux*) AC_MSG_RESULT(linux) arch=linux ;; *) AC_MSG_RESULT(unknown) AC_MSG_ERROR([$target is not supported.]) ;; esac AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC AC_PREFIX_DEFAULT([/usr]) # Checks for libraries. # Checks for header files. AC_CHECK_HEADERS([stddef.h]) AC_CHECK_HEADERS([unistd.h]) AC_CHECK_HEADERS([fcntl.h]) AC_CHECK_HEADERS([sys/time.h]) AC_CHECK_HEADERS([arpa/inet.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([sys/types.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([netdb.h]) AC_CHECK_HEADERS([asm/types.h]) AC_CHECK_HEADERS([net/ethernet.h]) AC_CHECK_HEADERS([linux/types.h]) AC_CHECK_HEADERS( [linux/rtnetlink.h \ linux/if_arp.h \ linux/fib_rules.h \ linux/if.h], [], [], [[#ifdef HAVE_SYS_SOCKET_H # include #endif]]) AC_CHECK_HEADERS([linux/ip.h]) AC_CHECK_HEADERS([linux/if_vlan.h]) AC_CHECK_HEADERS([linux/if_tunnel.h], [], [], [[#ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_IF_H # include #endif #ifdef HAVE_LINUX_IP_H # include #endif]]) AC_CHECK_HEADERS([linux/if_ether.h]) AC_CHECK_HEADERS( [linux/if_bridge.h \ linux/if_bonding], [], [], [[#ifdef HAVE_LINUX_TYPES_H # include #endif]]) AC_CHECK_HEADERS([linux/gen_stats.h]) AC_CHECK_HEADERS( [linux/pkt_cls.h \ linux/tc_act/tc_csum.h \ linux/tc_act/tc_gact.h \ linux/tc_act/tc_ipt.h \ linux/tc_act/tc_mirred.h \ linux/tc_act/tc_nat.h \ linux/tc_act/tc_pedit.h \ linux/tc_act/tc_skbedit.h], [], [], [[#ifdef HAVE_LINUX_TYPES_H # include #endif]]) AC_CHECK_HEADERS([linux/tc_ematch/tc_em_cmp.h]) AC_CHECK_HEADERS([linux/tc_ematch/tc_em_meta.h]) AC_CHECK_HEADERS([linux/tc_ematch/tc_em_nbyte.h]) AC_CHECK_HEADERS([linux/tc_ematch/tc_em_text.h]) AC_CHECK_HEADERS([sys/syslog.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_DECLS( [IFLA_LINKINFO, IFLA_NET_NS_PID, IFLA_IFALIAS, IFLA_NUM_VF, IFLA_VFINFO_LIST, IFLA_STATS64, IFLA_VF_PORTS, IFLA_PORT_SELF, IFLA_AF_SPEC, IFLA_GROUP, IFLA_NET_NS_FD, IFLA_EXT_MASK, IFLA_PROMISCUITY, IFLA_NUM_TX_QUEUES, IFLA_NUM_RX_QUEUES, IFLA_CARRIER, IFLA_PHYS_PORT_ID, IFLA_BRPORT_UNSPEC, IFLA_BRPORT_LEARNING, IFLA_INFO_SLAVE_KIND, IFLA_VLAN_UNSPEC, IFLA_VLAN_PROTOCOL, IFLA_MACVLAN_UNSPEC, IFLA_MACVLAN_FLAGS, MACVLAN_MODE_PASSTHRU, IFLA_VXLAN_UNSPEC, IFLA_VXLAN_REMOTE, IFLA_VXLAN_GROUP, IFLA_VXLAN_PROXY, IFLA_VXLAN_PORT, IFLA_VXLAN_GROUP6, IFLA_BOND_UNSPEC, IFLA_BOND_MIIMON, RTA_MARK, RT_TABLE_COMPAT, RTPROT_DHCP], [], [], [[#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_RTNETLINK_H # include #endif]]) AC_CHECK_DECLS( [VLAN_FLAG_REORDER_HDR, VLAN_FLAG_GVRP, VLAN_FLAG_LOOSE_BINDING], [], [], [[#ifdef HAVE_LINUX_IF_VLAN_H # include #endif]]) AC_CHECK_DECLS( [IFLA_GRE_UNSPEC, IFLA_GRE_ENCAP_LIMIT], [], [], [[#ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_LINUX_IF_H # include #endif #ifdef HAVE_LINUX_IP_H # include #endif #ifdef HAVE_LINUX_IF_TUNNEL_H # include #endif]]) AC_CHECK_DECLS( [FRA_GOTO, FRA_OIFNAME, FR_ACT_GOTO, FR_ACT_NOP, FR_ACT_RES1, FR_ACT_RES2], [], [], [[#ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_LINUX_FIB_RULES_H # include #endif]]) AC_CHECK_DECLS( [TCA_RED_MAX_P, TCA_GRED_MAX_P, TCA_CHOKE_UNSPEC, TCA_CHOKE_MAX_P, TCA_CBQ_UNSPEC, TCA_DSMARK_UNSPEC, TCA_NETEM_LOSS, TCA_NETEM_RATE, TCA_NETEM_ECN, TCA_DRR_UNSPEC, TCA_SFB_UNSPEC, TCA_QFQ_UNSPEC, TCA_CODEL_UNSPEC, TCA_FQ_CODEL_UNSPEC, TCA_STAB_UNSPEC, TCA_RSVP_UNSPEC, TCA_TCINDEX_UNSPEC, TCA_FLOW_UNSPEC, FLOW_KEY_RXHASH, TCA_FW_MASK, TCA_CGROUP_UNSPEC, TCF_EM_VLAN, TCF_EM_CANID, TCF_EM_IPSET], [], [], [[#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif]]) AC_CHECK_DECLS( [TCA_SKBEDIT_MARK], [], [], [[#ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H # include #endif]]) AC_CHECK_DECLS( [TCF_META_ID_RXHASH], [], [], [[#ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H # include #endif]]) AC_CHECK_MEMBERS( [struct tc_multiq_qopt.bands, struct tc_plug_qopt.action, struct tc_sfq_qopt_v1.v0, struct tc_ratespec.__reserved, struct tc_ratespec.linklayer, struct tc_ratespec.feature, struct tc_ratespec.overhead, struct tc_ratespec.addend, struct tc_ratespec.cell_align, struct tc_sfq_xstats.allot], [], [], [[#ifdef HAVE_LINUX_TYPES_H # include #endif #ifdef HAVE_LINUX_PKT_CLS_H # include #endif]]) # Checks for library functions. AC_FUNC_MALLOC AC_CHECK_FUNCS([gettimeofday]) AC_CHECK_FUNCS([memset]) AC_CHECK_FUNCS([socket]) AC_CHECK_FUNCS([strerror]) AC_CHECK_FUNCS([strstr]) AC_CHECK_FUNCS([pow]) AC_CHECK_LIB(m,pow) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile]) AC_OUTPUT nield-0.6.2/contrib/000077500000000000000000000000001470100110300142355ustar00rootroot00000000000000nield-0.6.2/contrib/fedora/000077500000000000000000000000001470100110300154755ustar00rootroot00000000000000nield-0.6.2/contrib/fedora/nield.service000066400000000000000000000002511470100110300201500ustar00rootroot00000000000000[Unit] Description=Network Interface Events Logging Daemon Before=network.target [Service] Type=forking ExecStart=/usr/sbin/nield [Install] WantedBy=multi-user.target nield-0.6.2/contrib/gentoo/000077500000000000000000000000001470100110300155305ustar00rootroot00000000000000nield-0.6.2/contrib/gentoo/nield000077500000000000000000000005621470100110300165540ustar00rootroot00000000000000#!/sbin/runscript CMD="/usr/sbin/nield" #extra_commands="-d /var/log/nield.dbg" [ -x ${CMD} ] || exit 1 start () { ebegin "Starting Network Interface Events Logging Daemon" start-stop-daemon --start --exec ${CMD} -- ${extra_commands} eend $? } stop() { ebegin "Stopping Network Interface Events Logging Daemon" start-stop-daemon --stop --exec ${CMD} eend $? } nield-0.6.2/contrib/redhat/000077500000000000000000000000001470100110300155045ustar00rootroot00000000000000nield-0.6.2/contrib/redhat/nield000077500000000000000000000011471470100110300165300ustar00rootroot00000000000000#!/bin/bash # # chkconfig: 345 9 99 # description: nield CMD="/usr/sbin/nield" #OPTIONS="-d /var/log/nield.dbg" [ -f /etc/rc.d/init.d/functions ] || exit 1 . /etc/rc.d/init.d/functions [ -x ${CMD} ] || exit 1 start() { echo -n $"Starting Network Interface Events Logging Daemon: " daemon ${CMD} ${OPTIONS} RETVAL=$? echo return $RETVAL } stop() { echo -n $"Stopping Network Interface Events Logging Daemon: " killproc ${CMD} RETVAL=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac nield-0.6.2/contrib/ubuntu/000077500000000000000000000000001470100110300155575ustar00rootroot00000000000000nield-0.6.2/contrib/ubuntu/nield000077500000000000000000000017231470100110300166030ustar00rootroot00000000000000#!/bin/sh -e ### BEGIN INIT INFO # Provides: nield # Required-Start: $syslog $remote_fs # Required-Stop: $syslog $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 6 # Short-Description: Network Interface Events Logging Daemon ### END INIT INFO CMD="/usr/sbin/nield" #OPTIONS="-d /var/log/nield.dbg" [ -f /lib/lsb/init-functions ] || exit 1 . /lib/lsb/init-functions [ -x ${CMD} ] || exit 1 case "$1" in start) log_begin_msg "Starting Network Interface Events Logging Daemon" start-stop-daemon --start --exec ${CMD} -- ${OPTIONS} log_end_msg 0 ;; stop) log_begin_msg "Stopping Network Interface Events Logging Daemon" start-stop-daemon --stop --exec ${CMD} log_end_msg 0 ;; restart) log_begin_msg "Restarting Network Interface Events Logging Daemon" start-stop-daemon --stop --exec ${CMD} -- ${OPTIONS} start-stop-daemon --start --exec ${CMD} log_end_msg 0 ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac nield-0.6.2/contrib/ubuntu/nield.conf000066400000000000000000000003601470100110300175200ustar00rootroot00000000000000description "nield - Network Interface Events Logging Daemon" start on filesystem stop on runlevel [016] expect fork respawn pre-start script test -x /usr/sbin/nield || { stop; exit 0; } end script exec /usr/sbin/nield nield-0.6.2/depcomp000077500000000000000000000442671470100110300141670ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # This program 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. # This program 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 this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nield-0.6.2/img/000077500000000000000000000000001470100110300133515ustar00rootroot00000000000000nield-0.6.2/img/nield.jpg000066400000000000000000000246141470100110300151550ustar00rootroot00000000000000ÿØÿàJFIFHHÿÛCÿÛCÿÀ2@"ÿÄ  ÿÄ5 !"#$1Aað29Qqw¸ÿÄÿÄÿÚ ?¿ÇÏŸ>ϵ“Ð=4n ·îÊ’ª’Z$œ†¬£öM‘ ‚›±L3z sÁ0ARƒBŸK‰4!'±rÂ>H<ƒjªZ.Y‚n?¼þö¤*y-w ´îJªµ˜[æó©¢sû # ’Ú=I ´~»".8¤Øæ¥åqq[ 5&ÿ¤€å¾“Ú¿>}ñ¤8üLC³ò“¡ã@Xe¾›>Ma ¿–åM–HŠí™¶þKÇ-š!ûËéûΗEº_©eSÓ`û?>|ø>|ø>Õ²›Ê•ƒOau\Úß«aö}‘ûŸëºâS`ÄãóÙîQStVÄ.\³9 §ö–Ot”þŒ{ïЦ›é¿éÛLãí¥ð>}§g}@Õ³X=mg^TõsbYÏÇ ­`3»2šØE ˜k6vXü¤ó C™€`AÃÓÛ lš\"†û‹à|ûãH$Qø˜‡r IÐñ ,?‡ÆÏ“dC/å:E“_å’"»fM¿’ñËvˆ~òÚ~ó¥ÐnŸëYTôÛìüŸ>Áì[6·¨"D§Ö̓« ¡¶m©y¥‹, ‰ Ùë„Ù²Ô”ŽJü`v;;v²-[aÓIJ»…SA,nªškÎ>}†×ö-}lDØ5dîe@¤:ÏŸq/_z-Æüâ¿iÕ·Õs›ISˆ+t+ËRÁ\Óx^ñÔ䋪•_šî&*JÁhŽçµ©M­9}‘¥0Ì;kçØŒs´ «.ùÁHe‡Îb$Þ2ÙÄ´3#à_º#&@ÃÁD8XAÑC QM™”Éò+¶K.ø4—Bôu%Êuaû§ l µ­oý”ߟ1‡®•tý×î(‚?&‘ý¥²:=PÓíPp£V*¦Ý}Ó–?ˆÈUÛ(1á=:ß­_G¶G&±Ö(=ƒ%Þ9n§ŠBÃÜ΂ ›m·ò\Ê2»ç9ËÙ±qË<}ø´#6˘ÇËÙtêŽnÛ#I–]iie ws$OEufè±x ‰«xzîQQqMDÍÒj»dκEä«~òu ,©$*ĵ.*Gf¹µÃl›ÿmë6,ì‹©Zè~j¹$BîüïUÃX˜xÍrƒV ™5 d¿¿Ðºhälvpïcqjrå°€)”¼º¼_dÙr™ÁÄÛÅ$EÔ–ÍÔt–—o¢úìøkÔ†› >ù§:N¹ mÑ64^Ñ®¤?» ÙDP†¯™áÛlé«ÑD›ïª$¢š"Z>m˜ãbgøÄÇ´q“Äzû‰µ/¯—ýU‹¯ú,²Þ ¾µ® lÛGÙ»rå?õ7øÖTÆ^lkIgðÔs ¼'xÎ’-_grgl@ïá@ÿe†Cµ%e»ÎLØW8"DÛ¼³ˆ!iFHL›áŽŸ~CX rƒ‰ë¶®)¨‡õú’ ¸jÞ>« º?Ï¢B×÷KË:ŠC´DŸUG'R}–E«1tÜNq±&ñº ‹³ æ-!€»~¢ûa é+ý–Ïíê–ÊcmuÂ{óæôqVZÙÓk¦š@¦î4öÍækàcRû¶ÓUÐnAA$K¹ÛT÷MMñ¢ö)©¢Ž0Ž»~Ò|ûEÐ7ϽQRÎÖüߊ¶w¨âd!gšr¦èêçA€ÿ©3qS*3Ý'©‡‘ŽOv ¶}«L´r‚Ê~k7«yv””´ƒ\½%AÔ³bÙÉÇìۆ¼JŸFÈ*$|œzU"YÐ7ÅAȲ 7`è€r¬q»‘ÎÓH7ïÏ¡ßÕNºìÎ~åa}[À¹îó¬w#µÍœ%±^‰­Ü4ÕV¥p¼ÃGä‘0»eWS¨oHð]4“nÀ„a´œ¬^7|ºí.´õF'.§¦«Ð7ì+”Òn; *Ú± šEe6[Ëý…UwcYÈŸ!ˆ†Iˆ·› ¸ÂPùlÌ-Uóèu=Çž·ŠÝÁ('± ä{ ß}ÙÅm^ ç=GyŒãö›¼–W›F‰g¾?Vª®Ú4]Οž6M¿øs×o¨ÞÆy…%¿}sÐ4 2éˆkxQ.d±&d?×õ"?ý°LDt›D5YqqyÍ7 +Y‰dNÚ7rhpZïçÜ%Â>rÿ¢ë©·?Ë—ÉÐ3ÖTË‘dÑ®œ¿ÊØa‰4y©m\ 'üuÿ§”Ç ŠU»áí îdI¡ƒ{·à|û’;›¦Ìq÷3M¯ØínÖÝ=“Sñ@ÕãÙ¶k–r–õÓ^Sl0êkˆœãú$E:Ÿ¤mEs)«½l?oájï$™àU_AvRÒ„:£‘)Žf¥#‘I,ª]pµí`ö{x³Xèå (äÌ}åY±`6mÞ;3$,dÄоxš­ôSdÂmTê÷è (Æ%ÛǞݖÅÕO³;h£ö€YöÁÛ›tÁUóq Ђ̒p‚ŽÓm³t×Cu5[HÉŸuïrvGŒ|­×óâzÛ‚{â=Q[æÍ+—ßç‘ÙEóÇŠÕ“uŒ©¾U8tÈhQÍ K/ØM4Y¬ÒÀQ¨Ë‹ôï3q§SYÜ7y]Q{Êéë=œßˆ‰µGBØ3Ó!æqÆú;ݵ§±!”ˆ‰cà•|«¸ IFú*'/7Ôv7'ù™Ûý‘½žVóÞ¶äù *Fô}=vF˪gÂåPô­ø,`¹7û¥–5Ðv›ÈŒ}–Ä7Žv³t„¶‰Ðþ¦z[qõ¯sW¼‘"·+¨·Ì VðŠ¦‘àâzöæ—Ť3(¾ÉÜ3ÖÑ™SÊa„üÌ @ò nØcA\0Ì1' %s-5/¯cô¯7y+rYŒŒsDÎÀ´FåTDΰ-/ éh¤ÕÜLmº¼V¼Ä|XñÙ‘Å!òeʳÚ-#¾ÚMß÷D&vÜáï;§ œL6¶j‰%ã{E”’Åè^· •ù ÐcGˆ+_À§kfZ ða-ž½ÇE6Á¶¬“.P“åÛ$ùÇŸB¸êKO¼wO×ÅÁ—9¸œIÜS âk€ñS²šúu)2ŽËÔn2½¿Õk0;’ÎÊ™in5γå_“—é—‚zº;ŸË^³ ‡vwG´¾¹ÚÏãË€á}Ñ«êx"7LÁ$g1Œ‡×1Éšn&gEU Æ x{!p~ët×@ì°øÎ‡û‰èä•ú¸»¬’¯;JËG‘ç\K+N¤¥Ð&B½¼ög,¸]³ƒJX’¯õ”]S±Éd§­ž;MØlu³TïÏîïÎN¢ê¥JÞM4ÿG5M•]]‰ÎK¬¸ÐÄ£D8¶Ä‘í&EÒ5ÜëeÈ9Ë’bƒ8sUß]töœ…ÆýéQfÒzàKÌê‰ÝÔ3 ö#ýc2 ²"—Lª¶b¶N<Í£/ôñšëg‰­&<¬ƒÚ"é°¦Ñöíß„O5îŸXmÕ= Ò×µý=§‘URÚìPUd°ß[Øõ¸Û…¤}Ññ†#àbæ’zfÀ)NÀH9gTCâO ÏóöºO×Nô±*?lN`”Dé{¼e]gdAŒÂbgëy•—¹é*"(é㙤n[8ˆWÏeò <¢# 1i:-H<øHÒšJ·syÍäŒÊÑÞ÷ëãš:]o®Ò=)(W¤^sÈ ÝPj]²jMbâ%ÛìÈÏ\Çta$v²"]’ áÛ1NmN™äŸ6Y+Â3«Î_]Pqž4˜ˆ!È(>¸#3è¬eá³N@M‹Ça®Ó£×/È!©–QÊ…Ws®WªÓά➲òÒÆ»¦l;ªë}¤g%ƒÃÅAXrãvyæ´p\:¼‹WøcY‹r4XÊH2£WìÝhá”×ø=Ò]Ùœï4éN‡ë|Ýò3ù+JH5aR×ñºpNÒ É›¢Pø ”¬Üš„Šv}ߥn;B¢5‘뉧r’JQÌ VÏ%ò¯â=˜¿ÄÉxS™)G,[ JJi2Á¬,ßMýC‡ùiÜv´rÄæN¯ª:FY´&œÙ¥v­¯XI›¤í)kjÚñ®Œ`›—Y*ÒÀb †²Iˆ…š ,‹Çítâ?kz<ïÎNs¾;/¨a¶ 6Û膜ý­aÑ!ó™ç>È&ÕŠMCÁÌ‹¼€rÆO±1% $¼¦,a7ÅŸnðm…eü1ãÜ*‘CÌ"3*‚¡5°#–+šƒ^†F¯ÛÈ_ø™ !'¤ªNòÇ•8Ž6†.ßahŒhÈ;QìQÜýÛÎ^xt YGqG_[ÐØ@¡28|Ž›¯ËÞÑj¾Ç–—‹CåULs ™(Ðô½5JÎÙ¸±î¿˜cíÍË_Ùø!‡¦¯>ÏägsGfT°éÇ9óa™õßWr'±,7R7=7y:7aPåº6«6¬Žý¾ûJª×Ñò·6aÓe‘ o?Ÿl; O&y~á½|Óªú£¤œÔîß5ÖivIÆ–‘O㸌2”½â49Óg#Ä“Q)T‘¼q&É7”î·âo l.”—tSÎ*ØmÁ« â#qŠõµ ™[iPWÃ*p–ìQìk.5šG«—㣟ì1Œõ‹†2qÑ·è·û¿>|²%EI¼¹HÔ"ד/r’¤ÌÝâÏ^œ„£Vi¶³J2l]“ ÓT‹~M .ݳGÃeDAPŒjHì;°À+[W¸8è¯]«Ö=ÇÌ×¢yºqx®#1Xe#ÖìLÁ ؘbV©®‡ª$㥃³xUY9c)»ŠKßrQR­Jz¿ìtÀKÖq 7ÇNAg‘–ó®UªüÙ;¥‚Õ!ägÁš!VõD*.xü¶FÕÀ ÚŠs&>¬BJ«$dÏ&ŽJcÍìżuåÇ3]Gž¥Õ½…ÓòÛèuÄ.g} ºïAðVªŽ@¤2G3&.b/Êì¡ d¤hfå²<#)+’†Ü.@|Ðð…µÕ]â+4¦åçÉO Ï*>u}× æõùYänJR.tŒ:™{aÌÃ`2è‘È¡À*¶‚lJ6Vd>[…v°XGóÿŒgóÇüþ_óÿ–?þŸýÿòûÎ{ñt {¤½S'\“î&§çöuï?¾ÙÓ†ÂÔËïò»rP‹"íLH&†bdŽÅM澪 žjŠ*ºô¹­å!PÚwDÃeu‰ÔUÌÚÍ“eç÷ò ''/ªƪm²ûãTtÂ{íºÛ'®ºo¶N|Ç8oŒî\úÒâ!4žÈb?HNgGyq7*gG Y”Y7+‘bÎckN¶&ùºrã®h@¸uÛíqR—Ý-µ9ÖL]KH…9e8qâ*Bèk1Ç &+KGÈXkÑŒœ1p1f»·Ó cóÝ_P‹Æ/C&žYô‰çÿp´#WÕ²AÅÖ™mªIsýÌ«V ¿%¢ê°Ö¥²D&b²VnDÛ·Ú'g$ÎJ]!)}”ÕMm4U-ôQ%tÕD”Ó}wÑM7×k¾›kœë¶›kœg]µÎq¶3ùãþ?,ä*OïÌçÑ._4ÖÅV΋ô'›·<Â1›óDú—¤ŸŒ“ƒëV2ù’5ŽÖr1Yâñ“`Ö¼jb*}>Ž­XL@äÒlëš¼j‡„ÂúãÊEºO ½Mó )…¿ÑšºÛX\„Y•p‰·O FðÎÀaŽk#C&ß.ñe´ŸîØæp‰ÊW¯5Èuc¢6¬°PdI&¢¬ãó†9Dõw+U4´Q]ñž ŽIpšiï²» Õ/Ѿ»í®k“ødn'vW;õŸÜlܬҩ:àˆè¡ÕiÛX%΄–5hÀ[7n®?Š:96“2[8ü—þöÔ{¾®Üi¾‰2 ñ-ð&iÔV8Sÿê5ãÖ bûîü\5ŽT 7ßTýPgS‹N/DÊÉm##ƒ(QŠi4ÜšôMœEGY¾õÓ­ù¡Å^s—”Üß¡BÅØ× ¨Šs¨!³™?ѪªÙ'è J³g…Ýe¶"»fÏt²^Hÿß5Ùúןn£ÜëÐr)](lGÜ,ÙA Âf’AÑʲAÁ°érò2dŽC¢©(¨ÈëVFÇ™ rëå^å+‹4Œó/ / Ô™š&-¹;*\šy›­1°‰&æY Ê®r£½¼'ý@åÙÃF±Mit¤Â°cáSØ´vm “\LŽ'- 6G>-Ö1«¦lðYV1Œafoš®Ý_Ë­=¿,}PN5ôŸº¼Ä·æôDzÑ΂)KËN1N%Ó2Q&ì¨ÄFÛmX,àDì#mlæR9qnߊ•11„–nË]`Û“Ÿh:W:[ñy»FVEe+BÏ×õÄ"°¬ØH²àñ}ÎŒP“ËI€B7 «ÕZäÃã.n+/G¢r—¬ð%p¯ Rä•?ˆµÝF?&ÒŽ²®J¾•'Ió’-µ†õb!ŠÅÈèåÓ—›¡SØ('Q¢Ä]¼f9nà‘X>m7Ù·âÆÁŸLòÜ·øÉ&ôµ %ñ÷èÆY„VÀ"M›e7ý?«dÙ-- ²iç9Â{½WmuÇîg;m/¸G¦û¸ˆúÓØ1òQxžòù «_3>9ø7V­‰"è|EìBíîI¼ u+Â^°ÏÙø‚‹º½*ó‹›¶ËR/æc`‘סÎSÑA÷@£^Õ1®ÙѱW1’lÿ^?^tÕ£µÓõq¸[•jd*nIç:8¸íVJ¹çŠ–®20² œÿ'1ZàX«Rͳ¦ìÝ(ïv.5%¦Éî‹¥_÷5ßU6üèMÛutËß\#­Ä€ú¡Cîʌwk`iºŠZùð{:Š|õÆŠ¡–‚”N]`“÷$Î Š9ƒL^¼ÄÓ2:ú2þ_úcÿþ¿õÏþóõaÿå ÊuÅuEòÑŽªI(+¡¨§DwýxÃ:îá¨}0›u3—'±Ú£ÍôAiã÷¬ÓO‚ɰ9¼b̃ÃlxIfç¡vR;7ˆi²ÔÔ^V™à›glcoã‘ý£´V1·í­®sùg?–? ™YÀ.X ²­´âAgUìä+¸ô²'"g£á„¼×U»”6λ¦¢jj›¦O[(ƒáÏjD{–¯Ú¶r”2~ûííßæ%p³· óìêwA|ç;~µXGÕ<†2K_ã ž@W–4>2ÓTvq§ñ‚£º‹ÿ'w£1ËWsíi.¸®y¸*î´‚ŠPÄ¢Y"sº µ×}nÝMÃò¥Ê=Y°°@³~vBi〆‘.ý“%ÃÍæÆÞyáÇ®”ª¹ Ó‘úB|ãFøß]]YÜëeŽMWL8Õ¨ó$ÜAÏ·Š*³ÃÛY1¦óP,Ƽ ÃLAE›8È—È .Å¡1„©…Z¾ýºn™¼l¦¿žª 岩®ŽøÎqº{ë¶?ñûÎL-UbûëëM¥aâ2h½%œÅJÙ•õÙºU<ÂDF’$ÿ÷‰‹jXÑ8f6 ð¾‹X¤Eèæ‘›èäÍ“AÌÚ`Õ»&,[ Í“6ˆ¦Ý«FRÑÍ›7K]RA»tSÑ$O]SI=4ÓMq®¸Æ-½©ŒÎ+˜KÁ¢U±¹9Ô„lP|¤¤…H°ÎÁ¡ JÜ eEyŽë³*EE£)äÛDªìvɹA54ÑQ!òLuæÞ#Ë©t³ËNÚ…Ì«m…\q¿N$P#q Æé>– +¿W %MQÈèD¹U„{ª DÂ’YY:Á NOÏ‚³ÕO<ôÄñ[s™F –ÇŒyyÉYÎ<‰bŸUè&s«o¥‡Í"Ü«?ŒI]¨›E^S…®!çK¦ÿ:‘Û2$2ó\5Wà<]Ö‡í.ŽÆb ºy­5–DùÜËžZјBŸ’Ä'Ð΂èy@Ø@ÙÌ6xô›†Ië =hK§ó_ñ¹ƒÀ¨,‰’ãí?óક ʰø—~>I£TÈÝÐ;¶xJe7’²­ôaj1REÑãбËËè#Iz V‹½r4þæ]êÁœU‚Üaƒ™7oH*(Cþzëúázžõ€ØT¯–MöNEUòÖÓ·UÕc7·¯?ô Öæ¨šÖäaýaFÅ!²æ_Õðò²qÑAÓœ 5 ¬™¶wÏ‚t»d“$b2`«Ìu÷TÓ¼}éßxHo嬨Èv•á¦Uá¨}Û¢ä.ëý™«oçÓ•œù°•ÁœEðªg³½Š~‘Øy³8g9?> õXÖ—57ìéÏWôÍ b_œÙÑœKCù>~ïí»”TuôZarírѦ«GU‘‰•k9µžIáA‰O ñ¡R€£3s!CA™iÊ<÷Zé˸þmèg5Ù³zUÏ Yµ ?/CMz‘ju)êk ÆÓ þ-±ŠÃçrÎb•Ò5`—F5ÎS«äÐåX·mªvÃû‹z#‚èÎ’°ÛÒR—=ol……æ³VË o;FŠ™Hjüu'ÿZË‹V²`9“Ã4‘>zi¨¢É9Øy¯œ rÏg®ð¸W'‡†×}+æ•íÑ”ÚSÈØ7§•p¸Æi9•ÿÿG+ÂqÝ&JÁÌX5ì27=“뼎´‹L*rvq¹d lÀ›ilE}¥çüq6ŸÄ«ú¦W[×ÏT=qXlœD„}í3 qFô (Œbö•NB%úÇ@ˆ ²_×ÈG¨ *ñ%ÔôeWóua§iÈÖ"¯öŠ¡Cˆ¹"|ÃùˆéÙˆY ŽE"&pñã¤È*Qû§*ª¹ÏÁZÚ•að/.ü|“F¨‘» wlð”Êo%e[èÂÔb¤‹£Ç¡c—–ÐF’ô­zäiý̻Ճ8ª-¸Â2nßGt#*Žºæ«…·yªt·{Œô¸u¦~óuÎÓ5Ã˜ŽØ½øÜ7 Úônb»A÷Íéi„j†üÛI*R£l¢+ÂYîÙw­n=ôt†òË’Y,&#-¬k8½Pîï›}ç2Ç®§R‡sulàœþæ^¥jÆHœÐ S5¸']îø@V ËV¡ó=‡rSæ'iG£AÉÈ¥M2+$Êv©¶Ù‹iªåÊûãΩ¢žû~œm·åúuÎqÈý—ÖÕŸ¢œï3âîBŒßm‰Ño¢UÁ‰I~eèz¢¸¥ ¯¦1ò3«bÇŸ\µxX¸¬#‡D“Q9áùðRÒD§ó€>‹AÔD+;K–Î5£ªŸ5g¶µ‘pÄAP/ZÍ{²VøTTµƒ%¥,›A5ŽH`ÃFЇFô\Æß¼·Ot¼ 4?¢½ Ó1»\Î:œøt9xŸozíýýM“¢à±h•gOZM#f4­¬*æL@=(´œånÆ?(*Àdw9ƒèZûçÁ\êÿ”cò;gЦ÷UJ^ÑCüÊáÚÖ!.½àñ©4øÜÒ=:ÇIÉŽeÑ5ìb†£õçûA$²&ˆHÑig_1pÅóÜB¬æ¼D➪*Áµ¥¾vˆµÿÙVØ.Á$L'¶g›Sù“vÉÖbu3³Â·S¶‡Ëí)QW&Y×ô¥±\èŽlÁóàª= ùeÍ”ï"ÚuGvóÿAÉú¢h_œ¦uÛªàrÄ“~´˜Í:9ü]”&éAúIšÇXÇ,iƒ[+xÊÛ1ÕÓ1-›ýA¼¿ãâö0ÊC.qßCì-¦hVhks$L_® âƒ¥Í d>fLeJ0l1¹FN¤” oª˜éÒ«Ú“çÁ¿ˆÆêÚ¡òêÓÑîÌޓŠÚ” ëE4ÕMµ${{TÇTÔA}д¹—ˆpžr†éµ~»´–Õfɦ§þJ (ý Ó,EžÚ³,àyWmõ©Æj¨òrR„D8Ù¾7Ôt‚CfdY,¢íDÝ¡ªÍÒØr*¯3>§y¶ÓŠ*!M·ÏSn ÖCK0€dYŒØS“-"ÒˆšH‹º5rAXÊŸîÕVpë!¾ëè¦Ë¦ç8KiùËÅÍ|þäZÛ—µ´_A‰X%‹ØÍaëìËŸMì9<Í»—1\ʦÛ\cbb:«¼œž_5޶}®hãQ¬Ãý}òºôŽ·ÿ*Šä,¬«à«·¬l·ìØ\´c}Ü>Ò¬´•dÝwo¡Ä.åP“lôÍtqó“A[‘JY•Âw’þÅÎx~X§œ^ž³“Ö«2AkË&zÕÞÆie[~Òbk‹1ÂY}’uÍh­kf \ xx"؉eà)wu?¸²¼èä.ôÌoHTÂäç‚°TtZÇ åÔ^Ή5QUÜèÔ$Ð2É,%®œÄ\î D\Wgãî×ÎwÈvpsdEžPy°fÇ2.ȇ­‰ .(“džŽ&0‹%f@{ök"í“Ö‹*ÙÛe’]ºŠ$¦›æžKX @~"~Ë^ºnú lO{’5º¬wl°E·¸žYcÊÈõõ íJÂY¶‘k‡ Ù&¸Ñû«‰vâ7KPÐ+ÅÞ¹ô EI˜B¿ŸÕ°«¨˜†æ2¢”¯æ$õº¡óÇN_¿|V¯*胬‘Ýòoð«§Ë ªo6ì’—{ëšK|\N¢Fa̹† ®aGŸvMàˆjgçÉœ6ÜFÆ]Î4LK²ÍZ‡o±L*÷ì$ø§Û‰5¸¤}GЉ,΢é_ñdÒß\Í¡R–#G\q×9Ûaúºa`J£vÔqîZ»o˜pËQ|ŠÎR‘ß ¦|œôzúàÛÆC«J£«›@äüµrœ{†±K{Åi"èÌ 8º!ò¯Z¬á–ä8]nÅGTʺL¬Þ)Bý<”×6k;¨…jW±eà›œÚ½acÇ¥¿íJHFˆ&ID Ë'âN™,àqTeØ5l\š[Ç\¹p›¤¶¹ÿ"¨ë×…h7ì":Ý2.}¯G@`÷ì,•}ƒjrqÐÎ!û;':Õšm¢#£`Žˆ“¸–EfÏãCdò(Ê„[ l%T“Y=Ò[MIM7MTÔ×]ÓQ=õλ覛c:ï¦úç:ï¦ØÎ›kœãmsŒý©õ¤¨€Š¸?­GRp×÷H:5¬Áføoúœ¬ùr?Ô¥º8GláW*-ÛÆ›+¶øý?«“_òÏ­\ê wQw?ô trB¢O» Ÿ&Ïíf™Ãa‚Nj«\»ë&(¥û’Ù¦ª“~ªª"°ýAó®f^UõÇ_/‘þ‡ú18œTIgÜÍÊõøž~­ $ÙmUþªe-ÝüŠKcÆÈ(ƒWK–UøwZ¨¸ š³|Ì#+Ò¯Izg¿znÁ>>M¬" ÅJwnß´ œPâÛá!XvÒÚ‹ºn´r’¯[¸'¹ÉÚeRaË i HÏô°ç³håæHL–×÷뛨ÙŽ=è·œ«:ÌýÅjHeöœü×–a“‹NÅ*òA3*dþ‘œt¨‰ÀêÁ³Ò ¥Š<„ ŒÙûûÔs—,sÏ#Wíêþo©b541-Ò]Óã5”*}ú(á²eåò¢Î K&Çukªlÿ¿—›6o,ÑAžÏöjÝ“­E{øaìhžNÙiê=Ÿ—œq"^A,©)"5 ðŠRì<ÿ*o™ˆ^ˆ)³fÇÿ˜¶…[&'f’Qde”·ÓTBe»“מ0àïäÆl9Ú– ׿ì7@Ôº3—Y®H¾Ê m!l›Æá`h¼ÝÛU›í3,‰FJ(´dT…Òz±R´¾´ô7ªýÃòÛ“¤«¸q¼Îy]Å`|Îu¶ ôÀiÁöÓ8ÊóÒ1IcúE3=+[M†S†¥dÙJÜà«Iô—nrãþqá¦\+çÇ@uŸK Uæ‡:[¦™ÿ¤ãÀÊ+ºš?~Ã|Æb8M"z“ÎËåF}¤…›§$ûv·iþÀPßö=¦ ­œÔŸí*ʽÀÙH˜ß4 €OÎzÝMÂÎl¥…Í­ƒAb$‡Œ%:<Ü!g LBEb1†¿Ý(X4çŒ^ ó_œ|uäü:Yquu±~,.±¥`ÂÉ"nCc^ÀQŽº/4t-øÄpÜÑáÐùH9Tàˆ¬”ËÌ\6ì<üõ‡Úë:?húpÇ r¸B)˜‡Ò‰X¤pýµ] £ ¦‹¬ôˆI›†J‘bο²œ¸>ås¼z!‡e“ êò{Îzï„ù^žr¬€Žéç°í ÝÖZ "Äl'éS·²g6´¼+¯µ/ˆ(FâË+rÄ&K5ÕË¢ïÈ>•Oƒœ¹c“èn1¨‚Ò\ña„ŠUBs¦Ê>K$nÑn‰9tÎBëõ’ÉÊ&Õª. ?WmZf8†ã#â aÑ¿>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|Ÿ>|ÿÙnield-0.6.2/install-sh000077500000000000000000000325371470100110300146130ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nield-0.6.2/man/000077500000000000000000000000001470100110300133505ustar00rootroot00000000000000nield-0.6.2/man/Makefile.am000066400000000000000000000000331470100110300154000ustar00rootroot00000000000000dist_man8_MANS = nield.man nield-0.6.2/man/Makefile.in000066400000000000000000000345651470100110300154320ustar00rootroot00000000000000# Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ } man8dir = $(mandir)/man8 am__installdirs = "$(DESTDIR)$(man8dir)" NROFF = nroff MANS = $(dist_man8_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(dist_man8_MANS) $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ dist_man8_MANS = nield.man all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man8: $(dist_man8_MANS) @$(NORMAL_INSTALL) @list1='$(dist_man8_MANS)'; \ list2=''; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list='$(dist_man8_MANS)'; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man8 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man8 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-man \ uninstall-man8 .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% nield-0.6.2/man/nield.man000066400000000000000000000043761470100110300151520ustar00rootroot00000000000000.TH NIELD 8 "Feb 26 2014" "nield" "" .SH NAME nield \- Network Interface Events Logging Daemon .SH SYNOPSIS .B nield .B [-vh46inarft] .BI "[\-p " lock_file "]" .BI "[\-s " buffer_size "]" .BI "[\-l " log_file "]" .BI "[\-L " syslog_facility "]" .BI "[\-d " debug_file "]" .SH DESCRIPTION nield (Network Interface Events Logging Daemon) is a tool to receive notifications from kernel through netlink socket, and generate logs related to interfaces, neighbor cache (ARP,NDP), IP address (IPv4,IPv6), routing, FIB rules, traffic control. It can be configured using command-line options. .SH OPTIONS The following options are supported. .TP Standard options: .TP .BR "\-v" Displays the version and exit. .TP .BR "\-h" Displays the usage and exit. .TP .BR "\-p " lock_file Specifies the lock file to use. Default is "/var/run/nield.pid", if not specified. .TP .BR "\-s " buffer_size Specifies the maximum socket receive buffer in bytes. .TP Logging options: It uses the log file "/var/log/nield.log", if neither "\-l" nor "\-L" specified. .TP .BR "\-l " log_file Specifies the log file to use. .TP .BR "\-L " syslog_facility Specifies the facility to use logging events via syslog. The standard syslog facilities are as follows: .br auth, authpriv, cron, daemon, ftp, kern, lpr, mail, mark, news, security, syslog, user, uucp, local0, local1, local2, local3, local4, local5, local6, local7 .TP .BR "\-d " debug_file Specifies the debug file to use. .TP Event options: All events are received, if any event option not specified. .TP .BR "\-4" Logging events related to IPv4. .TP .BR "\-6" Logging events related to IPv6. .TP .BR "\-i" Logging events related to interfaces. .TP .BR "\-n" Logging events related to neigbour cache(ARP, NDP). .TP .BR "\-a" Logging events related to IP address. .TP .BR "\-r" Logging events related to routing. .TP .BR "\-f" Logging events related to fib rules. .TP .BR "\-t" Logging events related to traffic control. .SH FILES .nf /usr/sbin/nield /var/run/nield.pid /var/log/nield.log /usr/share/man/man8/nield.8 .fi .SH BUGS If you find bugs or have other suggestions, please contact Tetsumune KISO .SH "SEE ALSO" .BR netlink (3), .BR netlink (7), .BR rtnetlink (3), .BR rtnetlink (7) .SH AUTHORS .nf Tetsumune KISO .fi nield-0.6.2/missing000077500000000000000000000262331470100110300142020ustar00rootroot00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program 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. # This program 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 this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: nield-0.6.2/src/000077500000000000000000000000001470100110300133645ustar00rootroot00000000000000nield-0.6.2/src/Makefile.am000066400000000000000000000020571470100110300154240ustar00rootroot00000000000000sbin_PROGRAMS = nield nield_SOURCES = \ nield.h \ list.h \ rtnetlink.h \ nield.c \ log.c \ debug.c \ nlmsg.c \ rta.c \ ifimsg.c \ ifimsg_brport.c \ ifimsg_vlan.c \ ifimsg_gre.c \ ifimsg_macvlan.c \ ifimsg_vxlan.c \ ifimsg_bond.c \ ndmsg.c \ ifamsg.c \ rtmsg.c \ frhdr.c \ tcmsg_qdisc.c \ tcmsg_qdisc_cbq.c \ tcmsg_qdisc_choke.c \ tcmsg_qdisc_codel.c \ tcmsg_qdisc_drr.c \ tcmsg_qdisc_dsmark.c \ tcmsg_qdisc_fifo.c \ tcmsg_qdisc_fq_codel.c \ tcmsg_qdisc_gred.c \ tcmsg_qdisc_hfsc.c \ tcmsg_qdisc_htb.c \ tcmsg_qdisc_multiq.c \ tcmsg_qdisc_netem.c \ tcmsg_qdisc_plug.c \ tcmsg_qdisc_prio.c \ tcmsg_qdisc_qfq.c \ tcmsg_qdisc_red.c \ tcmsg_qdisc_sfb.c \ tcmsg_qdisc_sfq.c \ tcmsg_qdisc_tbf.c \ tcmsg_filter.c \ tcmsg_filter_basic.c \ tcmsg_filter_cgroup.c \ tcmsg_filter_flow.c \ tcmsg_filter_fw.c \ tcmsg_filter_route.c \ tcmsg_filter_rsvp.c \ tcmsg_filter_tcindex.c \ tcmsg_filter_u32.c \ tcamsg.c \ tcamsg_csum.c \ tcamsg_gact.c \ tcamsg_mirred.c \ tcamsg_nat.c \ tcamsg_pedit.c \ tcamsg_police.c \ tcamsg_skbedit.c nield-0.6.2/src/Makefile.in000066400000000000000000000740351470100110300154420ustar00rootroot00000000000000# Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ sbin_PROGRAMS = nield$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_nield_OBJECTS = nield.$(OBJEXT) log.$(OBJEXT) debug.$(OBJEXT) \ nlmsg.$(OBJEXT) rta.$(OBJEXT) ifimsg.$(OBJEXT) \ ifimsg_brport.$(OBJEXT) ifimsg_vlan.$(OBJEXT) \ ifimsg_gre.$(OBJEXT) ifimsg_macvlan.$(OBJEXT) \ ifimsg_vxlan.$(OBJEXT) ifimsg_bond.$(OBJEXT) ndmsg.$(OBJEXT) \ ifamsg.$(OBJEXT) rtmsg.$(OBJEXT) frhdr.$(OBJEXT) \ tcmsg_qdisc.$(OBJEXT) tcmsg_qdisc_cbq.$(OBJEXT) \ tcmsg_qdisc_choke.$(OBJEXT) tcmsg_qdisc_codel.$(OBJEXT) \ tcmsg_qdisc_drr.$(OBJEXT) tcmsg_qdisc_dsmark.$(OBJEXT) \ tcmsg_qdisc_fifo.$(OBJEXT) tcmsg_qdisc_fq_codel.$(OBJEXT) \ tcmsg_qdisc_gred.$(OBJEXT) tcmsg_qdisc_hfsc.$(OBJEXT) \ tcmsg_qdisc_htb.$(OBJEXT) tcmsg_qdisc_multiq.$(OBJEXT) \ tcmsg_qdisc_netem.$(OBJEXT) tcmsg_qdisc_plug.$(OBJEXT) \ tcmsg_qdisc_prio.$(OBJEXT) tcmsg_qdisc_qfq.$(OBJEXT) \ tcmsg_qdisc_red.$(OBJEXT) tcmsg_qdisc_sfb.$(OBJEXT) \ tcmsg_qdisc_sfq.$(OBJEXT) tcmsg_qdisc_tbf.$(OBJEXT) \ tcmsg_filter.$(OBJEXT) tcmsg_filter_basic.$(OBJEXT) \ tcmsg_filter_cgroup.$(OBJEXT) tcmsg_filter_flow.$(OBJEXT) \ tcmsg_filter_fw.$(OBJEXT) tcmsg_filter_route.$(OBJEXT) \ tcmsg_filter_rsvp.$(OBJEXT) tcmsg_filter_tcindex.$(OBJEXT) \ tcmsg_filter_u32.$(OBJEXT) tcamsg.$(OBJEXT) \ tcamsg_csum.$(OBJEXT) tcamsg_gact.$(OBJEXT) \ tcamsg_mirred.$(OBJEXT) tcamsg_nat.$(OBJEXT) \ tcamsg_pedit.$(OBJEXT) tcamsg_police.$(OBJEXT) \ tcamsg_skbedit.$(OBJEXT) nield_OBJECTS = $(am_nield_OBJECTS) nield_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/debug.Po ./$(DEPDIR)/frhdr.Po \ ./$(DEPDIR)/ifamsg.Po ./$(DEPDIR)/ifimsg.Po \ ./$(DEPDIR)/ifimsg_bond.Po ./$(DEPDIR)/ifimsg_brport.Po \ ./$(DEPDIR)/ifimsg_gre.Po ./$(DEPDIR)/ifimsg_macvlan.Po \ ./$(DEPDIR)/ifimsg_vlan.Po ./$(DEPDIR)/ifimsg_vxlan.Po \ ./$(DEPDIR)/log.Po ./$(DEPDIR)/ndmsg.Po ./$(DEPDIR)/nield.Po \ ./$(DEPDIR)/nlmsg.Po ./$(DEPDIR)/rta.Po ./$(DEPDIR)/rtmsg.Po \ ./$(DEPDIR)/tcamsg.Po ./$(DEPDIR)/tcamsg_csum.Po \ ./$(DEPDIR)/tcamsg_gact.Po ./$(DEPDIR)/tcamsg_mirred.Po \ ./$(DEPDIR)/tcamsg_nat.Po ./$(DEPDIR)/tcamsg_pedit.Po \ ./$(DEPDIR)/tcamsg_police.Po ./$(DEPDIR)/tcamsg_skbedit.Po \ ./$(DEPDIR)/tcmsg_filter.Po ./$(DEPDIR)/tcmsg_filter_basic.Po \ ./$(DEPDIR)/tcmsg_filter_cgroup.Po \ ./$(DEPDIR)/tcmsg_filter_flow.Po \ ./$(DEPDIR)/tcmsg_filter_fw.Po \ ./$(DEPDIR)/tcmsg_filter_route.Po \ ./$(DEPDIR)/tcmsg_filter_rsvp.Po \ ./$(DEPDIR)/tcmsg_filter_tcindex.Po \ ./$(DEPDIR)/tcmsg_filter_u32.Po ./$(DEPDIR)/tcmsg_qdisc.Po \ ./$(DEPDIR)/tcmsg_qdisc_cbq.Po \ ./$(DEPDIR)/tcmsg_qdisc_choke.Po \ ./$(DEPDIR)/tcmsg_qdisc_codel.Po \ ./$(DEPDIR)/tcmsg_qdisc_drr.Po \ ./$(DEPDIR)/tcmsg_qdisc_dsmark.Po \ ./$(DEPDIR)/tcmsg_qdisc_fifo.Po \ ./$(DEPDIR)/tcmsg_qdisc_fq_codel.Po \ ./$(DEPDIR)/tcmsg_qdisc_gred.Po \ ./$(DEPDIR)/tcmsg_qdisc_hfsc.Po ./$(DEPDIR)/tcmsg_qdisc_htb.Po \ ./$(DEPDIR)/tcmsg_qdisc_multiq.Po \ ./$(DEPDIR)/tcmsg_qdisc_netem.Po \ ./$(DEPDIR)/tcmsg_qdisc_plug.Po \ ./$(DEPDIR)/tcmsg_qdisc_prio.Po ./$(DEPDIR)/tcmsg_qdisc_qfq.Po \ ./$(DEPDIR)/tcmsg_qdisc_red.Po ./$(DEPDIR)/tcmsg_qdisc_sfb.Po \ ./$(DEPDIR)/tcmsg_qdisc_sfq.Po ./$(DEPDIR)/tcmsg_qdisc_tbf.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(nield_SOURCES) DIST_SOURCES = $(nield_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ nield_SOURCES = \ nield.h \ list.h \ rtnetlink.h \ nield.c \ log.c \ debug.c \ nlmsg.c \ rta.c \ ifimsg.c \ ifimsg_brport.c \ ifimsg_vlan.c \ ifimsg_gre.c \ ifimsg_macvlan.c \ ifimsg_vxlan.c \ ifimsg_bond.c \ ndmsg.c \ ifamsg.c \ rtmsg.c \ frhdr.c \ tcmsg_qdisc.c \ tcmsg_qdisc_cbq.c \ tcmsg_qdisc_choke.c \ tcmsg_qdisc_codel.c \ tcmsg_qdisc_drr.c \ tcmsg_qdisc_dsmark.c \ tcmsg_qdisc_fifo.c \ tcmsg_qdisc_fq_codel.c \ tcmsg_qdisc_gred.c \ tcmsg_qdisc_hfsc.c \ tcmsg_qdisc_htb.c \ tcmsg_qdisc_multiq.c \ tcmsg_qdisc_netem.c \ tcmsg_qdisc_plug.c \ tcmsg_qdisc_prio.c \ tcmsg_qdisc_qfq.c \ tcmsg_qdisc_red.c \ tcmsg_qdisc_sfb.c \ tcmsg_qdisc_sfq.c \ tcmsg_qdisc_tbf.c \ tcmsg_filter.c \ tcmsg_filter_basic.c \ tcmsg_filter_cgroup.c \ tcmsg_filter_flow.c \ tcmsg_filter_fw.c \ tcmsg_filter_route.c \ tcmsg_filter_rsvp.c \ tcmsg_filter_tcindex.c \ tcmsg_filter_u32.c \ tcamsg.c \ tcamsg_csum.c \ tcamsg_gact.c \ tcamsg_mirred.c \ tcamsg_nat.c \ tcamsg_pedit.c \ tcamsg_police.c \ tcamsg_skbedit.c all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && $(am__rm_f) $$files clean-sbinPROGRAMS: -$(am__rm_f) $(sbin_PROGRAMS) nield$(EXEEXT): $(nield_OBJECTS) $(nield_DEPENDENCIES) $(EXTRA_nield_DEPENDENCIES) @rm -f nield$(EXEEXT) $(AM_V_CCLD)$(LINK) $(nield_OBJECTS) $(nield_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frhdr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifamsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg_bond.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg_brport.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg_gre.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg_macvlan.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg_vlan.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifimsg_vxlan.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ndmsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nield.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlmsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rta.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtmsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_csum.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_gact.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_mirred.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_nat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_pedit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_police.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcamsg_skbedit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_basic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_cgroup.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_flow.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_fw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_route.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_rsvp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_tcindex.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_filter_u32.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_cbq.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_choke.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_codel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_drr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_dsmark.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_fifo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_fq_codel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_gred.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_hfsc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_htb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_multiq.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_netem.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_plug.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_prio.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_qfq.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_red.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_sfb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_sfq.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcmsg_qdisc_tbf.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @: >>$@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/debug.Po -rm -f ./$(DEPDIR)/frhdr.Po -rm -f ./$(DEPDIR)/ifamsg.Po -rm -f ./$(DEPDIR)/ifimsg.Po -rm -f ./$(DEPDIR)/ifimsg_bond.Po -rm -f ./$(DEPDIR)/ifimsg_brport.Po -rm -f ./$(DEPDIR)/ifimsg_gre.Po -rm -f ./$(DEPDIR)/ifimsg_macvlan.Po -rm -f ./$(DEPDIR)/ifimsg_vlan.Po -rm -f ./$(DEPDIR)/ifimsg_vxlan.Po -rm -f ./$(DEPDIR)/log.Po -rm -f ./$(DEPDIR)/ndmsg.Po -rm -f ./$(DEPDIR)/nield.Po -rm -f ./$(DEPDIR)/nlmsg.Po -rm -f ./$(DEPDIR)/rta.Po -rm -f ./$(DEPDIR)/rtmsg.Po -rm -f ./$(DEPDIR)/tcamsg.Po -rm -f ./$(DEPDIR)/tcamsg_csum.Po -rm -f ./$(DEPDIR)/tcamsg_gact.Po -rm -f ./$(DEPDIR)/tcamsg_mirred.Po -rm -f ./$(DEPDIR)/tcamsg_nat.Po -rm -f ./$(DEPDIR)/tcamsg_pedit.Po -rm -f ./$(DEPDIR)/tcamsg_police.Po -rm -f ./$(DEPDIR)/tcamsg_skbedit.Po -rm -f ./$(DEPDIR)/tcmsg_filter.Po -rm -f ./$(DEPDIR)/tcmsg_filter_basic.Po -rm -f ./$(DEPDIR)/tcmsg_filter_cgroup.Po -rm -f ./$(DEPDIR)/tcmsg_filter_flow.Po -rm -f ./$(DEPDIR)/tcmsg_filter_fw.Po -rm -f ./$(DEPDIR)/tcmsg_filter_route.Po -rm -f ./$(DEPDIR)/tcmsg_filter_rsvp.Po -rm -f ./$(DEPDIR)/tcmsg_filter_tcindex.Po -rm -f ./$(DEPDIR)/tcmsg_filter_u32.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_cbq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_choke.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_codel.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_drr.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_dsmark.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_fifo.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_fq_codel.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_gred.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_hfsc.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_htb.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_multiq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_netem.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_plug.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_prio.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_qfq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_red.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_sfb.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_sfq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_tbf.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/debug.Po -rm -f ./$(DEPDIR)/frhdr.Po -rm -f ./$(DEPDIR)/ifamsg.Po -rm -f ./$(DEPDIR)/ifimsg.Po -rm -f ./$(DEPDIR)/ifimsg_bond.Po -rm -f ./$(DEPDIR)/ifimsg_brport.Po -rm -f ./$(DEPDIR)/ifimsg_gre.Po -rm -f ./$(DEPDIR)/ifimsg_macvlan.Po -rm -f ./$(DEPDIR)/ifimsg_vlan.Po -rm -f ./$(DEPDIR)/ifimsg_vxlan.Po -rm -f ./$(DEPDIR)/log.Po -rm -f ./$(DEPDIR)/ndmsg.Po -rm -f ./$(DEPDIR)/nield.Po -rm -f ./$(DEPDIR)/nlmsg.Po -rm -f ./$(DEPDIR)/rta.Po -rm -f ./$(DEPDIR)/rtmsg.Po -rm -f ./$(DEPDIR)/tcamsg.Po -rm -f ./$(DEPDIR)/tcamsg_csum.Po -rm -f ./$(DEPDIR)/tcamsg_gact.Po -rm -f ./$(DEPDIR)/tcamsg_mirred.Po -rm -f ./$(DEPDIR)/tcamsg_nat.Po -rm -f ./$(DEPDIR)/tcamsg_pedit.Po -rm -f ./$(DEPDIR)/tcamsg_police.Po -rm -f ./$(DEPDIR)/tcamsg_skbedit.Po -rm -f ./$(DEPDIR)/tcmsg_filter.Po -rm -f ./$(DEPDIR)/tcmsg_filter_basic.Po -rm -f ./$(DEPDIR)/tcmsg_filter_cgroup.Po -rm -f ./$(DEPDIR)/tcmsg_filter_flow.Po -rm -f ./$(DEPDIR)/tcmsg_filter_fw.Po -rm -f ./$(DEPDIR)/tcmsg_filter_route.Po -rm -f ./$(DEPDIR)/tcmsg_filter_rsvp.Po -rm -f ./$(DEPDIR)/tcmsg_filter_tcindex.Po -rm -f ./$(DEPDIR)/tcmsg_filter_u32.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_cbq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_choke.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_codel.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_drr.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_dsmark.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_fifo.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_fq_codel.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_gred.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_hfsc.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_htb.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_multiq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_netem.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_plug.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_prio.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_qfq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_red.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_sfb.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_sfq.Po -rm -f ./$(DEPDIR)/tcmsg_qdisc_tbf.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-sbinPROGRAMS cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-sbinPROGRAMS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% nield-0.6.2/src/debug.c000066400000000000000000000036571470100110300146310ustar00rootroot00000000000000/* * debug.c - debug function * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" static FILE *dbg_fd; /* * open a debug file */ int open_dbg(char *filename) { dbg_fd = fopen(filename, "a"); if(dbg_fd == NULL) { fprintf(stderr, "[Error] %s: fopen(): %s\n", __func__, strerror(errno)); fprintf(stderr, "[Error] %s: can't open debug file(%s)\n", __func__, filename); return(-1); } return(0); } /* * record debug messages */ void rec_dbg(int level, char *format, ...) { va_list ap; struct timeval tv; struct tm *tm; char msg[MAX_MSG_SIZE] = ""; char indent[MAX_STR_SIZE] = ""; int i; for(i = 0; i < level; i++) strncat(indent, " ", sizeof(indent)-1); va_start(ap, format); vsnprintf(msg, sizeof(msg), format, ap); gettimeofday(&tv, NULL); tm = localtime(&tv.tv_sec); fprintf(dbg_fd, "[%04d-%02d-%02d %02d:%02d:%02d.%06ld] %s%s\n", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec, indent, msg); fflush(dbg_fd); va_end(ap); } /* * close a debug file */ void close_dbg(void) { if(dbg_fd) fclose(dbg_fd); } nield-0.6.2/src/frhdr.c000066400000000000000000000275671470100110300146560ustar00rootroot00000000000000/* * frhdr.c - fib rule message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #ifdef HAVE_LINUX_FIB_RULES_H /* * parse fib rule message */ int parse_frhdr(struct nlmsghdr *nlh) { struct fib_rule_hdr *frh; int frh_len; struct rtattr *fra[__FRA_MAX]; char msg[148] = "", action[16] = ""; char *mp = msg; int log_opts = get_log_opts(); int res; /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get fib rule header */ frh_len = NLMSG_PAYLOAD(nlh, 0); if(frh_len < sizeof(*frh)) { rec_log("error: %s: fib_rule_hdr: length too short", __func__); return(1); } frh = (struct fib_rule_hdr *)NLMSG_DATA(nlh); /* parse fib rule attributes */ parse_frule(fra, nlh); /* debug fib_rule_hdr */ if(log_opts & L_DEBUG) debug_frhdr(0, frh, fra, frh_len); /* check address family */ if(frh->family == AF_INET) mp = add_log(msg, mp, "ipv4 "); else if(frh->family == AF_INET6) mp = add_log(msg, mp, "ipv6 "); else { rec_log("error: %s: unknown address family: %d", __func__, frh->family); return(1); } /* check message type */ if(nlh->nlmsg_type == RTM_NEWRULE) mp = add_log(msg, mp, "rule added: "); else if(nlh->nlmsg_type == RTM_DELRULE) mp = add_log(msg, mp, "rule deleted: "); else { rec_log("error: %s: unknown netlink message type: %d", __func__, nlh->nlmsg_type); return(1); } /* check route table id(other than local) */ if(frh->table == RT_TABLE_LOCAL) return(1); /* check whether invert rule or not */ if(frh->flags & FIB_RULE_INVERT) mp = add_log(msg, mp, "not "); /* get source prefix */ if(fra[FRA_SRC]) { char src[INET6_ADDRSTRLEN] = ""; res = inet_ntop_ifa(frh->family, fra[FRA_SRC], src, sizeof(src)); if(res) { rec_log("error: %s: FRA_SRC: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } mp = add_log(msg, mp, "from=%s/%d ", src, frh->src_len); } /* get egress interface index & name */ if(fra[FRA_IFNAME]) { char ifname[IFNAMSIZ]; if(!RTA_PAYLOAD(fra[FRA_IFNAME])) { rec_log("error: %s: FRA_IFNAME: no payload", __func__); return(1); } else if(RTA_PAYLOAD(fra[FRA_IFNAME]) > sizeof(ifname)) { rec_log("error: %s: FRA_IFNAME: payload too long", __func__); return(1); } memcpy(ifname, RTA_DATA(fra[FRA_IFNAME]), sizeof(ifname)); #ifdef FIB_RULE_IIF_DETACHED if(frh->flags & FIB_RULE_IIF_DETACHED) { mp = add_log(msg, mp, "in=%s(detached) ", ifname); return(0); } #endif mp = add_log(msg, mp, "in=%s ", ifname); } /* get tos value */ if(frh->tos) mp = add_log(msg, mp, "tos=0x%.2x ", frh->tos); /* get destination prefix */ if(fra[FRA_DST]) { char dst[INET6_ADDRSTRLEN] = ""; res = inet_ntop_ifa(frh->family, fra[FRA_DST], dst, sizeof(dst)); if(res) { rec_log("error: %s: FRA_DST: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } mp = add_log(msg, mp, "to=%s/%d ", dst, frh->dst_len); } #if HAVE_DECL_FRA_OIFNAME /* get egress interface index & name */ if(fra[FRA_OIFNAME]) { char oifname[IFNAMSIZ]; if(!RTA_PAYLOAD(fra[FRA_OIFNAME])) { rec_log("error: %s: FRA_OIFNAME: no payload", __func__); return(1); } else if(RTA_PAYLOAD(fra[FRA_OIFNAME]) > sizeof(oifname)) { rec_log("error: %s: FRA_OIFNAME: payload too long", __func__); return(1); } memcpy(oifname, RTA_DATA(fra[FRA_OIFNAME]), sizeof(oifname)); #ifdef FIB_RULE_OIF_DETACHED if(frh->flags & FIB_RULE_OIF_DETACHED) { mp = add_log(msg, mp, "out=%s(detached) ", oifname); return(0); } #endif mp = add_log(msg, mp, "out=%s ", oifname); } #endif /* get fwmark */ unsigned fwmark = 0; if(fra[FRA_FWMARK]) { if(RTA_PAYLOAD(fra[FRA_FWMARK]) < sizeof(fwmark)) { rec_log("error: %s: FRA_FWMARK: payload too short", __func__); return(1); } fwmark = *(unsigned *)RTA_DATA(fra[FRA_FWMARK]); } /* get fwmask */ unsigned fwmask = 0; if(fra[FRA_FWMASK]) { if(RTA_PAYLOAD(fra[FRA_FWMASK]) < sizeof(fwmask)) { rec_log("error: %s: FRA_FWMASK: payload too short", __func__); return(1); } fwmask = *(unsigned *)RTA_DATA(fra[FRA_FWMASK]); } if(fwmark || fwmask) { if(fwmask != 0xFFFFFFFF) mp = add_log(msg, mp, "fwmark=0x%x/0x%x ", fwmark, fwmask); else mp = add_log(msg, mp, "fwmark=0x%x ", fwmark); } /* get source and destination realms */ if(fra[FRA_FLOW]) { unsigned srcrlm; unsigned dstrlm; if(RTA_PAYLOAD(fra[FRA_FLOW]) < sizeof(srcrlm)) { rec_log("error: %s: FRA_FLOW: payload too short", __func__); return(1); } srcrlm = *(unsigned *)RTA_DATA(fra[FRA_FLOW]); srcrlm &= 0xFFFF; if(srcrlm) mp = add_log(msg, mp, "source-realm=%u ", srcrlm); dstrlm = srcrlm >> 16; mp = add_log(msg, mp, "destination-realm=%u ", dstrlm); } #if HAVE_DECL_FRA_GOTO /* get another rule to junmp to */ if(fra[FRA_GOTO]) { if(RTA_PAYLOAD(fra[FRA_GOTO]) < sizeof(unsigned)) { rec_log("error: %s: FRA_GOTO: payload too short", __func__); return(1); } mp = add_log(msg, mp, "goto=%u ", *(unsigned *)RTA_DATA(fra[FRA_GOTO])); } #endif /* convert route table name */ if(fra[FRA_TABLE]) { unsigned table_id = *(unsigned *)RTA_DATA(fra[FRA_TABLE]); char table[16] = ""; if(RTA_PAYLOAD(fra[FRA_TABLE]) < sizeof(unsigned)) { rec_log("error: %s: FRA_TABLE: payload too short", __func__); return(1); } snprintf(table, sizeof(table), "%s", conv_rt_table(table_id, 0)); if(!strncmp(table, "unknown", sizeof(table))) mp = add_log(msg, mp, "table=%u ", table_id); else mp = add_log(msg, mp, "table=%s ", table); } /* get fib rule priority */ if(fra[FRA_PRIORITY]) { if(RTA_PAYLOAD(fra[FRA_PRIORITY]) < sizeof(unsigned)) { rec_log("error: %s: FRA_PRIORITY: payload too short", __func__); return(1); } mp = add_log(msg, mp, "priority=%u ", *(unsigned *)RTA_DATA(fra[FRA_PRIORITY])); } /* convert fib rule action */ snprintf(action, sizeof(action), "%s", conv_fr_act(frh->action, 0)); /* logging fib rule */ if(frh->flags & FIB_RULE_UNRESOLVED) rec_log("%saction=%s(unresolved)", msg, action); else rec_log("%saction=%s", msg, action); return(0); } /* * debugging fib rule message */ void debug_frhdr(int lev, struct fib_rule_hdr *frh, struct rtattr *fra[], int frh_len) { char flags_list[MAX_STR_SIZE] = ""; conv_fib_rule_flags(frh->flags, flags_list, sizeof(flags_list)); /* debug frhdr */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ fib_rule_hdr(%d) ]", NLMSG_ALIGN(sizeof(struct fib_rule_hdr))); rec_dbg(lev, " family(%d): %d(%s)", sizeof(frh->family), frh->family, conv_af_type(frh->family, 1)); rec_dbg(lev, " dst_len(%d): %d", sizeof(frh->dst_len), frh->dst_len); rec_dbg(lev, " src_len(%d): %d", sizeof(frh->src_len), frh->src_len); rec_dbg(lev, " tos(%d): 0x%.2x", sizeof(frh->tos), frh->tos); rec_dbg(lev, " table(%d): %d", sizeof(frh->table), frh->table); rec_dbg(lev, " res1(%d): %d", sizeof(frh->res1), frh->res1); rec_dbg(lev, " res2(%d): %d", sizeof(frh->res2), frh->res2); rec_dbg(lev, " action(%d): %d(%s)", sizeof(frh->action), frh->action, conv_fr_act(frh->action, 1)); rec_dbg(lev, " flags(%d): %u(%s)", sizeof(frh->flags), frh->flags, flags_list); /* debug fib rule attributes */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ fib_rule_hdr attributes(%d) ]", NLMSG_ALIGN(frh_len - NLMSG_ALIGN(sizeof(struct fib_rule_hdr)))); if(fra[FRA_DST]) debug_rta_af(lev+1, fra[FRA_DST], "FRA_DST", frh->family); if(fra[FRA_SRC]) debug_rta_af(lev+1, fra[FRA_SRC], "FRA_SRC", frh->family); if(fra[FRA_IFNAME]) debug_rta_str(lev+1, fra[FRA_IFNAME], "FRA_IFNAME", NULL, IFNAMSIZ); #if HAVE_DECL_FRA_GOTO if(fra[FRA_GOTO]) debug_rta_u32(lev+1, fra[FRA_GOTO], "FRA_GOTO", NULL); #endif if(fra[FRA_PRIORITY]) debug_rta_u32(lev+1, fra[FRA_PRIORITY], "FRA_PRIORITY", NULL); if(fra[FRA_FWMARK]) debug_rta_u32(lev+1, fra[FRA_FWMARK], "FRA_FWMARK", NULL); if(fra[FRA_FLOW]) debug_rta_u32x(lev+1, fra[FRA_FLOW], "FRA_FLOW", NULL); if(fra[FRA_TABLE]) debug_rta_s32(lev+1, fra[FRA_TABLE], "FRA_TABLE", conv_rt_table); if(fra[FRA_FWMASK]) debug_rta_u32(lev+1, fra[FRA_FWMASK], "FRA_FWMASK", NULL); #if HAVE_DECL_FRA_OIFNAME if(fra[FRA_OIFNAME]) debug_rta_str(lev+1, fra[FRA_OIFNAME], "FRA_OIFNAME", NULL, IFNAMSIZ); #endif rec_dbg(lev, ""); } /* * convert frh->action from number to string */ const char *conv_fr_act(int action, unsigned char debug) { #define _FR_ACT(s1, s2) \ if(action == FR_ACT_##s1) \ return(debug ? #s1 : #s2); _FR_ACT(UNSPEC, none); _FR_ACT(TO_TBL, to_tbl); #if HAVE_DECL_FR_ACT_GOTO _FR_ACT(GOTO, goto); #endif #if HAVE_DECL_FR_ACT_NOP _FR_ACT(NOP, nop); #endif #if HAVE_DECL_FR_ACT_RES1 _FR_ACT(RES1, res1); #endif #if HAVE_DECL_FR_ACT_RES2 _FR_ACT(RES2, res2); #endif _FR_ACT(RES3, res3); _FR_ACT(RES4, res4); _FR_ACT(BLACKHOLE, blackhole); _FR_ACT(UNREACHABLE, unreachable); _FR_ACT(PROHIBIT, prohibit); #undef _FR_ACT return(debug ? "UNKNOWN" : "unknown"); } /* * convert frh->flags from number to string */ void conv_fib_rule_flags(int flags, char *flags_list, int len) { if(!flags) { strncpy(flags_list, "NONE", len); return; } #define _FIB_RULE_FLAGS(s) \ if((flags & FIB_RULE_##s) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~FIB_RULE_##s) ? \ strncat(flags_list, #s ",", len - strlen(flags_list) - 1) : \ strncat(flags_list, #s, len - strlen(flags_list) - 1); _FIB_RULE_FLAGS(PERMANENT); #ifdef FIB_RULE_INVERT _FIB_RULE_FLAGS(INVERT); #endif #ifdef FIB_RULE_UNRESOLVED _FIB_RULE_FLAGS(UNRESOLVED); #endif #ifdef FIB_RULE_IIF_DETACHED _FIB_RULE_FLAGS(IIF_DETACHED); #endif #ifdef FIB_RULE_OIF_DETACHED _FIB_RULE_FLAGS(OIF_DETACHED); #endif #undef _FIB_RULE_FLAGS if(!strlen(flags_list)) strncpy(flags_list, "UNKNOWN", len); } #endif nield-0.6.2/src/ifamsg.c000066400000000000000000000225361470100110300150060ustar00rootroot00000000000000/* * ifamsg.c - interface address message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse interface address message */ int parse_ifamsg(struct nlmsghdr *nlh) { struct ifaddrmsg *ifam; int ifam_len; struct rtattr *ifa[__IFA_MAX]; char paddr[INET6_ADDRSTRLEN+1] = ""; char laddr[INET6_ADDRSTRLEN+1] = ""; char ifname[IFNAMSIZ] = ""; char iflabel[IFNAMSIZ] = ""; char msg[MAX_MSG_SIZE] = ""; char *mp = msg; unsigned short iftype = -1; int log_opts = get_log_opts(); int res; /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get ifaddrmsg */ ifam_len = NLMSG_PAYLOAD(nlh, 0); if(ifam_len < sizeof(*ifam)) { rec_log("error: %s: ifaddrmsg: length too short", __func__); return(1); } ifam = (struct ifaddrmsg *)NLMSG_DATA(nlh); /* parse interface address attributes */ parse_ifaddr(ifa, nlh); /* debug ifaddrmsg */ if(log_opts & L_DEBUG) debug_ifamsg(0, ifam, ifa, ifam_len); /* check address family & set message type */ if(ifam->ifa_family == AF_INET) { mp = add_log(msg, mp, "ipv4 "); } else if(ifam->ifa_family == AF_INET6) { mp = add_log(msg, mp, "ipv6 "); } else { rec_log("error: %s: unknown address family: %d", __func__, ifam->ifa_family); return(1); } /* get interface index & name */ if_indextoname_from_lists(ifam->ifa_index, ifname); if(nlh->nlmsg_type == RTM_NEWADDR) mp = add_log(msg, mp, "address added: "); else if(nlh->nlmsg_type == RTM_DELADDR) mp = add_log(msg, mp, "address deleted: "); else { rec_log("error: %s: unknown nlmsg_type: %d", __func__, nlh->nlmsg_type); return(1); } /* get interface type */ iftype = get_type_from_iflist(ifam->ifa_index); if(!iftype) iftype = get_type_from_ifhist(ifam->ifa_index); /* get prefix address */ if(ifa[IFA_ADDRESS]) { res = inet_ntop_ifa(ifam->ifa_family, ifa[IFA_ADDRESS], paddr, sizeof(paddr)); if(res) { rec_log("error: %s: IFA_ADDRESS(ifindex %d): %s", __func__, ifam->ifa_index, (res == 1) ? strerror(errno) : "payload too short"); return(1); } } /* get local interface address */ if(ifa[IFA_LOCAL]) { res = inet_ntop_ifa(ifam->ifa_family, ifa[IFA_LOCAL], laddr, sizeof(laddr)); if(res) { rec_log("error: %s: IFA_LOCAL(ifindex %d): %s", __func__, ifam->ifa_index, (res == 1) ? strerror(errno) : "payload too short"); return(1); } } /* whether interface type is P2P */ if(ifa[IFA_LOCAL] && strcmp(laddr, paddr)) mp = add_log(msg, mp, "interface=%s local=%s/%d peer=%s/%d ", ifname, laddr, ifam->ifa_prefixlen, paddr, ifam->ifa_prefixlen); else mp = add_log(msg, mp, "interface=%s ip=%s/%d ", ifname, paddr, ifam->ifa_prefixlen); /* get scope of address */ mp = add_log(msg, mp, "socpe=%s ", conv_ifa_scope(ifam->ifa_scope, 0)); /* get interface label */ if(ifa[IFA_LABEL]) { if(RTA_PAYLOAD(ifa[IFA_LABEL]) > sizeof(iflabel)) { rec_log("error: %s: IFA_LABEL(ifindex %d): no payload", __func__, ifam->ifa_index); return(1); } else if(RTA_PAYLOAD(ifa[IFA_LABEL]) > sizeof(iflabel)) { rec_log("error: %s: IFA_LABEL(ifindex %d): payload too long", __func__, ifam->ifa_index); return(1); } memcpy(iflabel, RTA_DATA(ifa[IFA_LABEL]), IFNAMSIZ); if(strcmp(iflabel, ifname)) mp = add_log(msg, mp, "label=%s ", iflabel); } if(ifa[IFA_CACHEINFO] && nlh->nlmsg_type == RTM_NEWADDR) { struct ifa_cacheinfo *ifac; if(RTA_PAYLOAD(ifa[IFA_CACHEINFO]) < sizeof(*ifac)) { rec_log("error: %s: IFA_CACHEINFO(ifindex %d): payload too short", __func__, ifam->ifa_index); return(1); } ifac = (struct ifa_cacheinfo *)RTA_DATA(ifa[IFA_CACHEINFO]); /* logging only when created not updated */ if(ifac->cstamp != ifac->tstamp) return(1); } /* logging interface address message */ rec_log("%s", msg); return(0); } /* * debug interface address message */ void debug_ifamsg(int lev, struct ifaddrmsg *ifam, struct rtattr *ifa[], int ifam_len) { /* debug ifaddrmsg */ char flags_list[MAX_STR_SIZE] = ""; char ifname[IFNAMSIZ] = ""; conv_ifa_flags(ifam->ifa_flags, flags_list, sizeof(flags_list)); if_indextoname_from_lists(ifam->ifa_index, ifname); rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ ifaddrmsg(%d) ]", NLMSG_ALIGN(sizeof(struct ifaddrmsg))); rec_dbg(lev, " ifa_family(%d): %d(%s)", sizeof(ifam->ifa_family), ifam->ifa_family, conv_af_type(ifam->ifa_family, 1)); rec_dbg(lev, " ifa_prefixlen(%d): %d", sizeof(ifam->ifa_prefixlen), ifam->ifa_prefixlen); rec_dbg(lev, " ifa_flags(%d): 0x%x(%s)", sizeof(ifam->ifa_flags), ifam->ifa_flags, flags_list); rec_dbg(lev, " ifa_scope(%d): %d(%s)", sizeof(ifam->ifa_scope), ifam->ifa_scope, conv_ifa_scope(ifam->ifa_scope, 1)); rec_dbg(lev, " ifa_index(%d): %u(%s)", sizeof(ifam->ifa_index), ifam->ifa_index, ifname); /* debug interface address attributes */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ ifaddrmsg attributes(%d) ]", NLMSG_ALIGN(ifam_len - NLMSG_ALIGN(sizeof(struct ifaddrmsg)))); if(ifa[IFA_ADDRESS]) debug_rta_af(lev+1, ifa[IFA_ADDRESS], "IFA_ADDRESS", ifam->ifa_family); if(ifa[IFA_LOCAL]) debug_rta_af(lev+1, ifa[IFA_LOCAL], "IFA_LOCAL", ifam->ifa_family); if(ifa[IFA_LABEL]) debug_rta_str(lev+1, ifa[IFA_LABEL], "IFA_LABEL", NULL, IFNAMSIZ); if(ifa[IFA_BROADCAST]) debug_rta_af(lev+1, ifa[IFA_BROADCAST], "IFA_BROADCAST", ifam->ifa_family); if(ifa[IFA_ANYCAST]) debug_rta_af(lev+1, ifa[IFA_ANYCAST], "IFA_ANYCAST", ifam->ifa_family); if(ifa[IFA_CACHEINFO]) debug_ifa_cacheinfo(lev+1, ifa[IFA_CACHEINFO], "IFA_CACHEINFO"); if(ifa[IFA_MULTICAST]) debug_rta_af(lev+1, ifa[IFA_MULTICAST], "IFA_MULTICAST", ifam->ifa_family); rec_dbg(lev, ""); return; } /* * debug attribute IFA_CACHEINFO */ void debug_ifa_cacheinfo(int lev, struct rtattr *ifa, const char *name) { struct ifa_cacheinfo *ifac; if(debug_rta_len_chk(lev, ifa, name, sizeof(*ifac))) return; ifac = (struct ifa_cacheinfo *)RTA_DATA(ifa); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(ifa->rta_len)); rec_dbg(lev, " [ ifa_cacheinfo(%d) ]", sizeof(struct ifa_cacheinfo)); rec_dbg(lev, " ifa_prefered(%d): 0x%x", sizeof(ifac->ifa_prefered), ifac->ifa_prefered); rec_dbg(lev, " ifa_valid(%d): 0x%x", sizeof(ifac->ifa_valid), ifac->ifa_valid); rec_dbg(lev, " cstamp(%d): %u", sizeof(ifac->cstamp), ifac->cstamp); rec_dbg(lev, " tstamp(%d): %u", sizeof(ifac->tstamp), ifac->tstamp); } /* * convert interface address flags from number to string */ void conv_ifa_flags(int flags, char *flags_list, int len) { if(!flags) { strncpy(flags_list, "NONE", len); return; } #define _IFA_FLAGS(f) \ if((flags & IFA_F_##f) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~IFA_F_##f) ? \ strncat(flags_list, #f ",", len - strlen(flags_list) - 1) : \ strncat(flags_list, #f, len - strlen(flags_list) - 1); _IFA_FLAGS(SECONDARY); _IFA_FLAGS(TEMPORARY); #ifdef IFA_F_NODAD _IFA_FLAGS(NODAD); #endif _IFA_FLAGS(OPTIMISTIC); #ifdef IFA_F_DADFAILED _IFA_FLAGS(DADFAILED); #endif #ifdef IFA_F_HOMEADDRESS _IFA_FLAGS(HOMEADDRESS); #endif _IFA_FLAGS(DEPRECATED); _IFA_FLAGS(TENTATIVE); _IFA_FLAGS(PERMANENT); #undef _IFA_FLAGS if(!strlen(flags_list)) strncpy(flags_list, "UNKNOWN", len); } /* * convert interface address scope from number to string */ const char *conv_ifa_scope(int scope, unsigned char debug) { #define _IFA_SCOPE(s1, s2) \ if(scope == RT_SCOPE_##s1) \ return(debug ? #s1 : #s2); _IFA_SCOPE(UNIVERSE, global); _IFA_SCOPE(SITE, site); _IFA_SCOPE(LINK, link); _IFA_SCOPE(HOST, host); _IFA_SCOPE(NOWHERE, none); #undef _IFA_SCOPE return(debug ? "UNKNOWN" : "unknown"); } nield-0.6.2/src/ifimsg.c000066400000000000000000001354061470100110300150170ustar00rootroot00000000000000/* * ifimsg.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #define HIST_MAX 64 /* top of interface list and history */ static struct list_head lhead = {&lhead, &lhead}; static struct list_head hhead = {&hhead, &hhead}; /* * search an entry in an interface list */ static inline struct iflist_entry *search_iflist(int index) { struct list_head *l; list_for_each(l, &lhead) { struct iflist_entry *e; e = list_entry(l, struct iflist_entry, list); if(e->index == index) return(e); } return(NULL); } /* * add an entry into an interface list */ static inline void add_iflist_entry(struct list_head *l) { list_init(l); list_add(l, &lhead); return; } /* * [not in use] * delete an entry in an interface list */ static inline void del_iflist_entry(int index) { struct list_head *l, *n; list_for_each_safe(l, n, &lhead) { struct iflist_entry *e; e = list_entry(l, struct iflist_entry, list); if(e->index == index) { list_del(l); free(e); } } return; } /* * move an entry in an interface list to an interface history */ static inline void move_iflist_entry(int index) { struct list_head *l, *n; list_for_each_safe(l, n, &lhead) { struct iflist_entry *e; e = list_entry(l, struct iflist_entry, list); if(e->index == index) { list_move(l, &hhead); break; } } return; } /* * delete an old entry in an interface history */ static inline void del_ifhist_entry(void) { struct list_head *l, *n; int i = 0; list_for_each_safe(l, n, &hhead) { struct iflist_entry *e; if(++i > HIST_MAX) { e = list_entry(l, struct iflist_entry, list); list_del(l); free(e); break; } } return; } /* * search an entry in an interface history */ static inline struct iflist_entry *search_ifhist(int index) { struct list_head *l; list_for_each(l, &hhead) { struct iflist_entry *e; e = list_entry(l, struct iflist_entry, list); if(e->index == index) return(e); } return(NULL); } /* * conv an interface index to name in lists */ char *if_indextoname_from_lists(int index, char *name) { /* from kernel */ if(if_indextoname(index, name)) return(name); /* from interface list */ if(if_indextoname_from_iflist(index, name)) return(name); /* from interface history */ if(if_indextoname_from_ifhist(index, name)) snprintf(name, IFNAMSIZ, "(unknown %d)", index); return(name); } /* * conv an interface index to name in an interface list */ char *if_indextoname_from_iflist(int index, char *name) { struct iflist_entry *e = search_iflist(index); if(!e) return(NULL); strncpy(name, e->name, sizeof(e->name)); return(name); } /* * conv an interface index to name in an inetrface history */ char *if_indextoname_from_ifhist(int index, char *name) { struct iflist_entry *e = search_ifhist(index); if(!e) return(NULL); strncpy(name, e->name, sizeof(e->name)); return(name); } /* * get an interface type in an interface list */ unsigned short get_type_from_iflist(int index) { struct iflist_entry *e = search_iflist(index); if(!e) return(0); return(e->type); } /* * get an interface type in an interface history */ unsigned short get_type_from_ifhist(int index) { struct iflist_entry *e = search_ifhist(index); if(!e) return(0); return(e->type); } /* * print an interface list */ void print_iflist(int num) { struct list_head *head = NULL; struct list_head *l; FILE *iflist; char fname[MAX_STR_SIZE] = ""; char title[MAX_STR_SIZE] = ""; switch(num) { case 1: head = &lhead; strncpy(fname, IFLIST_FILE, sizeof(fname)); strncpy(title, "interface list", sizeof(fname)); break; case 2: head = &hhead; strncpy(fname, IFHIST_FILE, sizeof(fname)); strncpy(title, "interface history", sizeof(fname)); break; default: return; } iflist = fopen(fname, "w"); if(iflist == NULL) { rec_log("error: %s: can't open iflist file(%s)", __func__, fname); return; } fprintf(iflist, "\n"); fprintf(iflist, "*********************************************************************\n"); fprintf(iflist, "[ %s ]\n", title); list_for_each(l, head) { struct iflist_entry *e; e = list_entry(l, struct iflist_entry, list); fprintf(iflist, "%s[%d]: address %s\n", e->name, e->index, e->addr); fprintf(iflist, "%s[%d]: broadcast %s\n", e->name, e->index, e->brd); fprintf(iflist, "%s[%d]: flags %s\n", e->name, e->index, conv_iff_flags(e->flags, 1)); fprintf(iflist, "%s[%d]: type %s\n", e->name, e->index, conv_arphrd_type(e->type, 1)); fprintf(iflist, "%s[%d]: vlan %hu\n", e->name, e->index, e->vid); fprintf(iflist, "%s[%d]: mtu %hu\n", e->name, e->index, e->mtu); fprintf(iflist, "%s[%d]: kind %s\n", e->name, e->index, strlen(e->kind) ? e->kind : "no"); fprintf(iflist, "%s[%d]: master %s[%d]\n", e->name, e->index, strlen(e->name_master) ? e->name_master : "none" , e->index_master); fprintf(iflist, "%s[%d]: bridge-attached %s\n", e->name, e->index, e->br_attached ? "yes" : "no"); #if HAVE_DECL_IFLA_BRPORT_UNSPEC fprintf(iflist, "%s[%d]: bridge-port-state %s\n", e->name, e->index, conv_br_state(e->br_state, 0)); #endif } fclose(iflist); return; } /* * create an interface list */ int create_iflist(struct msghdr *msg) { struct nlmsghdr *nlh; int nlh_len; struct ifinfomsg *ifim; int ifim_len; struct rtattr *ifla[__IFLA_MAX]; struct iflist_entry *ifle; int log_opts = get_log_opts(); /* get netlink message header */ nlh = msg->msg_iov->iov_base; nlh_len = msg->msg_iov->iov_len; /* parse netlink message header */ for( ; NLMSG_OK(nlh, nlh_len); nlh = NLMSG_NEXT(nlh, nlh_len)) { /* whether netlink message header ends or not */ if(nlh->nlmsg_type == NLMSG_DONE) return(1); /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get ifinfomsg */ ifim_len = NLMSG_PAYLOAD(nlh, 0); if(ifim_len < sizeof(*ifim)) { rec_log("error: %s: ifinfomsg: length too short", __func__); continue; } ifim = (struct ifinfomsg *)NLMSG_DATA(nlh); /* parse interface infomation attributes */ parse_ifinfo(ifla, nlh); /* debug ifinfomsg */ if(log_opts & L_DEBUG) debug_ifimsg(0, ifim, ifla, ifim_len); /* check bridge interface */ if(ifim->ifi_family == PF_BRIDGE) { ifle = search_iflist(ifim->ifi_index); if(ifle) ifle->br_attached = 1; } /* check protocol family(PF_UNSPEC only) */ if(ifim->ifi_family != PF_UNSPEC) continue; /* create interface list */ ifle = (struct iflist_entry *)malloc(sizeof(struct iflist_entry)); if(ifle == NULL) { rec_log("error: %s: malloc(): failed", __func__); return(-1); } memset(ifle, 0, sizeof(struct iflist_entry)); list_init(&(ifle->list)); ifle->index = ifim->ifi_index; ifle->flags = ifim->ifi_flags; ifle->type = ifim->ifi_type; ifle->br_state = 255; /* get interface name */ if(ifla[IFLA_IFNAME]) if(parse_ifla_ifname(NULL, NULL, ifla[IFLA_IFNAME], ifle)) { free(ifle); continue; } /* get interface address */ if(ifla[IFLA_ADDRESS]) if(parse_ifla_address(NULL, NULL, ifla[IFLA_ADDRESS], ifle)) { free(ifle); continue; } /* get broadcast address */ if(ifla[IFLA_BROADCAST]) if(parse_ifla_broadcast(NULL, NULL, ifla[IFLA_BROADCAST], ifle)) { free(ifle); continue; } #if HAVE_DECL_IFLA_LINKINFO /* get interface information */ if(ifla[IFLA_LINKINFO]) if(parse_ifla_linkinfo(NULL, NULL, ifla[IFLA_LINKINFO], ifle)) { free(ifle); continue; } #endif /* get interface MTU */ if(ifla[IFLA_MTU]) if(parse_ifla_mtu(NULL, NULL, ifla[IFLA_MTU], ifle)) { free(ifle); continue; } /* get master interface */ if(ifla[IFLA_MASTER]) if(parse_ifla_master(NULL, NULL, ifla[IFLA_MASTER], ifle)) { free(ifle); continue; } /* get interface protocol information */ if(ifla[IFLA_PROTINFO]) if(parse_ifla_protinfo(ifla[IFLA_PROTINFO], ifle, ifim->ifi_family)) { free(ifle); continue; } /* add interface list */ list_add(&(ifle->list), &lhead); } return(0); } /* * parse interface information message */ int parse_ifimsg(struct nlmsghdr *nlh) { struct ifinfomsg *ifim; int ifim_len; struct rtattr *ifla[__IFLA_MAX]; struct iflist_entry *ifle_tmp, *ifle; char msg[MAX_MSG_SIZE] = ""; char *mp = msg; int log_opts = get_log_opts(); /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get ifinfomsg */ ifim_len = NLMSG_PAYLOAD(nlh, 0); if(ifim_len < sizeof(*ifim)) { rec_log("error: %s: ifinfomsg: length too short", __func__); return(1); } ifim = (struct ifinfomsg *)NLMSG_DATA(nlh); /* parse interface infomation message attributes */ parse_ifinfo(ifla, nlh); /* debug ifinfomsg */ if(log_opts & L_DEBUG) debug_ifimsg(0, ifim, ifla, ifim_len); /* create new interface list entry */ ifle_tmp = malloc(sizeof(struct iflist_entry)); if(!ifle_tmp) { rec_log("error: %s: malloc() failed", __func__); return(1); } memset(ifle_tmp, 0, sizeof(struct iflist_entry)); list_init(&(ifle_tmp->list)); ifle_tmp->index = ifim->ifi_index; ifle_tmp->flags = ifim->ifi_flags; ifle_tmp->type = ifim->ifi_type; ifle_tmp->br_state = 255; /* get interface name */ if(ifla[IFLA_IFNAME]) if(parse_ifla_ifname(msg, &mp, ifla[IFLA_IFNAME], ifle_tmp)) { free(ifle_tmp); return(1); } /* get physical interface */ if(ifla[IFLA_LINK]) if(parse_ifla_link(msg, &mp, ifla[IFLA_LINK], ifle_tmp)) { free(ifle_tmp); return(1); } /* get interface address */ if(ifla[IFLA_ADDRESS]) if(parse_ifla_address(msg, &mp, ifla[IFLA_ADDRESS], ifle_tmp)) { free(ifle_tmp); return(1); } /* get broadcast address */ if(ifla[IFLA_BROADCAST]) if(parse_ifla_broadcast(msg, &mp, ifla[IFLA_BROADCAST], ifle_tmp)) { free(ifle_tmp); return(1); } /* get interface MTU */ if(ifla[IFLA_MTU]) if(parse_ifla_mtu(msg, &mp, ifla[IFLA_MTU], ifle_tmp)) { free(ifle_tmp); return(1); } #if HAVE_DECL_IFLA_LINKINFO /* get interface information */ if(ifla[IFLA_LINKINFO]) if(parse_ifla_linkinfo(msg, &mp, ifla[IFLA_LINKINFO], ifle_tmp)) { free(ifle_tmp); return(1); } #endif /* get master interface */ if(ifla[IFLA_MASTER]) if(parse_ifla_master(msg, &mp, ifla[IFLA_MASTER], ifle_tmp)) { free(ifle_tmp); return(1); } /* get interface protocol information */ if(ifla[IFLA_PROTINFO]) if(parse_ifla_protinfo(ifla[IFLA_PROTINFO], ifle_tmp, ifim->ifi_family)) { free(ifle_tmp); return(1); } /* check RTM message(only RTM_NEWLINK or RTMDELLINK) */ if((nlh->nlmsg_type != RTM_NEWLINK) && (nlh->nlmsg_type != RTM_DELLINK)) { rec_log("error: %s: unknown nlmsg_type: %d", __func__, nlh->nlmsg_type); free(ifle_tmp); return(0); } /* search interface list entry */ ifle = search_iflist(ifle_tmp->index); #if HAVE_DECL_IFLA_BRPORT_UNSPEC /* check protocol family(PF_BRIDGE only) & nlmsg_type */ if(ifim->ifi_family == PF_BRIDGE) /* workaround: "ovs-vsctl add-br" command */ if(ifle_tmp->index != ifle_tmp->index_master) if(nlh->nlmsg_type == RTM_NEWLINK) parse_rtm_newlink_bridge(ifle, ifle_tmp, ifla); else if(nlh->nlmsg_type == RTM_DELLINK) parse_rtm_dellink_bridge(ifle); #endif /* check protocol family(PF_UNSPEC only) */ if(ifim->ifi_family != PF_UNSPEC) { free(ifle_tmp); return(0); } /* check nlmsg_type */ if(nlh->nlmsg_type == RTM_NEWLINK) parse_rtm_newlink(msg, ifle, ifle_tmp, ifla); else if(nlh->nlmsg_type == RTM_DELLINK) parse_rtm_dellink(msg, ifle, ifle_tmp); return(0); } /* * parse RTM_NEWLINK */ void parse_rtm_newlink(char *msg, struct iflist_entry *ifle, struct iflist_entry *ifle_tmp, struct rtattr *ifla[]) { if(ifle) { /* check bonding interface */ if(!(ifle->flags & IFF_SLAVE) && (ifle_tmp->flags & IFF_SLAVE)) { rec_log("interface %s attached to bonding %s", ifle_tmp->name, ifle_tmp->name_master); strncpy(ifle->name_master, ifle_tmp->name_master, sizeof(ifle->name_master)); } else if((ifle->flags & IFF_SLAVE) && !(ifle_tmp->flags & IFF_SLAVE)) { rec_log("interface %s detached from bonding %s", ifle_tmp->name, ifle->name_master); strncpy(ifle->name_master, "", sizeof(ifle->name_master)); } /* check administrative status */ if((ifle->flags & IFF_UP) && !(ifle_tmp->flags & IFF_UP)) rec_log("interface %s state changed to disabled", ifle_tmp->name); else if(!(ifle->flags & IFF_UP) && (ifle_tmp->flags & IFF_UP)) rec_log("interface %s state changed to enabled", ifle_tmp->name); /* check operational status */ if((ifle->flags & IFF_RUNNING) && !(ifle_tmp->flags & IFF_RUNNING)) rec_log("interface %s state changed to down", ifle_tmp->name); else if(!(ifle->flags & IFF_RUNNING) && (ifle_tmp->flags & IFF_RUNNING)) rec_log("interface %s state changed to up", ifle_tmp->name); /* check promiscuous status */ if((ifle->flags & IFF_PROMISC) && !(ifle_tmp->flags & IFF_PROMISC)) rec_log("interface %s left promiscuous mode", ifle_tmp->name); else if(!(ifle->flags & IFF_PROMISC) && (ifle_tmp->flags & IFF_PROMISC)) rec_log("interface %s entered promiscuous mode", ifle_tmp->name); ifle->flags = ifle_tmp->flags; /* check interface name */ if(ifla[IFLA_IFNAME]) { if(strncmp(ifle->name, ifle_tmp->name, IFNAMSIZ)) { rec_log("interface name changed from %s to %s", ifle->name, ifle_tmp->name); strncpy(ifle->name, ifle_tmp->name, IFNAMSIZ); } } /* check interface address */ if(ifla[IFLA_ADDRESS]) { if(memcmp(ifle->addr, ifle_tmp->addr, sizeof(ifle->addr))) { switch(ifle_tmp->type) { case ARPHRD_TUNNEL: case ARPHRD_IPGRE: case ARPHRD_SIT: case ARPHRD_TUNNEL6: #ifdef ARPHRD_IP6GRE case ARPHRD_IP6GRE: #endif rec_log("interface %s local address changed from %s to %s", ifle->name, ifle->addr, ifle_tmp->addr); break; default: rec_log("interface %s link layer address changed from %s to %s", ifle->name, ifle->addr, ifle_tmp->addr); } memcpy(ifle->addr, ifle_tmp->addr, sizeof(ifle->addr)); } } /* check broadcast address */ if(ifla[IFLA_BROADCAST]) { if(memcmp(ifle->brd, ifle_tmp->brd, sizeof(ifle->brd))) { switch(ifle_tmp->type) { case ARPHRD_TUNNEL: case ARPHRD_IPGRE: case ARPHRD_SIT: case ARPHRD_TUNNEL6: #ifdef ARPHRD_IP6GRE case ARPHRD_IP6GRE: #endif rec_log("interface %s remote address changed from %s to %s", ifle->name, ifle->brd, ifle_tmp->brd); break; } memcpy(ifle->brd, ifle_tmp->brd, sizeof(ifle->brd)); } } ifle->type = ifle_tmp->type; /* check interface MTU */ if(ifla[IFLA_MTU]) { if(ifle->mtu != ifle_tmp->mtu) { rec_log("interface %s mtu changed from %d to %d", ifle->name, ifle->mtu, ifle_tmp->mtu); ifle->mtu = ifle_tmp->mtu; } } /* check interface vlan id */ if(ifle->vid != ifle_tmp->vid) { rec_log("interface %s vlan id changed from %hu to %hu", ifle->name, ifle->vid, ifle_tmp->vid); ifle->vid = ifle_tmp->vid; } /* check master interface */ if(ifle->index_master != ifle_tmp->index_master) { ifle->index_master = ifle_tmp->index_master; } free(ifle_tmp); } else { /* add interface list entry*/ add_iflist_entry(&(ifle_tmp->list)); /* check interface state */ char state[MAX_STR_SIZE] = ""; /* check administrative state */ (ifle_tmp->flags & IFF_UP) ? strcpy(state, "enabled,") : strcpy(state, "disabled,"); /* check operational state */ (ifle_tmp->flags & IFF_RUNNING) ? strcat(state, "linkup") : strcat(state, "linkdown"); rec_log("interface added: %sstate=%s", msg, state); } return; } /* * parse RTM_DEL_LINK */ void parse_rtm_dellink(char *msg, struct iflist_entry *ifle, struct iflist_entry *ifle_tmp) { /* move entry from interface list to interface history */ move_iflist_entry(ifle_tmp->index); del_ifhist_entry(); /* check interface state */ char state[MAX_STR_SIZE] = ""; /* check administrative state */ (ifle_tmp->flags & IFF_UP) ? strcpy(state, "enabled,") : strcpy(state, "disabled,"); /* check operational state */ (ifle_tmp->flags & IFF_RUNNING) ? strcat(state, "linkup") : strcat(state, "linkdown"); rec_log("interface deleted: %sstate=%s", msg, state); free(ifle_tmp); return; } /* * psrse attribute IFLA_IFNAME */ int parse_ifla_ifname(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { if(!RTA_PAYLOAD(ifla)) { rec_log("error: %s: ifindex %d: no payload", __func__, ifle->index); return(1); } else if(RTA_PAYLOAD(ifla) > sizeof(ifle->name)) { rec_log("error: %s: ifindex %d: payload too long", __func__, ifle->index); return(1); } strncpy(ifle->name, RTA_DATA(ifla), sizeof(ifle->name)); if(msg) *mp = add_log(msg, *mp, "name=%s ", ifle->name); return(0); } /* * parse attribute IFLA_LINK */ int parse_ifla_link(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { int index; char name[IFNAMSIZ] = ""; if(RTA_PAYLOAD(ifla) < sizeof(index)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } index = *(int *)RTA_DATA(ifla); if(index && ifle->index != index) { if_indextoname_from_lists(index, name); *mp = add_log(msg, *mp, "link=%s ", name); } return(0); } /* * parse attribute IFLA_ADDRESS */ int parse_ifla_address(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = arphrd_ntop(ifle->type, ifla, addr, sizeof(addr)); if(res) { rec_log("error: %s: ifindex %d: %s", __func__, ifle->index, (res == 1) ? strerror(errno) : "payload too short"); return(1); } memcpy(ifle->addr, addr, sizeof(addr)); if(msg) switch(ifle->type) { case ARPHRD_TUNNEL: case ARPHRD_IPGRE: case ARPHRD_SIT: case ARPHRD_TUNNEL6: #ifdef ARPHRD_IP6GRE case ARPHRD_IP6GRE: #endif *mp = add_log(msg, *mp, "local=%s ", ifle->addr); break; default: *mp = add_log(msg, *mp, "mac=%s ", ifle->addr); } return(0); } /* * parse attribute IFLA_BROADCAST */ int parse_ifla_broadcast(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { char brd[INET6_ADDRSTRLEN+1] = ""; int res; res = arphrd_ntop(ifle->type, ifla, brd, sizeof(brd)); if(res) { rec_log("error: %s: ifindex %d: %s", __func__, ifle->index, (res == 1) ? strerror(errno) : "pyaload too short"); return(1); } memcpy(ifle->brd, brd, sizeof(brd)); if(msg) switch(ifle->type) { case ARPHRD_TUNNEL: case ARPHRD_IPGRE: case ARPHRD_SIT: case ARPHRD_TUNNEL6: #ifdef ARPHRD_IP6GRE case ARPHRD_IP6GRE: #endif *mp = add_log(msg, *mp, "remote=%s ", ifle->brd); break; } return(0); } /* * parse attribute IFLA_MTU */ int parse_ifla_mtu(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { if(RTA_PAYLOAD(ifla) < sizeof(ifle->mtu)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } ifle->mtu = *(int *)RTA_DATA(ifla); if(msg) *mp = add_log(msg, *mp, "mtu=%d ", ifle->mtu); return(0); } #if HAVE_DECL_IFLA_LINKINFO /* * parse attribute IFLA_LINKINFO */ int parse_ifla_linkinfo(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { struct rtattr *info[__IFLA_INFO_MAX]; parse_nested_rtattr(info, IFLA_INFO_MAX, ifla); if(info[IFLA_INFO_KIND]) if(parse_ifla_info_kind(msg, mp, info[IFLA_INFO_KIND], ifle)) return(1); if(info[IFLA_INFO_DATA]) if(parse_ifla_info_data(msg, mp, info[IFLA_INFO_DATA], ifle)) return(1); return(0); } /* * parse attribute IFLA_INFO_KIND */ int parse_ifla_info_kind(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { if(!RTA_PAYLOAD(info)) { rec_log("error: %s: ifindex %d: no payload", __func__, ifle->index); return(1); } if(RTA_PAYLOAD(info) > sizeof(ifle->kind)) { rec_log("error: %s: ifindex %d: payload too long", __func__, ifle->index); return(1); } strncpy(ifle->kind, (char *)RTA_DATA(info), sizeof(ifle->kind)); if(msg) *mp = add_log(msg, *mp, "kind=%s ", ifle->kind); return(0); } /* * parse attribute IFLA_INFO_DATA */ int parse_ifla_info_data(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { #if HAVE_DECL_IFLA_VLAN_UNSPEC if(!strncmp(ifle->kind, "vlan", sizeof(ifle->kind))) parse_ifla_vlan(msg, mp, info, ifle); #endif #if HAVE_DECL_IFLA_GRE_UNSPEC if(!strncmp(ifle->kind, "gre", sizeof(ifle->kind))) parse_ifla_gre(msg, mp, info, ifle); if(!strncmp(ifle->kind, "gretap", sizeof(ifle->kind))) parse_ifla_gre(msg, mp, info, ifle); #endif #if HAVE_DECL_IFLA_MACVLAN_UNSPEC if(!strncmp(ifle->kind, "macvlan", sizeof(ifle->kind))) parse_ifla_macvlan(msg, mp, info, ifle); if(!strncmp(ifle->kind, "macvtap", sizeof(ifle->kind))) parse_ifla_macvlan(msg, mp, info, ifle); #endif #if HAVE_DECL_IFLA_VXLAN_UNSPEC if(!strncmp(ifle->kind, "vxlan", sizeof(ifle->kind))) parse_ifla_vxlan(msg, mp, info, ifle); #endif #if HAVE_DECL_IFLA_BOND_UNSPEC if(!strncmp(ifle->kind, "bond", sizeof(ifle->kind))) parse_ifla_bond(msg, mp, info, ifle); #endif return(0); } #endif /* * parse attribute IFLA_MASTER */ int parse_ifla_master(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle) { if(RTA_PAYLOAD(ifla) < sizeof(ifle->index_master)) { rec_log("error: %s: IFLA_MASTER(ifindex %d): payload too short", __func__, ifle->index); return(1); } ifle->index_master = *(int *)RTA_DATA(ifla); if_indextoname_from_lists(ifle->index_master, ifle->name_master); if(msg) *mp = add_log(msg, *mp, "master=%s ", ifle->name_master); return(0); } /* * parse attribute IFLA_PROTINFO */ int parse_ifla_protinfo(struct rtattr *ifla, struct iflist_entry *ifle, unsigned char family) { #if HAVE_DECL_IFLA_BRPORT_UNSPEC if(family == PF_BRIDGE) parse_ifla_brport(ifla, ifle); #endif return(0); } /* * debug interface information message */ void debug_ifimsg(int lev, struct ifinfomsg *ifim, struct rtattr *ifla[], int ifim_len) { /* debug ifinfomsg */ char ifname[IFNAMSIZ] = ""; if_indextoname_from_lists(ifim->ifi_index, ifname); rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ ifinfomsg(%d) ]", NLMSG_ALIGN(sizeof(struct ifinfomsg))); rec_dbg(lev, " ifi_family(%d): %u(%s)", sizeof(ifim->ifi_family), ifim->ifi_family, conv_af_type(ifim->ifi_family, 1)); rec_dbg(lev, " __ifi_pad(%d): %u", sizeof(ifim->__ifi_pad), ifim->__ifi_pad); rec_dbg(lev, " ifi_type(%d): %hu(%s)", sizeof(ifim->ifi_type), ifim->ifi_type, conv_arphrd_type(ifim->ifi_type, 1)); rec_dbg(lev, " ifi_index(%d): %d(%s)", sizeof(ifim->ifi_index), ifim->ifi_index, ifname); rec_dbg(lev, " ifi_flags(%d): 0x%08x(%s)", sizeof(ifim->ifi_flags), ifim->ifi_flags, conv_iff_flags(ifim->ifi_flags, 1)); rec_dbg(lev, " ifi_change(%d): %u", sizeof(ifim->ifi_change), ifim->ifi_change); /* debug interface link attributes */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ ifinfomsg attributes(%d) ]", NLMSG_ALIGN(ifim_len - NLMSG_ALIGN(sizeof(struct ifinfomsg)))); if(ifla[IFLA_ADDRESS]) debug_rta_arphrd(lev+1, ifla[IFLA_ADDRESS], "IFLA_ADDRESS", ifim->ifi_type); if(ifla[IFLA_BROADCAST]) debug_rta_arphrd(lev+1, ifla[IFLA_BROADCAST], "IFLA_BROADCAST", ifim->ifi_type); if(ifla[IFLA_IFNAME]) debug_rta_str(lev+1, ifla[IFLA_IFNAME], "IFLA_IFNAME", NULL, IFNAMSIZ); if(ifla[IFLA_MTU]) debug_rta_s32(lev+1, ifla[IFLA_MTU], "IFLA_MTU", NULL); if(ifla[IFLA_LINK]) debug_rta_ifindex(lev+1, ifla[IFLA_LINK], "IFLA_LINK"); if(ifla[IFLA_QDISC]) debug_rta_str(lev+1, ifla[IFLA_QDISC], "IFLA_QDISC", NULL, IFNAMSIZ); if(ifla[IFLA_STATS]) debug_ifla_stats(lev+1, ifla[IFLA_STATS], "IFLA_STATS"); if(ifla[IFLA_COST]) debug_rta_u32(lev+1, ifla[IFLA_COST], "IFLA_COST", NULL); if(ifla[IFLA_PRIORITY]) debug_rta_u32(lev+1, ifla[IFLA_PRIORITY], "IFLA_PRIORITY", NULL); if(ifla[IFLA_MASTER]) debug_rta_ifindex(lev+1, ifla[IFLA_MASTER], "IFLA_MASTER"); if(ifla[IFLA_WIRELESS]) debug_rta_ignore(lev+1, ifla[IFLA_WIRELESS], "IFLA_WIRELESS"); if(ifla[IFLA_PROTINFO]) debug_ifla_protinfo(lev+1, ifla[IFLA_PROTINFO], "IFLA_PROTINFO", ifim->ifi_family); if(ifla[IFLA_TXQLEN]) debug_rta_u32(lev+1, ifla[IFLA_TXQLEN], "IFLA_TXQLEN", NULL); if(ifla[IFLA_MAP]) debug_ifla_map(lev+1, ifla[IFLA_MAP], "IFLA_MAP"); if(ifla[IFLA_WEIGHT]) debug_rta_u32(lev+1, ifla[IFLA_WEIGHT], "IFLA_WEIGHT", NULL); if(ifla[IFLA_OPERSTATE]) debug_rta_u8(lev+1, ifla[IFLA_OPERSTATE], "IFLA_OPERSTATE", conv_if_oper_state); if(ifla[IFLA_LINKMODE]) debug_rta_u8(lev+1, ifla[IFLA_LINKMODE], "IFLA_LINKMODE", conv_if_link_mode); #if HAVE_DECL_IFLA_LINKINFO if(ifla[IFLA_LINKINFO]) debug_ifla_linkinfo(lev+1, ifla[IFLA_LINKINFO], "IFLA_LINKINFO", ifim); #endif #if HAVE_DECL_IFLA_NET_NS_PID if(ifla[IFLA_NET_NS_PID]) debug_rta_u32(lev+1, ifla[IFLA_NET_NS_PID], "IFLA_NET_NS_PID", NULL); #endif #if HAVE_DECL_IFLA_IFALIAS if(ifla[IFLA_IFALIAS]) debug_rta_str(lev+1, ifla[IFLA_IFALIAS], "IFLA_IFALIAS", NULL, IFNAMSIZ); #endif #if HAVE_DECL_IFLA_NUM_VF if(ifla[IFLA_NUM_VF]) debug_rta_u32(lev+1, ifla[IFLA_NUM_VF], "IFLA_NUM_VF", NULL); #endif #if HAVE_DECL_IFLA_VFINFO_LIST if(ifla[IFLA_VFINFO_LIST]) debug_rta_ignore(lev+1, ifla[IFLA_VFINFO_LIST], "IFLA_VFINFO_LIST"); #endif #if HAVE_DECL_IFLA_STATS64 if(ifla[IFLA_STATS64]) debug_ifla_stats64(lev+1, ifla[IFLA_STATS64], "IFLA_STATS64"); #endif #if HAVE_DECL_IFLA_VF_PORTS if(ifla[IFLA_VF_PORTS]) debug_rta_ignore(lev+1, ifla[IFLA_VF_PORTS], "IFLA_VF_PORTS"); #endif #if HAVE_DECL_IFLA_PORT_SELF if(ifla[IFLA_PORT_SELF]) debug_rta_ignore(lev+1, ifla[IFLA_PORT_SELF], "IFLA_PORT_SELF"); #endif #if HAVE_DECL_IFLA_AF_SPEC if(ifla[IFLA_AF_SPEC]) debug_rta_ignore(lev+1, ifla[IFLA_AF_SPEC], "IFLA_AF_SPEC"); #endif #if HAVE_DECL_IFLA_GROUP if(ifla[IFLA_GROUP]) debug_rta_s32(lev+1, ifla[IFLA_GROUP], "IFLA_GROUP", NULL); #endif #if HAVE_DECL_IFLA_NET_NS_FD if(ifla[IFLA_NET_NS_FD]) debug_rta_ignore(lev+1, ifla[IFLA_NET_NS_FD], "IFLA_NET_NS_FD"); #endif #if HAVE_DECL_IFLA_EXT_MASK if(ifla[IFLA_EXT_MASK]) debug_rta_ignore(lev+1, ifla[IFLA_EXT_MASK], "IFLA_EXT_MASK"); #endif #if HAVE_DECL_IFLA_PROMISCUITY if(ifla[IFLA_PROMISCUITY]) debug_rta_s32(lev+1, ifla[IFLA_PROMISCUITY], "IFLA_PROMISCUITY", NULL); #endif #if HAVE_DECL_IFLA_NUM_TX_QUEUES if(ifla[IFLA_NUM_TX_QUEUES]) debug_rta_s32(lev+1, ifla[IFLA_NUM_TX_QUEUES], "IFLA_NUM_TX_QUEUES", NULL); #endif #if HAVE_DECL_IFLA_NUM_RX_QUEUES if(ifla[IFLA_NUM_RX_QUEUES]) debug_rta_s32(lev+1, ifla[IFLA_NUM_RX_QUEUES], "IFLA_NUM_RX_QUEUES", NULL); #endif #if HAVE_DECL_IFLA_CARRIER if(ifla[IFLA_CARRIER]) debug_rta_ignore(lev+1, ifla[IFLA_CARRIER], "IFLA_CARRIER"); #endif #if HAVE_DECL_IFLA_PHYS_PORT_ID if(ifla[IFLA_PHYS_PORT_ID]) debug_rta_ignore(lev+1, ifla[IFLA_PHYS_PORT_ID], "IFLA_PHYS_PORT_ID"); #endif rec_dbg(lev, ""); return; } /* * debug attribute IFLA_STATS */ void debug_ifla_stats(int lev, struct rtattr *ifla, const char *name) { struct rtnl_link_stats *stats; if(debug_rta_len_chk(lev, ifla, name, sizeof(*stats))) return; stats = (struct rtnl_link_stats *)RTA_DATA(ifla); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(ifla->rta_len)); rec_dbg(lev, " [ rtnl_link_stats(%d) ]", sizeof(*stats)); rec_dbg(lev, " rx_packets(%d): %u", sizeof(stats->rx_packets), stats->rx_packets); rec_dbg(lev, " tx_packets(%d): %u", sizeof(stats->tx_packets), stats->tx_packets); rec_dbg(lev, " rx_bytes(%d): %u", sizeof(stats->rx_bytes), stats->rx_bytes); rec_dbg(lev, " tx_bytes(%d): %u", sizeof(stats->tx_bytes), stats->tx_bytes); rec_dbg(lev, " rx_errors(%d): %u", sizeof(stats->rx_errors), stats->rx_errors); rec_dbg(lev, " tx_errors(%d): %u", sizeof(stats->tx_errors), stats->tx_errors); rec_dbg(lev, " rx_dropped(%d): %u", sizeof(stats->rx_dropped), stats->rx_dropped); rec_dbg(lev, " tx_dropped(%d): %u", sizeof(stats->tx_dropped), stats->tx_dropped); rec_dbg(lev, " multicast(%d): %u", sizeof(stats->multicast), stats->multicast); rec_dbg(lev, " collisions(%d): %u", sizeof(stats->collisions), stats->collisions); rec_dbg(lev, " rx_length_errors(%d): %u", sizeof(stats->rx_length_errors), stats->rx_length_errors); rec_dbg(lev, " rx_over_errors(%d): %u", sizeof(stats->rx_over_errors), stats->rx_over_errors); rec_dbg(lev, " rx_crc_errors(%d): %u", sizeof(stats->rx_crc_errors), stats->rx_crc_errors); rec_dbg(lev, " rx_frame_errors(%d): %u", sizeof(stats->rx_frame_errors), stats->rx_frame_errors); rec_dbg(lev, " rx_fifo_errors(%d): %u", sizeof(stats->rx_fifo_errors), stats->rx_fifo_errors); rec_dbg(lev, " rx_missed_errors(%d): %u", sizeof(stats->rx_missed_errors), stats->rx_missed_errors); rec_dbg(lev, " tx_aborted_errors(%d): %u", sizeof(stats->tx_aborted_errors), stats->tx_aborted_errors); rec_dbg(lev, " tx_carrier_errors(%d): %u", sizeof(stats->tx_carrier_errors), stats->tx_carrier_errors); rec_dbg(lev, " tx_fifo_errors(%d): %u", sizeof(stats->tx_fifo_errors), stats->tx_fifo_errors); rec_dbg(lev, " tx_heartbeat_errors(%d): %u", sizeof(stats->tx_heartbeat_errors), stats->tx_heartbeat_errors); rec_dbg(lev, " tx_window_errors(%d): %u", sizeof(stats->tx_window_errors), stats->tx_window_errors); rec_dbg(lev, " rx_compressed(%d): %u", sizeof(stats->rx_compressed), stats->rx_compressed); rec_dbg(lev, " tx_compressed(%d): %u", sizeof(stats->tx_compressed), stats->tx_compressed); return; } /* * debug attribute IFLA_PROTOINFO */ void debug_ifla_protinfo(int lev, struct rtattr *ifla, const char *name, unsigned char family) { rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(ifla->rta_len)); #if HAVE_DECL_IFLA_BRPORT_UNSPEC if(family == PF_BRIDGE) debug_ifla_brport(lev, ifla); #endif return; } /* * debug attribute IFLA_MAP */ void debug_ifla_map(int lev, struct rtattr *ifla, const char *name) { struct rtnl_link_ifmap *map; if(debug_rta_len_chk(lev, ifla, name, sizeof(*map))) return; map = (struct rtnl_link_ifmap *)RTA_DATA(ifla); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(ifla->rta_len)); rec_dbg(lev, " [ rtnl_link_ifmap(%d) ]", sizeof(*map)); rec_dbg(lev, " mem_start(%d): 0x%016x", sizeof(map->mem_start), map->mem_start); rec_dbg(lev, " mem_end(%d): 0x%016x", sizeof(map->mem_end), map->mem_end); rec_dbg(lev, " base_addr(%d): 0x%016x", sizeof(map->base_addr), map->base_addr); rec_dbg(lev, " irq(%d): %hu", sizeof(map->irq), map->irq); rec_dbg(lev, " dma(%d): 0x%02x", sizeof(map->dma), map->dma); rec_dbg(lev, " port(%d): 0x%02x", sizeof(map->port), map->port); return; } #if HAVE_DECL_IFLA_LINKINFO /* * debug attribute IFLA_LINKINFO */ void debug_ifla_linkinfo(int lev, struct rtattr *ifla, const char *name, struct ifinfomsg *ifim) { struct rtattr *info[__IFLA_INFO_MAX]; char kind[MODULE_NAME_LEN] = ""; parse_nested_rtattr(info, IFLA_INFO_MAX, ifla); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(ifla->rta_len)); if(info[IFLA_INFO_KIND]) debug_rta_str(lev+1, info[IFLA_INFO_KIND], "IFLA_INFO_KIND", kind, sizeof(kind)); if(info[IFLA_INFO_DATA]) debug_ifla_info_data(lev+1, info[IFLA_INFO_DATA], "IFLA_INFO_DATA", ifim, kind, sizeof(kind)); if(info[IFLA_INFO_XSTATS]) debug_rta_ignore(lev+1, info[IFLA_INFO_XSTATS], "IFLA_INFO_XSTATS"); #if HAVE_DECL_IFLA_INFO_SLAVE_KIND if(info[IFLA_INFO_SLAVE_KIND]) debug_rta_str(lev+1, info[IFLA_INFO_SLAVE_KIND], "IFLA_INFO_SLAVE_KIND", kind, sizeof(kind)); if(info[IFLA_INFO_SLAVE_DATA]) debug_ifla_info_slave_data(lev+1, info[IFLA_INFO_SLAVE_DATA], "IFLA_INFO_SLAVE_DATA", ifim, kind, sizeof(kind)); #endif return; } /* * debug attribute IFLA_INFO_DATA */ void debug_ifla_info_data(int lev, struct rtattr *info, const char *name, struct ifinfomsg *ifim, char *kind, int len) { rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(info->rta_len)); #if HAVE_DECL_IFLA_VLAN_UNSPEC if(!strncmp(kind, "vlan", len)) { debug_ifla_vlan(lev, info); return; } #endif #if HAVE_DECL_IFLA_GRE_UNSPEC if(!strncmp(kind, "gre", len)) { debug_ifla_gre(lev, ifim, info); return; } if(!strncmp(kind, "gretap", len)) { debug_ifla_gre(lev, ifim, info); return; } #endif #if HAVE_DECL_IFLA_MACVLAN_UNSPEC if(!strncmp(kind, "macvlan", len)) { debug_ifla_macvlan(lev, info); return; } if(!strncmp(kind, "macvtap", len)) { debug_ifla_macvlan(lev, info); return; } #endif #if HAVE_DECL_IFLA_VXLAN_UNSPEC if(!strncmp(kind, "vxlan", len)) { debug_ifla_vxlan(lev, info); return; } #endif #if HAVE_DECL_IFLA_BOND_UNSPEC if(!strncmp(kind, "bond", len)) { debug_ifla_bond(lev, info); return; } #endif rec_dbg(lev, "%s(%hu): -- ignored --", name, RTA_ALIGN(info->rta_len)); return; } #endif #if HAVE_DECL_IFLA_INFO_SLAVE_KIND /* * debug attribute IFLA_INFO_SLAVE_DATA */ void debug_ifla_info_slave_data(int lev, struct rtattr *info, const char *name, struct ifinfomsg *ifim, char *kind, int len) { rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(info->rta_len)); #if HAVE_DECL_IFLA_BOND_MIIMON if(!strncmp(kind, "bond", len)) { debug_ifla_bond_slave(lev, info); return; } #endif rec_dbg(lev, "%s(%hu): -- ignored --", name, RTA_ALIGN(info->rta_len)); return; } #endif #if HAVE_DECL_IFLA_STATS64 /* * debug attribute IFLA_STATS64 */ void debug_ifla_stats64(int lev, struct rtattr *ifla, const char *name) { struct rtnl_link_stats64 *stats; if(debug_rta_len_chk(lev, ifla, name, sizeof(*stats))) return; stats = (struct rtnl_link_stats64 *)RTA_DATA(ifla); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(ifla->rta_len)); rec_dbg(lev, " [ rtnl_link_stats64(%d) ]", sizeof(*stats)); rec_dbg(lev, " rx_packets(%d): %llu", sizeof(stats->rx_packets), stats->rx_packets); rec_dbg(lev, " tx_packets(%d): %llu", sizeof(stats->tx_packets), stats->tx_packets); rec_dbg(lev, " rx_bytes(%d): %llu", sizeof(stats->rx_bytes), stats->rx_bytes); rec_dbg(lev, " tx_bytes(%d): %llu", sizeof(stats->tx_bytes), stats->tx_bytes); rec_dbg(lev, " rx_errors(%d): %llu", sizeof(stats->rx_errors), stats->rx_errors); rec_dbg(lev, " tx_errors(%d): %llu", sizeof(stats->tx_errors), stats->tx_errors); rec_dbg(lev, " rx_dropped(%d): %llu", sizeof(stats->rx_dropped), stats->rx_dropped); rec_dbg(lev, " tx_dropped(%d): %llu", sizeof(stats->tx_dropped), stats->tx_dropped); rec_dbg(lev, " multicast(%d): %llu", sizeof(stats->multicast), stats->multicast); rec_dbg(lev, " collisions(%d): %llu", sizeof(stats->collisions), stats->collisions); rec_dbg(lev, " rx_length_errors(%d): %llu", sizeof(stats->rx_length_errors), stats->rx_length_errors); rec_dbg(lev, " rx_over_errors(%d): %llu", sizeof(stats->rx_over_errors), stats->rx_over_errors); rec_dbg(lev, " rx_crc_errors(%d): %llu", sizeof(stats->rx_crc_errors), stats->rx_crc_errors); rec_dbg(lev, " rx_frame_errors(%d): %llu", sizeof(stats->rx_frame_errors), stats->rx_frame_errors); rec_dbg(lev, " rx_fifo_errors(%d): %llu", sizeof(stats->rx_fifo_errors), stats->rx_fifo_errors); rec_dbg(lev, " rx_missed_errors(%d): %llu", sizeof(stats->rx_missed_errors), stats->rx_missed_errors); rec_dbg(lev, " tx_aborted_errors(%d): %llu", sizeof(stats->tx_aborted_errors), stats->tx_aborted_errors); rec_dbg(lev, " tx_carrier_errors(%d): %llu", sizeof(stats->tx_carrier_errors), stats->tx_carrier_errors); rec_dbg(lev, " tx_fifo_errors(%d): %llu", sizeof(stats->tx_fifo_errors), stats->tx_fifo_errors); rec_dbg(lev, " tx_heartbeat_errors(%d): %llu", sizeof(stats->tx_heartbeat_errors), stats->tx_heartbeat_errors); rec_dbg(lev, " tx_window_errors(%d): %llu", sizeof(stats->tx_window_errors), stats->tx_window_errors); rec_dbg(lev, " rx_compressed(%d): %llu", sizeof(stats->rx_compressed), stats->rx_compressed); rec_dbg(lev, " tx_compressed(%d): %llu", sizeof(stats->tx_compressed), stats->tx_compressed); return; } #endif /* * convert address family from number to string */ const char *conv_af_type(unsigned char family, unsigned char debug) { #define _AF_TYPE(s) \ if(family == AF_##s) \ return #s; _AF_TYPE(UNSPEC); _AF_TYPE(LOCAL); _AF_TYPE(UNIX); _AF_TYPE(FILE); _AF_TYPE(INET); _AF_TYPE(AX25); _AF_TYPE(IPX); _AF_TYPE(APPLETALK); _AF_TYPE(NETROM); _AF_TYPE(BRIDGE); _AF_TYPE(ATMPVC); _AF_TYPE(X25); _AF_TYPE(INET6); _AF_TYPE(ROSE); _AF_TYPE(DECnet); _AF_TYPE(NETBEUI); _AF_TYPE(SECURITY); _AF_TYPE(KEY); _AF_TYPE(NETLINK); _AF_TYPE(ROUTE); _AF_TYPE(PACKET); _AF_TYPE(ASH); _AF_TYPE(ECONET); _AF_TYPE(ATMSVC); #ifdef AF_RDS _AF_TYPE(RDS); #endif _AF_TYPE(SNA); _AF_TYPE(IRDA); _AF_TYPE(PPPOX); _AF_TYPE(WANPIPE); #ifdef AF_LLC _AF_TYPE(LLC); #endif #ifdef AF_CAN _AF_TYPE(CAN); #endif #ifdef AF_TIPC _AF_TYPE(TIPC); #endif _AF_TYPE(BLUETOOTH); #ifdef AF_IUCV _AF_TYPE(IUCV); #endif #ifdef AF_RXRPC _AF_TYPE(RXRPC); #endif #ifdef AF_ISDN _AF_TYPE(ISDN); #endif #ifdef AF_PHONET _AF_TYPE(PHONET); #endif #ifdef AF_IEEE802154 _AF_TYPE(IEEE802154); #endif #ifdef AF_CAIF _AF_TYPE(CAIF); #endif #ifdef AF_ALG _AF_TYPE(ALG); #endif _AF_TYPE(MAX); #undef _AF_TYPE return("UNKNOWN"); } /* * convert interafce type from number to string */ const char *conv_arphrd_type(unsigned short type, unsigned char debug) { #define _ARPHRD_TYPE(s) \ if(type == ARPHRD_##s) \ return(#s); _ARPHRD_TYPE(NETROM); _ARPHRD_TYPE(ETHER); _ARPHRD_TYPE(EETHER); _ARPHRD_TYPE(AX25); _ARPHRD_TYPE(PRONET); _ARPHRD_TYPE(CHAOS); _ARPHRD_TYPE(IEEE802); _ARPHRD_TYPE(ARCNET); _ARPHRD_TYPE(APPLETLK); _ARPHRD_TYPE(DLCI); _ARPHRD_TYPE(ATM); _ARPHRD_TYPE(METRICOM); _ARPHRD_TYPE(IEEE1394); _ARPHRD_TYPE(EUI64); _ARPHRD_TYPE(INFINIBAND); _ARPHRD_TYPE(SLIP); _ARPHRD_TYPE(CSLIP); _ARPHRD_TYPE(SLIP6); _ARPHRD_TYPE(CSLIP6); _ARPHRD_TYPE(RSRVD); _ARPHRD_TYPE(ADAPT); _ARPHRD_TYPE(ROSE); _ARPHRD_TYPE(X25); _ARPHRD_TYPE(HWX25); #ifdef ARPHRD_CAN _ARPHRD_TYPE(CAN); #endif _ARPHRD_TYPE(PPP); _ARPHRD_TYPE(CISCO); _ARPHRD_TYPE(HDLC); _ARPHRD_TYPE(LAPB); _ARPHRD_TYPE(DDCMP); _ARPHRD_TYPE(RAWHDLC); _ARPHRD_TYPE(TUNNEL); _ARPHRD_TYPE(TUNNEL6); _ARPHRD_TYPE(FRAD); _ARPHRD_TYPE(SKIP); _ARPHRD_TYPE(LOOPBACK); _ARPHRD_TYPE(LOCALTLK); _ARPHRD_TYPE(FDDI); _ARPHRD_TYPE(BIF); _ARPHRD_TYPE(SIT); _ARPHRD_TYPE(IPDDP); _ARPHRD_TYPE(IPGRE); _ARPHRD_TYPE(PIMREG); _ARPHRD_TYPE(HIPPI); _ARPHRD_TYPE(ASH); _ARPHRD_TYPE(ECONET); _ARPHRD_TYPE(IRDA); _ARPHRD_TYPE(FCPP); _ARPHRD_TYPE(FCAL); _ARPHRD_TYPE(FCPL); _ARPHRD_TYPE(FCFABRIC); _ARPHRD_TYPE(IEEE802_TR); _ARPHRD_TYPE(IEEE80211); _ARPHRD_TYPE(IEEE80211_PRISM); _ARPHRD_TYPE(IEEE80211_RADIOTAP); #ifdef ARPHRD_IEEE802154 _ARPHRD_TYPE(IEEE802154); #endif #ifdef ARPHRD_PHONET _ARPHRD_TYPE(PHONET); #endif #ifdef ARPHRD_PHONET_PIPE _ARPHRD_TYPE(PHONET_PIPE); #endif #ifdef ARPHRD_CAIF _ARPHRD_TYPE(CAIF); #endif #ifdef ARPHRD_IP6GRE _ARPHRD_TYPE(IP6GRE); #endif #undef _ARPHRD_TYPE return("UNKNOWN"); } /* * convert interface flags from number to string */ const char *conv_iff_flags(unsigned flags, unsigned char debug) { static char list[MAX_STR_SIZE]; unsigned len = sizeof(list); strncpy(list, "", sizeof(list)); if(!flags) { strncpy(list, "NONE", len); return((const char *)list); } #define _IFF_FLAGS(s) \ if((flags & IFF_##s) && (len - strlen(list) -1 > 0)) \ (flags &= ~IFF_##s) ? \ strncat(list, #s ",", len - strlen(list) - 1) : \ strncat(list, #s, len - strlen(list) - 1); _IFF_FLAGS(UP); _IFF_FLAGS(BROADCAST); _IFF_FLAGS(DEBUG); _IFF_FLAGS(LOOPBACK); _IFF_FLAGS(POINTOPOINT); _IFF_FLAGS(NOTRAILERS); _IFF_FLAGS(RUNNING); _IFF_FLAGS(NOARP); _IFF_FLAGS(PROMISC); _IFF_FLAGS(ALLMULTI); _IFF_FLAGS(MASTER); _IFF_FLAGS(SLAVE); _IFF_FLAGS(MULTICAST); _IFF_FLAGS(PORTSEL); _IFF_FLAGS(AUTOMEDIA); _IFF_FLAGS(DYNAMIC); _IFF_FLAGS(LOWER_UP); _IFF_FLAGS(DORMANT); #ifdef IFF_ECHO _IFF_FLAGS(ECHO); #endif #undef _IFF_FLAGS if(!strlen(list)) strncpy(list, "UNKNOWN", len); return((const char *)list); } /* * convert interafce operational state from number to string */ const char *conv_if_oper_state(unsigned char state, unsigned char debug) { #define _IF_OPER_STATE(s) \ if(state == IF_OPER_##s) \ return(#s); _IF_OPER_STATE(UNKNOWN); _IF_OPER_STATE(NOTPRESENT); _IF_OPER_STATE(DOWN); _IF_OPER_STATE(LOWERLAYERDOWN); _IF_OPER_STATE(TESTING); _IF_OPER_STATE(DORMANT); _IF_OPER_STATE(UP); #undef _IF_OPER_STATE return("UNKNOWN"); } /* * convert interafce link mode from number to string */ const char *conv_if_link_mode(unsigned char mode, unsigned char debug) { #define _IFLA_LINKMODE(s) \ if(mode == IF_LINK_MODE_##s) \ return(#s); _IFLA_LINKMODE(DEFAULT); _IFLA_LINKMODE(DORMANT); #undef _IFLA_LINKMODE return("UNKNOWN"); } nield-0.6.2/src/ifimsg_bond.c000066400000000000000000000252211470100110300160120ustar00rootroot00000000000000/* * ifimsg_bond.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_IFLA_BOND_UNSPEC /* * parse attributes IFLA_BOND_* */ int parse_ifla_bond(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { struct rtattr *bond[__IFLA_BOND_MAX]; parse_nested_rtattr(bond, IFLA_BOND_MAX, info); if(bond[IFLA_BOND_MODE]) if(parse_ifla_bond_mode(msg, mp, bond[IFLA_BOND_MODE], ifle)) return(1); #if HAVE_DECL_IFLA_BOND_MIIMON if(bond[IFLA_BOND_XMIT_HASH_POLICY]) if(parse_ifla_bond_xmit_hash_policy(msg, mp, bond[IFLA_BOND_XMIT_HASH_POLICY], ifle)) return(1); #endif return(0); } /* * parse attribute IFLA_BOND_MODE */ int parse_ifla_bond_mode(char *msg, char **mp, struct rtattr *bond, struct iflist_entry *ifle) { if(RTA_PAYLOAD(bond) < sizeof(unsigned char)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "mode=%s ", conv_bond_mode(*(unsigned char *)RTA_DATA(bond), 0)); return(0); } #if HAVE_DECL_IFLA_BOND_MIIMON /* * parse attribute IFLA_BOND_XMIT_HASH_POLICY */ int parse_ifla_bond_xmit_hash_policy(char *msg, char **mp, struct rtattr *bond, struct iflist_entry *ifle) { if(RTA_PAYLOAD(bond) < sizeof(unsigned char)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "hash=%s ", conv_bond_xmit_policy(*(unsigned char *)RTA_DATA(bond), 0)); return(0); } #endif /* * debug BOND interface information messages */ void debug_ifla_bond(int lev, struct rtattr *info) { struct rtattr *bond[__IFLA_BOND_MAX]; parse_nested_rtattr(bond, IFLA_BOND_MAX, info); if(bond[IFLA_BOND_MODE]) debug_rta_u8(lev+1, bond[IFLA_BOND_MODE], "IFLA_BOND_MODE", conv_bond_mode); if(bond[IFLA_BOND_ACTIVE_SLAVE]) debug_rta_ifindex(lev+1, bond[IFLA_BOND_ACTIVE_SLAVE], "IFLA_BOND_ACTIVE_SLAVE"); #if HAVE_DECL_IFLA_BOND_MIIMON if(bond[IFLA_BOND_MIIMON]) debug_rta_u32(lev+1, bond[IFLA_BOND_MIIMON], "IFLA_BOND_MIIMON", NULL); if(bond[IFLA_BOND_UPDELAY]) debug_rta_u32(lev+1, bond[IFLA_BOND_UPDELAY], "IFLA_BOND_UPDELAY", NULL); if(bond[IFLA_BOND_DOWNDELAY]) debug_rta_u32(lev+1, bond[IFLA_BOND_DOWNDELAY], "IFLA_BOND_DOWNDELAY", NULL); if(bond[IFLA_BOND_USE_CARRIER]) debug_rta_u8(lev+1, bond[IFLA_BOND_USE_CARRIER], "IFLA_BOND_USE_CARRIER", NULL); if(bond[IFLA_BOND_ARP_INTERVAL]) debug_rta_u32(lev+1, bond[IFLA_BOND_ARP_INTERVAL], "IFLA_BOND_ARP_INTERVAL", NULL); if(bond[IFLA_BOND_ARP_IP_TARGET]) debug_ifla_bond_arp_ip_target(lev+1, bond[IFLA_BOND_ARP_IP_TARGET], "IFLA_BOND_ARP_IP_TARGET"); if(bond[IFLA_BOND_ARP_VALIDATE]) debug_rta_u32(lev+1, bond[IFLA_BOND_ARP_VALIDATE], "IFLA_BOND_ARP_VALIDATE", NULL); if(bond[IFLA_BOND_ARP_ALL_TARGETS]) debug_rta_u32(lev+1, bond[IFLA_BOND_ARP_ALL_TARGETS], "IFLA_BOND_ARP_ALL_TARGETS", NULL); if(bond[IFLA_BOND_PRIMARY]) debug_rta_u32(lev+1, bond[IFLA_BOND_PRIMARY], "IFLA_BOND_PRIMARY", NULL); if(bond[IFLA_BOND_PRIMARY_RESELECT]) debug_rta_u8(lev+1, bond[IFLA_BOND_PRIMARY_RESELECT], "IFLA_BOND_PRIMARY_RESELECT", NULL); if(bond[IFLA_BOND_FAIL_OVER_MAC]) debug_rta_u8(lev+1, bond[IFLA_BOND_FAIL_OVER_MAC], "IFLA_BOND_FAIL_OVER_MAC", NULL); if(bond[IFLA_BOND_XMIT_HASH_POLICY]) debug_rta_u8(lev+1, bond[IFLA_BOND_XMIT_HASH_POLICY], "IFLA_BOND_XMIT_HASH_POLICY", conv_bond_xmit_policy); if(bond[IFLA_BOND_RESEND_IGMP]) debug_rta_u32(lev+1, bond[IFLA_BOND_RESEND_IGMP], "IFLA_BOND_RESEND_IGMP", NULL); if(bond[IFLA_BOND_NUM_PEER_NOTIF]) debug_rta_u8(lev+1, bond[IFLA_BOND_NUM_PEER_NOTIF], "IFLA_BOND_NUM_PEER_NOTIF", NULL); if(bond[IFLA_BOND_ALL_SLAVES_ACTIVE]) debug_rta_u8(lev+1, bond[IFLA_BOND_ALL_SLAVES_ACTIVE], "IFLA_BOND_ALL_SLAVES_ACTIVE", NULL); if(bond[IFLA_BOND_MIN_LINKS]) debug_rta_u32(lev+1, bond[IFLA_BOND_MIN_LINKS], "IFLA_BOND_MIN_LINKS", NULL); if(bond[IFLA_BOND_LP_INTERVAL]) debug_rta_u32(lev+1, bond[IFLA_BOND_LP_INTERVAL], "IFLA_BOND_LP_INTERVAL", NULL); if(bond[IFLA_BOND_PACKETS_PER_SLAVE]) debug_rta_u32(lev+1, bond[IFLA_BOND_PACKETS_PER_SLAVE], "IFLA_BOND_PACKETS_PER_SLAVE", NULL); if(bond[IFLA_BOND_AD_LACP_RATE]) debug_rta_u8(lev+1, bond[IFLA_BOND_AD_LACP_RATE], "IFLA_BOND_AD_LACP_RATE", NULL); if(bond[IFLA_BOND_AD_SELECT]) debug_rta_u8(lev+1, bond[IFLA_BOND_AD_SELECT], "IFLA_BOND_AD_SELECT", NULL); if(bond[IFLA_BOND_AD_INFO]) debug_ifla_bond_ad_info(lev+1, bond[IFLA_BOND_AD_INFO], "IFLA_BOND_AD_INFO"); #endif return; } #if HAVE_DECL_IFLA_BOND_MIIMON /* * debug attribute IFLA_BOND_ARP_IP_TARGET */ void debug_ifla_bond_arp_ip_target(int lev, struct rtattr *bond, const char *name) { int i; char addr[INET_ADDRSTRLEN] = ""; char target[INET_ADDRSTRLEN * BOND_MAX_ARP_TARGETS] = ""; struct rtattr *e[BOND_MAX_ARP_TARGETS + 1]; parse_nested_rtattr(e, BOND_MAX_ARP_TARGETS, bond); for(i = 0; i < BOND_MAX_ARP_TARGETS; i++) { if(!e[i]) break; inet_ntop(AF_INET, RTA_DATA(e[i]), addr, sizeof(addr)); strncat(target, addr, sizeof(addr)); strcat(target, ","); } if(strlen(target) > 0) target[strlen(target) - 1] = '\0'; rec_dbg(lev, "%s(%hu): %s", name, RTA_ALIGN(bond->rta_len), target); return; } /* * debug attribute IFLA_BOND_AD_INFO */ void debug_ifla_bond_ad_info(int lev, struct rtattr *bond, const char *name) { struct rtattr *info[__IFLA_BOND_AD_INFO_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(bond->rta_len)); parse_nested_rtattr(info, IFLA_BOND_AD_INFO_MAX, bond); if(info[IFLA_BOND_AD_INFO_AGGREGATOR]) debug_rta_u16(lev+1, info[IFLA_BOND_AD_INFO_AGGREGATOR], "IFLA_BOND_AD_INFO_AGGREGATOR", NULL); if(info[IFLA_BOND_AD_INFO_NUM_PORTS]) debug_rta_u16(lev+1, info[IFLA_BOND_AD_INFO_NUM_PORTS], "IFLA_BOND_AD_INFO_NUM_PORTS", NULL); if(info[IFLA_BOND_AD_INFO_ACTOR_KEY]) debug_rta_u16(lev+1, info[IFLA_BOND_AD_INFO_ACTOR_KEY], "IFLA_BOND_AD_INFO_ACTOR_KEY", NULL); if(info[IFLA_BOND_AD_INFO_PARTNER_KEY]) debug_rta_u16(lev+1, info[IFLA_BOND_AD_INFO_PARTNER_KEY], "IFLA_BOND_AD_INFO_PARTNER_KEY", NULL); if(info[IFLA_BOND_AD_INFO_PARTNER_MAC]) debug_rta_arphrd(lev+1, info[IFLA_BOND_AD_INFO_PARTNER_MAC], "IFLA_BOND_AD_INFO_PARTNER_MAC", ARPHRD_ETHER); return; } /* * debug attribute IFLA_BOND_SLAVE */ void debug_ifla_bond_slave(int lev, struct rtattr *bond) { struct rtattr *info[__IFLA_BOND_SLAVE_MAX]; parse_nested_rtattr(info, IFLA_BOND_SLAVE_MAX, bond); if(info[IFLA_BOND_SLAVE_STATE]) debug_rta_u8(lev+1, info[IFLA_BOND_SLAVE_STATE], "IFLA_BOND_SLAVE_STATE", conv_bond_state); if(info[IFLA_BOND_SLAVE_MII_STATUS]) debug_rta_u8(lev+1, info[IFLA_BOND_SLAVE_MII_STATUS], "IFLA_BOND_SLAVE_MII_STATUS", conv_bond_link); if(info[IFLA_BOND_SLAVE_LINK_FAILURE_COUNT]) debug_rta_u32(lev+1, info[IFLA_BOND_SLAVE_LINK_FAILURE_COUNT], "IFLA_BOND_SLAVE_LINK_FAILURE_COUNT", NULL); if(info[IFLA_BOND_SLAVE_PERM_HWADDR]) debug_rta_arphrd(lev+1, info[IFLA_BOND_SLAVE_PERM_HWADDR], "IFLA_BOND_SLAVE_PERM_HWADDR", ARPHRD_ETHER); if(info[IFLA_BOND_SLAVE_QUEUE_ID]) debug_rta_u16(lev+1, info[IFLA_BOND_SLAVE_QUEUE_ID], "IFLA_BOND_SLAVE_QUEUE_ID", NULL); if(info[IFLA_BOND_SLAVE_AD_AGGREGATOR_ID]) debug_rta_u16(lev+1, info[IFLA_BOND_SLAVE_AD_AGGREGATOR_ID], "IFLA_BOND_SLAVE_AD_AGGREGATOR_ID", NULL); return; } #endif /* * convert bonding mode from number to string */ const char *conv_bond_mode(unsigned char mode, unsigned char debug) { #define _BOND_MODE(s1, s2) \ if(mode == BOND_MODE_##s1) \ return(debug ? #s1 : #s2); _BOND_MODE(ROUNDROBIN, balance-rr); _BOND_MODE(ACTIVEBACKUP, active-backup); _BOND_MODE(XOR, balance-xor); _BOND_MODE(BROADCAST, broadcast); _BOND_MODE(8023AD, 802.3ad); _BOND_MODE(TLB, balance-tlb); _BOND_MODE(ALB, balance-alb); #undef _BOND_MODE return("UNKNOWN"); } #if HAVE_DECL_IFLA_BOND_MIIMON /* * convert bonding xmit hash policy from number to string */ const char *conv_bond_xmit_policy(unsigned char policy, unsigned char debug) { #define _BOND_XMIT_POLICY(s1, s2) \ if(policy == BOND_XMIT_POLICY_##s1) \ return(debug ? #s1 : #s2); _BOND_XMIT_POLICY(LAYER2, layer2); _BOND_XMIT_POLICY(LAYER34, layer3+4); _BOND_XMIT_POLICY(LAYER23, layer2+3); _BOND_XMIT_POLICY(ENCAP23, encap2+3); _BOND_XMIT_POLICY(ENCAP34, encap3+4); #undef _BOND_XMIT_POLICY return("UNKNOWN"); } /* * convert bonding slave state from number to string */ const char *conv_bond_state(unsigned char state, unsigned char debug) { #define _BOND_STATE(s1, s2) \ if(state == BOND_STATE_##s1) \ return(debug ? #s1 : #s2); _BOND_STATE(ACTIVE, active); _BOND_STATE(BACKUP, backup); #undef _BOND_STATE return("UNKNOWN"); } /* * convert bonding slave mii-status from number to string */ const char *conv_bond_link(unsigned char link, unsigned char debug) { #define _BOND_LINK(s1, s2) \ if(link == BOND_LINK_##s1) \ return(debug ? #s1 : #s2); _BOND_LINK(UP, up); _BOND_LINK(FAIL, fail); _BOND_LINK(DOWN, down); _BOND_LINK(BACK, back); #undef _BOND_LINK return("UNKNOWN"); } #endif #endif nield-0.6.2/src/ifimsg_brport.c000066400000000000000000000107671470100110300164110ustar00rootroot00000000000000/* * ifimsg_brport.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_IFLA_BRPORT_UNSPEC /* * parse RTM_NEWLINK for PF_BRIDGE */ void parse_rtm_newlink_bridge(struct iflist_entry *ifle, struct iflist_entry *ifle_tmp, struct rtattr *ifla[]) { if(!ifle) return; if(!ifle->br_attached) { ifle->br_attached = 1; ifle->index_master = ifle_tmp->index_master; rec_log("interface %s attached to bridge %s", ifle->name, ifle_tmp->name_master); strncpy(ifle->name_master, ifle_tmp->name_master, IFNAMSIZ); } if(ifle->br_state != ifle_tmp->br_state) { rec_log("bridge %s port %s stp state changed to %s", ifle->name_master, ifle->name, conv_br_state(ifle_tmp->br_state, 0)); ifle->br_state = ifle_tmp->br_state; } return; } /* * parse RTM_DELLINK for bridge */ void parse_rtm_dellink_bridge(struct iflist_entry *ifle) { if(ifle && ifle->br_attached) { ifle->br_attached = 0; rec_log("interface %s detached from bridge %s", ifle->name, ifle->name_master); strncpy(ifle->name_master, "", IFNAMSIZ); } return; } /* * parse attributes IFLA_BRPORT_* */ int parse_ifla_brport(struct rtattr *ifla, struct iflist_entry *ifle) { struct rtattr *brp[__IFLA_BRPORT_MAX]; parse_nested_rtattr(brp, IFLA_BRPORT_MAX, ifla); if(brp[IFLA_BRPORT_STATE]) parse_ifla_brport_state(brp[IFLA_BRPORT_STATE], ifle); return(0); } /* * psrse attribute IFLA_BRPORT_STATE */ int parse_ifla_brport_state(struct rtattr *brp, struct iflist_entry *ifle) { if(RTA_PAYLOAD(brp) < sizeof(unsigned char)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } ifle->br_state = *(unsigned char *)RTA_DATA(brp); return(0); } /* * debug attributes IFLA_BRPORT_* */ void debug_ifla_brport(int lev, struct rtattr *ifla) { struct rtattr *brp[__IFLA_BRPORT_MAX]; parse_nested_rtattr(brp, IFLA_BRPORT_MAX, ifla); if(brp[IFLA_BRPORT_STATE]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_STATE], "IFLA_BRPORT_STATE", conv_br_state); if(brp[IFLA_BRPORT_PRIORITY]) debug_rta_u16(lev+1, brp[IFLA_BRPORT_PRIORITY], "IFLA_BRPORT_PRIORITY", NULL); if(brp[IFLA_BRPORT_COST]) debug_rta_u32(lev+1, brp[IFLA_BRPORT_COST], "IFLA_BRPORT_COST", NULL); if(brp[IFLA_BRPORT_MODE]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_MODE], "IFLA_BRPORT_MODE", NULL); if(brp[IFLA_BRPORT_GUARD]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_GUARD], "IFLA_BRPORT_GUARD", NULL); if(brp[IFLA_BRPORT_PROTECT]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_PROTECT], "IFLA_BRPORT_PROTECT", NULL); if(brp[IFLA_BRPORT_FAST_LEAVE]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_FAST_LEAVE], "IFLA_BRPORT_FAST_LEAVE", NULL); #if HAVE_DECL_IFLA_BRPORT_LEARNING if(brp[IFLA_BRPORT_LEARNING]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_LEARNING], "IFLA_BRPORT_LEARNING", NULL); if(brp[IFLA_BRPORT_UNICAST_FLOOD]) debug_rta_u8(lev+1, brp[IFLA_BRPORT_UNICAST_FLOOD], "IFLA_BRPORT_UNICAST_FLOOD", NULL); #endif return; } /* * convert bridge port state from number to string */ const char *conv_br_state(unsigned char state, unsigned char debug) { #define _BR_STATE(s1, s2) \ if(state == BR_STATE_##s1) \ return(debug ? #s1 : #s2); _BR_STATE(DISABLED, disabled); _BR_STATE(LISTENING, listening); _BR_STATE(LEARNING, learning); _BR_STATE(FORWARDING, forwarding); _BR_STATE(BLOCKING, blocking); #undef _BR_STATE return("UNKNOWN"); } #endif nield-0.6.2/src/ifimsg_gre.c000066400000000000000000000125621470100110300156510ustar00rootroot00000000000000/* * ifimsg_gre.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_IFLA_GRE_UNSPEC /* * parse attributes IFLA_GRE_* */ int parse_ifla_gre(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { struct rtattr *gre[__IFLA_GRE_MAX]; parse_nested_rtattr(gre, IFLA_GRE_MAX, info); if(gre[IFLA_GRE_LOCAL]) if(parse_ifla_gre_local(msg, mp, gre[IFLA_GRE_LOCAL], ifle)) return(1); if(gre[IFLA_GRE_REMOTE]) if(parse_ifla_gre_remote(msg, mp, gre[IFLA_GRE_REMOTE], ifle)) return(1); return(0); } /* * parse attribute IFLA_GRE_LOCAL */ int parse_ifla_gre_local(char *msg, char **mp, struct rtattr *gre, struct iflist_entry *ifle) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; if(ifle->type == ARPHRD_ETHER) res = arphrd_ntop(ARPHRD_IPGRE, gre, addr, sizeof(addr)); else res = arphrd_ntop(ifle->type, gre, addr, sizeof(addr)); if(res) { rec_log("error: %s: IFLA_GRE_LOCAL(ifindex %d): %s", __func__, ifle->index, (res == 1) ? strerror(errno) : "payload too short"); return(1); } if(msg) *mp = add_log(msg, *mp, "source-address=%s ", addr); return(0); } /* * parse attribute IFLA_GRE_REMOTE */ int parse_ifla_gre_remote(char *msg, char **mp, struct rtattr *gre, struct iflist_entry *ifle) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; if(ifle->type == ARPHRD_ETHER) res = arphrd_ntop(ARPHRD_IPGRE, gre, addr, sizeof(addr)); else res = arphrd_ntop(ifle->type, gre, addr, sizeof(addr)); if(res) { rec_log("error: %s: IFLA_GRE_REMOTE(ifindex %d): %s", __func__, ifle->index, (res == 1) ?strerror(errno) : "payload too short"); return(1); } if(msg) *mp = add_log(msg, *mp, "destination-address=%s ", addr); return(0); } /* * debug GRE interface information messages */ void debug_ifla_gre(int lev, struct ifinfomsg *ifim, struct rtattr *info) { struct rtattr *gre[__IFLA_GRE_MAX]; parse_nested_rtattr(gre, IFLA_GRE_MAX, info); if(gre[IFLA_GRE_LINK]) debug_rta_ifindex(lev+1, gre[IFLA_GRE_LINK], "IFLA_GRE_LINK"); if(gre[IFLA_GRE_IFLAGS]) debug_rta_u16x(lev+1, gre[IFLA_GRE_IFLAGS], "IFLA_GRE_IFLAGS", conv_gre_flags); if(gre[IFLA_GRE_OFLAGS]) debug_rta_u16x(lev+1, gre[IFLA_GRE_OFLAGS], "IFLA_GRE_OFLAGS", conv_gre_flags); if(gre[IFLA_GRE_IKEY]) debug_rta_u32x(lev+1, gre[IFLA_GRE_IKEY], "IFLA_GRE_IKEY", NULL); if(gre[IFLA_GRE_OKEY]) debug_rta_u32x(lev+1, gre[IFLA_GRE_OKEY], "IFLA_GRE_OKEY", NULL); if(gre[IFLA_GRE_LOCAL]) debug_rta_arphrd(lev+1, gre[IFLA_GRE_LOCAL], "IFLA_GRE_LOCAL", (ifim->ifi_type == ARPHRD_ETHER)? ARPHRD_IPGRE : ifim->ifi_type); if(gre[IFLA_GRE_REMOTE]) debug_rta_arphrd(lev+1, gre[IFLA_GRE_REMOTE], "IFLA_GRE_REMOTE", (ifim->ifi_type == ARPHRD_ETHER)? ARPHRD_IPGRE : ifim->ifi_type); if(gre[IFLA_GRE_TTL]) debug_rta_u8(lev+1, gre[IFLA_GRE_TTL], "IFLA_GRE_TTL", NULL); if(gre[IFLA_GRE_TOS]) debug_rta_u8(lev+1, gre[IFLA_GRE_TOS], "IFLA_GRE_TOS", NULL); if(gre[IFLA_GRE_PMTUDISC]) debug_rta_u8(lev+1, gre[IFLA_GRE_PMTUDISC], "IFLA_GRE_PMTUDISC", NULL); #if HAVE_DECL_IFLA_GRE_ENCAP_LIMIT if(gre[IFLA_GRE_ENCAP_LIMIT]) debug_rta_ignore(lev+1, gre[IFLA_GRE_ENCAP_LIMIT], "IFLA_GRE_ENCAP_LIMIT"); if(gre[IFLA_GRE_FLOWINFO]) debug_rta_ignore(lev+1, gre[IFLA_GRE_FLOWINFO], "IFLA_GRE_FLOWINFO"); if(gre[IFLA_GRE_FLAGS]) debug_rta_ignore(lev+1, gre[IFLA_GRE_FLAGS], "IFLA_GRE_FLAGS"); #endif return; } /* * convert GRE flags from number to string */ const char *conv_gre_flags(unsigned short flags, unsigned char debug) { static char list[MAX_STR_SIZE]; unsigned len = sizeof(list); strncpy(list, "", sizeof(list)); if(!flags) { strncpy(list, "NONE", sizeof(list)); return((const char *)list); } #define _GRE_FLAGS(s) \ if((flags & GRE_##s) && (len - strlen(list) - 1 > 0)) \ (flags &= ~GRE_##s) ? \ strncat(list, #s ",", len - strlen(list) - 1) : \ strncat(list, #s, len - strlen(list) - 1); _GRE_FLAGS(CSUM); _GRE_FLAGS(ROUTING); _GRE_FLAGS(KEY); _GRE_FLAGS(SEQ); _GRE_FLAGS(STRICT); #undef _GRE_FLAGS if(!strlen(list)) strncpy(list, "UNKNOWN", len); return((const char *)list); } #endif nield-0.6.2/src/ifimsg_macvlan.c000066400000000000000000000053621470100110300165150ustar00rootroot00000000000000/* * ifimsg_macvlan.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_IFLA_MACVLAN_UNSPEC /* * parse IFLA_MACVLAN_* */ int parse_ifla_macvlan(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { struct rtattr *macvlan[__IFLA_MACVLAN_MAX]; parse_nested_rtattr(macvlan, IFLA_MACVLAN_MAX, info); if(macvlan[IFLA_MACVLAN_MODE]) if(parse_ifla_macvlan_mode(msg, mp, macvlan[IFLA_MACVLAN_MODE], ifle)) return(1); return(0); } /* * parse attribute IFLA_MACVLAN_MODE */ int parse_ifla_macvlan_mode(char *msg, char **mp, struct rtattr *macvlan, struct iflist_entry *ifle) { if(RTA_PAYLOAD(macvlan) < sizeof(unsigned)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "mode=%s ", conv_macvlan_mode(*(unsigned *)RTA_DATA(macvlan), 0)); return(0); } /* * debug MACVLAN interface information messages */ void debug_ifla_macvlan(int lev, struct rtattr *info) { struct rtattr *macvlan[__IFLA_MACVLAN_MAX]; parse_nested_rtattr(macvlan, IFLA_MACVLAN_MAX, info); if(macvlan[IFLA_MACVLAN_MODE]) debug_rta_u32x(lev+1, macvlan[IFLA_MACVLAN_MODE], "IFLA_MACVLAN_MODE", conv_macvlan_mode); #if HAVE_DECL_IFLA_MACVLAN_FLAGS if(macvlan[IFLA_MACVLAN_FLAGS]) debug_rta_ignore(lev+1, macvlan[IFLA_MACVLAN_FLAGS], "IFLA_MACVLAN_FLAGS"); #endif } /* * convert MACVLAN flags from number to string */ const char *conv_macvlan_mode(unsigned mode, unsigned char debug) { #define _MACVLAN_MODE(s1, s2) \ if(mode == MACVLAN_MODE_##s1) \ return(debug ? #s1 : #s2); _MACVLAN_MODE(PRIVATE, private); _MACVLAN_MODE(VEPA, vepa); _MACVLAN_MODE(BRIDGE, bridge); #if HAVE_DECL_MACVLAN_MODE_PASSTHRU _MACVLAN_MODE(PASSTHRU, passthru); #endif #undef _MACVLAN_MODE return(debug ? "UNKNOWN" : "unknown"); } #endif nield-0.6.2/src/ifimsg_vlan.c000066400000000000000000000162151470100110300160330ustar00rootroot00000000000000/* * ifimsg_vlan.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_IFLA_VLAN_UNSPEC /* * parse attributes IFLA_VLAN_* */ int parse_ifla_vlan(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { struct rtattr *vlan[__IFLA_VLAN_MAX]; parse_nested_rtattr(vlan, IFLA_VLAN_MAX, info); #if HAVE_DECL_IFLA_VLAN_PROTOCOL if(vlan[IFLA_VLAN_PROTOCOL]) if(parse_ifla_vlan_protocol(msg, mp, vlan[IFLA_VLAN_PROTOCOL], ifle)) return(1); #endif if(vlan[IFLA_VLAN_ID]) if(parse_ifla_vlan_id(msg, mp, vlan[IFLA_VLAN_ID], ifle)) return(1); if(vlan[IFLA_VLAN_EGRESS_QOS]) if(parse_ifla_vlan_egress_qos(msg, mp, vlan[IFLA_VLAN_EGRESS_QOS], ifle)) return(1); if(vlan[IFLA_VLAN_INGRESS_QOS]) if(parse_ifla_vlan_ingress_qos(msg, mp, vlan[IFLA_VLAN_INGRESS_QOS], ifle)) return(1); return(0); } /* * parse attribute IFLA_VLAN_ID */ int parse_ifla_vlan_id(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle) { if(RTA_PAYLOAD(vlan) < sizeof(ifle->vid)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } ifle->vid = *(unsigned short *)RTA_DATA(vlan); if(msg) *mp = add_log(msg, *mp, "vid=%hu ", ifle->vid); return(0); } /* * parse attribute IFLA_VLAN_EGRESS_QOS */ int parse_ifla_vlan_egress_qos(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle) { if(msg) { *mp = add_log(msg, *mp, "egress-qos-map(from:to)="); if(parse_vlan_qos_mapping(msg, mp, vlan, ifle)) return(1); } return(0); } /* * parse attribute IFLA_VLAN_INGRESS_QOS */ int parse_ifla_vlan_ingress_qos(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle) { if(msg) { *mp = add_log(msg, *mp, "ingress-qos-map(from:to)="); if(parse_vlan_qos_mapping(msg, mp, vlan, ifle)) return(1); } return(0); } /* * parse VLAN QoS informaton messages */ int parse_vlan_qos_mapping(char *msg, char **mp, struct rtattr *qos, struct iflist_entry *ifle) { struct ifla_vlan_qos_mapping *map; int len = RTA_PAYLOAD(qos); *mp = add_log(msg, *mp, "("); for(qos = RTA_DATA(qos); RTA_OK(qos, len); qos = RTA_NEXT(qos, len)) { if(RTA_PAYLOAD(qos) < sizeof(*map)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } map = (struct ifla_vlan_qos_mapping *)RTA_DATA(qos); *mp = add_log(msg, *mp, "%u:%u ", map->from, map->to); } --(*mp); *mp = add_log(msg, *mp, ") "); return(0); } #if HAVE_DECL_IFLA_VLAN_PROTOCOL /* * parse attribute IFLA_VLAN_PROTOCOL */ int parse_ifla_vlan_protocol(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle) { unsigned short proto; if(RTA_PAYLOAD(vlan) < sizeof(proto)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } proto = ntohs(*(unsigned short *)RTA_DATA(vlan)); if(msg) *mp = add_log(msg, *mp, "protocol=%s ", conv_eth_p(proto, 0)); return(0); } #endif /* * debug VLAN interface information messages */ void debug_ifla_vlan(int lev, struct rtattr *info) { struct rtattr *vlan[__IFLA_VLAN_MAX]; parse_nested_rtattr(vlan, IFLA_VLAN_MAX, info); if(vlan[IFLA_VLAN_ID]) debug_rta_u16(lev+1, vlan[IFLA_VLAN_ID], "IFLA_VLAN_ID", NULL); if(vlan[IFLA_VLAN_FLAGS]) debug_ifla_vlan_flags(lev+1, vlan[IFLA_VLAN_FLAGS], "IFLA_VLAN_FLAGS"); if(vlan[IFLA_VLAN_EGRESS_QOS]) debug_ifla_vlan_qos(lev+1, vlan[IFLA_VLAN_EGRESS_QOS], "IFLA_VLAN_EGRESS_QOS"); if(vlan[IFLA_VLAN_INGRESS_QOS]) debug_ifla_vlan_qos(lev+1, vlan[IFLA_VLAN_INGRESS_QOS], "IFLA_VLAN_INGRESS_QOS"); #if HAVE_DECL_IFLA_VLAN_PROTOCOL if(vlan[IFLA_VLAN_PROTOCOL]) debug_rta_n16x(lev+1, vlan[IFLA_VLAN_PROTOCOL], "IFLA_VLAN_PROTOCOL", conv_eth_p); #endif return; } /* * debug attribute IFLA_VLAN_FLAGS */ void debug_ifla_vlan_flags(int lev, struct rtattr *vlan, const char *name) { struct ifla_vlan_flags *flags; if(debug_rta_len_chk(lev, vlan, name, sizeof(*flags))) return; flags = (struct ifla_vlan_flags *)RTA_DATA(vlan); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(vlan->rta_len)); rec_dbg(lev, " [ ifla_flags(%d) ]", sizeof(*flags)); rec_dbg(lev, " flags(%d): 0x%.8x(%s)", sizeof(flags->flags), flags->flags, conv_vlan_flags(flags->flags, 1)); rec_dbg(lev, " mask(%d): 0x%.8x", sizeof(flags->mask), flags->mask); return; } /* * debug VLAN QoS informaton messages */ void debug_ifla_vlan_qos(int lev, struct rtattr *vlan, const char *name) { struct ifla_vlan_qos_mapping *map; int len = RTA_PAYLOAD(vlan); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(vlan->rta_len)); for(vlan = RTA_DATA(vlan); RTA_OK(vlan, len); vlan = RTA_NEXT(vlan, len)) { if(debug_rta_len_chk(lev, vlan, name, sizeof(*map))) return; map = (struct ifla_vlan_qos_mapping *)RTA_DATA(vlan); rec_dbg(lev+1, "%s(%hu):", name, RTA_ALIGN(vlan->rta_len)); rec_dbg(lev+1, " [ ifla_vlan_qos_mapping(%d) ]", sizeof(*map)); rec_dbg(lev+1, " from(%d): %u", sizeof(map->from), map->from); rec_dbg(lev+1, " to(%d): %u", sizeof(map->to), map->to); } return; } /* * convert VLAN flags from number to string */ const char *conv_vlan_flags(int flags, unsigned char debug) { static char list[MAX_STR_SIZE]; unsigned len = sizeof(list); strncpy(list, "", len); if(!flags) { strncpy(list, "NONE", len); return((const char *)list); } #define _VLAN_FLAGS(s) \ if((flags & VLAN_FLAG_##s) && (len - strlen(list) - 1 > 0)) \ (flags &= ~VLAN_FLAG_##s) ? \ strncat(list, #s ",", len - strlen(list) - 1) : \ strncat(list, #s, len - strlen(list) - 1); #if HAVE_DECL_VLAN_FLAG_REORDER_HDR _VLAN_FLAGS(REORDER_HDR); #endif #if HAVE_DECL_VLAN_FLAG_GVRP _VLAN_FLAGS(GVRP); #endif #if HAVE_DECL_VLAN_FLAG_LOOSE_BINDING _VLAN_FLAGS(LOOSE_BINDING); #endif #undef _VLAN_FLAGS if(!strlen(list)) strncpy(list, "UNKNOWN", len); return((const char *)list); } #endif nield-0.6.2/src/ifimsg_vxlan.c000066400000000000000000000213071470100110300162210ustar00rootroot00000000000000/* * ifimsg_vxlan.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_IFLA_VXLAN_UNSPEC /* * parse attributes IFLA_VLXAN_* */ int parse_ifla_vxlan(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle) { struct rtattr *vxlan[__IFLA_VXLAN_MAX]; parse_nested_rtattr(vxlan, IFLA_VXLAN_MAX, info); if(vxlan[IFLA_VXLAN_ID]) if(parse_ifla_vxlan_id(msg, mp, vxlan[IFLA_VXLAN_ID], ifle)) return(1); if(vxlan[IFLA_VXLAN_LINK]) if(parse_ifla_vxlan_link(msg, mp, vxlan[IFLA_VXLAN_LINK], ifle)) return(1); if(vxlan[IFLA_VXLAN_LOCAL]) if(parse_ifla_vxlan_local(msg, mp, vxlan[IFLA_VXLAN_LOCAL], ifle, AF_INET)) return(1); #if HAVE_DECL_IFLA_VXLAN_GROUP6 if(vxlan[IFLA_VXLAN_LOCAL6]) if(parse_ifla_vxlan_local(msg, mp, vxlan[IFLA_VXLAN_LOCAL6], ifle, AF_INET6)) return(1); #endif if(vxlan[IFLA_VXLAN_PORT_RANGE]) if(parse_ifla_vxlan_port_range(msg, mp, vxlan[IFLA_VXLAN_PORT_RANGE], ifle)) return(1); #if HAVE_DECL_IFLA_VXLAN_REMOTE if(vxlan[IFLA_VXLAN_REMOTE]) if(parse_ifla_vxlan_group(msg, mp, vxlan[IFLA_VXLAN_REMOTE], ifle, AF_INET)) return(1); #endif #if HAVE_DECL_IFLA_VXLAN_GROUP if(vxlan[IFLA_VXLAN_GROUP]) if(parse_ifla_vxlan_group(msg, mp, vxlan[IFLA_VXLAN_GROUP], ifle, AF_INET)) return(1); #endif #if HAVE_DECL_IFLA_VXLAN_GROUP6 if(vxlan[IFLA_VXLAN_GROUP6]) if(parse_ifla_vxlan_group(msg, mp, vxlan[IFLA_VXLAN_GROUP6], ifle, AF_INET6)) return(1); #endif #if HAVE_DECL_IFLA_VXLAN_PORT if(vxlan[IFLA_VXLAN_PORT]) if(parse_ifla_vxlan_port(msg, mp, vxlan[IFLA_VXLAN_PORT], ifle)) return(1); #endif return(0); } /* * parse attribute IFLA_VXLAN_ID */ int parse_ifla_vxlan_id(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle) { if(RTA_PAYLOAD(vxlan) < sizeof(unsigned)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "vni=%u ", *(unsigned *)RTA_DATA(vxlan)); return(0); } /* * parse attribute IFLA_VXLAN_LINK */ int parse_ifla_vxlan_link(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle) { char name[IFNAMSIZ]; if(RTA_PAYLOAD(vxlan) < sizeof(int)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if_indextoname_from_lists(*(int *)RTA_DATA(vxlan), name); if(msg) *mp = add_log(msg, *mp, "link=%s ", name); return(0); } /* * parse attribute IFLA_VXLAN_LOCAL/IFLA_VXLAN_LOCAL6 */ int parse_ifla_vxlan_local(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle, unsigned short family) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = inet_ntop_ifa(family, vxlan, addr, sizeof(addr)); if(res) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "source-address=%s ", addr); return(0); } /* * parse attribute IFLA_VXLAN_PORT_RANGE */ int parse_ifla_vxlan_port_range(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle) { struct ifla_vxlan_port_range *range; if(RTA_PAYLOAD(vxlan) < sizeof(*range)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } range = (struct ifla_vxlan_port_range *)RTA_DATA(vxlan); if(msg) *mp = add_log(msg, *mp, "source-port=%hu-%hu ", ntohs(range->low), ntohs(range->high)); return(0); } /* * parse attribute IFLA_VXLAN_PORT */ int parse_ifla_vxlan_port(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle) { if(RTA_PAYLOAD(vxlan) < sizeof(unsigned short)) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "destination-port=%hu ", ntohs(*(unsigned short *)RTA_DATA(vxlan))); return(0); } /* * parse attribute IFLA_VXLAN_REMOTE/IFLA_VXLAN_GROUP/IFLA_VXLAN_GROUP6 */ int parse_ifla_vxlan_group(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle, unsigned short family) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = inet_ntop_ifa(family, vxlan, addr, sizeof(addr)); if(res) { rec_log("error: %s: ifindex %d: payload too short", __func__, ifle->index); return(1); } if(msg) *mp = add_log(msg, *mp, "destination-address=%s ", addr); return(0); } /* * debug VXLAN interface information messages */ void debug_ifla_vxlan(int lev, struct rtattr *info) { struct rtattr *vxlan[__IFLA_VXLAN_MAX]; parse_nested_rtattr(vxlan, IFLA_VXLAN_MAX, info); if(vxlan[IFLA_VXLAN_ID]) debug_rta_u32(lev+1, vxlan[IFLA_VXLAN_ID], "IFLA_VXLAN_ID", NULL); #if HAVE_DECL_IFLA_VXLAN_REMOTE if(vxlan[IFLA_VXLAN_REMOTE]) debug_rta_af(lev+1, vxlan[IFLA_VXLAN_REMOTE], "IFLA_VXLAN_REMOTE", AF_INET); #endif #if HAVE_DECL_IFLA_VXLAN_GROUP if(vxlan[IFLA_VXLAN_GROUP]) debug_rta_af(lev+1, vxlan[IFLA_VXLAN_GROUP], "IFLA_VXLAN_GROUP", AF_INET); #endif if(vxlan[IFLA_VXLAN_LINK]) debug_rta_ifindex(lev+1, vxlan[IFLA_VXLAN_LINK], "IFLA_VXLAN_LINK"); if(vxlan[IFLA_VXLAN_LOCAL]) debug_rta_af(lev+1, vxlan[IFLA_VXLAN_LOCAL], "IFLA_VXLAN_LOCAL", AF_INET); if(vxlan[IFLA_VXLAN_TTL]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_TTL], "IFLA_VXLAN_TTL", NULL); if(vxlan[IFLA_VXLAN_TOS]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_TOS], "IFLA_VXLAN_TOS", NULL); if(vxlan[IFLA_VXLAN_LEARNING]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_LEARNING], "IFLA_VXLAN_LEARNING", NULL); if(vxlan[IFLA_VXLAN_AGEING]) debug_rta_u32(lev+1, vxlan[IFLA_VXLAN_AGEING], "IFLA_VXLAN_AGEING", NULL); if(vxlan[IFLA_VXLAN_LIMIT]) debug_rta_u32(lev+1, vxlan[IFLA_VXLAN_LIMIT], "IFLA_VXLAN_LIMIT", NULL); if(vxlan[IFLA_VXLAN_PORT_RANGE]) debug_ifla_vxlan_port_range(lev+1, vxlan[IFLA_VXLAN_PORT_RANGE], "IFLA_VXLAN_PORT_RANGE"); #if HAVE_DECL_IFLA_VXLAN_PROXY if(vxlan[IFLA_VXLAN_PROXY]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_PROXY], "IFLA_VXLAN_PROXY", NULL); if(vxlan[IFLA_VXLAN_RSC]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_RSC], "IFLA_VXLAN_RSC", NULL); if(vxlan[IFLA_VXLAN_L2MISS]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_L2MISS], "IFLA_VXLAN_L2MISS", NULL); if(vxlan[IFLA_VXLAN_L3MISS]) debug_rta_u8(lev+1, vxlan[IFLA_VXLAN_L3MISS], "IFLA_VXLAN_L3MISS", NULL); #endif #if HAVE_DECL_IFLA_VXLAN_PORT if(vxlan[IFLA_VXLAN_PORT]) debug_rta_n16(lev+1, vxlan[IFLA_VXLAN_PORT], "IFLA_VXLAN_PORT", NULL); #endif #if HAVE_DECL_IFLA_VXLAN_GROUP6 if(vxlan[IFLA_VXLAN_GROUP6]) debug_rta_af(lev+1, vxlan[IFLA_VXLAN_GROUP6], "IFLA_VXLAN_GROUP6", AF_INET6); if(vxlan[IFLA_VXLAN_LOCAL6]) debug_rta_af(lev+1, vxlan[IFLA_VXLAN_LOCAL6], "IFLA_VXLAN_LOCAL6", AF_INET6); #endif return; } /* * debug attribute IFLA_VXLAN_PORT_RANGE */ void debug_ifla_vxlan_port_range(int lev, struct rtattr *vxlan, const char *name) { struct ifla_vxlan_port_range *range; if(debug_rta_len_chk(lev, vxlan, name, sizeof(*range))) return; range = (struct ifla_vxlan_port_range *)RTA_DATA(vxlan); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(vxlan->rta_len)); rec_dbg(lev, " [ ifla_vxlan_port_range(%d) ]", sizeof(*range)); rec_dbg(lev, " low(%d): %hu", sizeof(range->low), ntohs(range->low)); rec_dbg(lev, " high(%d): %hu", sizeof(range->high), ntohs(range->high)); return; } #endif nield-0.6.2/src/list.h000066400000000000000000000046741470100110300145230ustar00rootroot00000000000000/* * list.h - linked list utility * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIST_H__ #define _LIST_H__ #include /* offsetof() */ /* a list format */ struct list_head { struct list_head *next, *prev; }; /* * get a struct for a specified entry */ #define list_entry(ptr, type, member) \ (type *)((char *)ptr - offsetof(type, member)) /* * initialize a list */ static inline void list_init(struct list_head *list) { list->next = list->prev = list; } /* * insert a new entry */ static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { next->prev = new; new->next = next; new->prev = prev; prev->next = new; } /* * add a new entry before a specified entry */ static inline void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } /* * delete an entry */ static inline void __list_del(struct list_head *prev, struct list_head *next) { next->prev = prev; prev->next = next; } /* * delete an entry from a list */ static inline void list_del(struct list_head *entry) { __list_del(entry->prev, entry->next); list_init(entry); } /* * delete from one list and add as another's head */ static inline void list_move(struct list_head *list, struct list_head *head) { __list_del(list->prev, list->next); list_add(list, head); } /* * iterate over a list */ #define list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /* * iterate over a list safe against removal of an entry */ #define list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); pos = n, n = pos->next) #endif nield-0.6.2/src/log.c000066400000000000000000000054631470100110300143210ustar00rootroot00000000000000/* * log.c - log function * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" static FILE *log_fd; /* * open a log file */ int open_log(char *filename) { int log_opts = get_log_opts(); if(log_opts & L_LOCAL) { log_fd = fopen(filename, "a"); if(log_fd == NULL) { fprintf(stderr, "[Error] %s: fopen(): %s\n", __func__, strerror(errno)); fprintf(stderr, "[Error] %s: can't open log file(%s)\n", __func__, filename); return(-1); } } if(log_opts & L_SYSLOG) { openlog(PACKAGE_NAME, LOG_PID, get_facility()); } return(0); } /* * concatnate logging messages */ char *add_log(char *msg, char *mp, char *format, ...) { va_list ap_msg; int rc; if(!mp || mp - msg < 0 || mp - msg >= MAX_MSG_SIZE) return(NULL); va_start(ap_msg, format); rc = vsnprintf(mp, MAX_MSG_SIZE - (mp - msg), format, ap_msg); va_end(ap_msg); if(rc < 0) { rec_log("error: snprintf failed"); return(NULL); } if(rc >= MAX_MSG_SIZE - (mp - msg)) { rec_log("error: message truncated"); return(NULL); } mp += rc; return(mp); } /* * record logging messages */ void rec_log(char *format, ...) { va_list ap_msg; char msg[MAX_MSG_SIZE] = ""; int log_opts = get_log_opts(); va_start(ap_msg, format); vsnprintf(msg, sizeof(msg), format, ap_msg); va_end(ap_msg); if(log_opts & L_LOCAL) { struct timeval tv; struct tm *tm; gettimeofday(&tv, NULL); tm = localtime(&tv.tv_sec); fprintf(log_fd, "[%04d-%02d-%02d %02d:%02d:%02d.%06ld] %s\n", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec, msg); fflush(log_fd); } if(log_opts & L_SYSLOG) syslog(LOG_INFO, "%s", msg); } /* * close a log file */ void close_log(void) { int log_opts = get_log_opts(); if(log_opts & L_LOCAL) { if(log_fd) fclose(log_fd); } if(log_opts & L_SYSLOG) { closelog(); } } nield-0.6.2/src/ndmsg.c000066400000000000000000000361261470100110300146500ustar00rootroot00000000000000/* * ndmsg.c - neigbor discovery message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* top of interface list */ static struct list_head head = {&head, &head}; /* * create a neighbor discovery cache list */ int create_ndlist(struct msghdr *msg) { struct nlmsghdr *nlh; int nlh_len; struct ndmsg *ndm; int ndm_len; struct rtattr *nda[__NDA_MAX]; struct ndlist_entry *ndle; int log_opts = get_log_opts(); int res; /* get netlink message header */ nlh = msg->msg_iov->iov_base; nlh_len = msg->msg_iov->iov_len; /* parse netlink message header */ for( ; NLMSG_OK(nlh, nlh_len); nlh = NLMSG_NEXT(nlh, nlh_len)) { /* whether netlink message header ends or not */ if(nlh->nlmsg_type == NLMSG_DONE) return(1); /* debug nlmsghder */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get ndmsg */ ndm_len = NLMSG_PAYLOAD(nlh, 0); if(ndm_len < sizeof(*ndm)) { rec_log("error: %s: ndmsg: length too short", __func__); continue; } ndm = (struct ndmsg *)NLMSG_DATA(nlh); /* parse neighbor discovery attributes */ parse_ndisc(nda, nlh); /* debug ndmsg */ if(log_opts & L_DEBUG) debug_ndmsg(0, ndm, nda, ndm_len); /* check address family */ if((ndm->ndm_family != AF_INET) && (ndm->ndm_family != AF_INET6)) continue; /* check address type */ if(ndm->ndm_type != RTN_UNICAST) continue; if(ndm->ndm_state == NUD_NOARP) continue; /* create neighbor discovery list */ ndle = (struct ndlist_entry *)malloc(sizeof(struct ndlist_entry)); if(ndle == NULL) { rec_log("error: %s: malloc: failed", __func__); return(-1); } memset(ndle, 0, sizeof(struct ndlist_entry)); strncpy(ndle->lladdr, "none", sizeof(ndle->lladdr)); list_init(&(ndle->list)); /* get interface index */ ndle->ifindex = ndm->ndm_ifindex; /* convert interface index to name */ if_indextoname_from_lists(ndm->ndm_ifindex, ndle->ifname); /* get ip address */ if(nda[NDA_DST]) { res = inet_ntop_ifa(ndm->ndm_family, nda[NDA_DST], ndle->ipaddr, sizeof(ndle->ipaddr)); if(res) { rec_log("error: %s: NDA_DST(ifindex %d): %s", __func__, ndle->ifindex, (res == 1) ? strerror(errno) : "payload too short"); free(ndle); continue; } } /* get link local address */ if(nda[NDA_LLADDR]) { res = arphrd_ntop(ARPHRD_ETHER, nda[NDA_LLADDR], ndle->lladdr, sizeof(ndle->lladdr)); if(res) { rec_log("error: %s: NDA_LLADDR(ifindex %d): %s", __func__, ndle->ifindex, (res == 1) ? strerror(errno) : "payload too short"); free(ndle); continue; } } /* add neighbor discovery cache list */ list_add(&(ndle->list), &head); } return(0); } /* * print a neighbor discovery cache list */ void print_ndlist(void) { struct list_head *l; FILE *ndlist; ndlist = fopen(NDLIST_FILE, "w"); if(ndlist == NULL) { rec_log("error: %s: can't open ndlist file(%s)", __func__, NDLIST_FILE); return; } fprintf(ndlist, "\n"); fprintf(ndlist, "*********************************************************************\n"); fprintf(ndlist, "[ neighbor list ]\n"); list_for_each(l, &head) { struct ndlist_entry *e; e = list_entry(l, struct ndlist_entry, list); fprintf(ndlist, "ifindex: %d, ", e->ifindex); fprintf(ndlist, "ifname: %s, ", e->ifname); fprintf(ndlist, "ipaddr: %s, ", e->ipaddr); fprintf(ndlist, "lladdr: %s\n", e->lladdr); } fclose(ndlist); } /* * search an entry in a neighbor discovery cache list */ static inline struct ndlist_entry *search_ndlist(char *ipa, unsigned ifi) { struct list_head *l; list_for_each(l, &head) { struct ndlist_entry *e; e = list_entry(l, struct ndlist_entry, list); if(!memcmp(ipa, &(e->ipaddr), sizeof(e->ipaddr)) && ifi == e->ifindex) return e; } return(NULL); } /* * add a neighbor discovery cache to a list */ static inline void add_ndlist_entry(struct list_head *l) { list_init(l); list_add(l, &head); } /* * [not in use] * delete an entry in a interface list entry */ static inline void del_iflist_entry(char *ipa) { struct list_head *l, *n; list_for_each_safe(l, n, &head) { struct ndlist_entry *e; e = list_entry(l, struct ndlist_entry, list); if(!memcmp(ipa, &(e->ipaddr), sizeof(e->ipaddr))) { list_del(l); free(e); } } } /* * parse neighbor discovery message */ int parse_ndmsg(struct nlmsghdr *nlh) { struct ndmsg *ndm; int ndm_len; struct rtattr *nda[__NDA_MAX]; struct ndlist_entry *ndle_tmp; char ndm_type[MAX_STR_SIZE] = ""; int log_opts = get_log_opts(); int msg_opts = get_msg_opts(); int res; /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get ndmsg */ ndm_len = NLMSG_PAYLOAD(nlh, 0); if(ndm_len < sizeof(*ndm)) { rec_log("error: %s: ndmsg: length too short", __func__); return(1); } ndm = (struct ndmsg *)NLMSG_DATA(nlh); /* parse neighbor discovery attributes */ parse_ndisc(nda, nlh); /* debug ndmsg */ if(log_opts & L_DEBUG) debug_ndmsg(0, ndm, nda, ndm_len); /* check address family */ if(ndm->ndm_family == AF_INET) { if((msg_opts & M_IPV4) || !(msg_opts & M_IPV6)) strcpy(ndm_type, "arp cache"); else return(1); } else if(ndm->ndm_family == AF_INET6) { if((msg_opts & M_IPV6) || !(msg_opts & M_IPV4)) strcpy(ndm_type, "ndp cache"); else return(1); } else { return(1); } /* unicast only */ if(ndm->ndm_type != RTN_UNICAST) return(1); if(ndm->ndm_state == NUD_NOARP) return(1); /* create temporary neighbor discovery entry */ ndle_tmp = malloc(sizeof(struct ndlist_entry)); if(!ndle_tmp) { rec_log("error: %s: malloc() failed", __func__); return(1); } memset(ndle_tmp, 0, sizeof(struct ndlist_entry)); strncpy(ndle_tmp->lladdr, "none", sizeof(ndle_tmp->lladdr)); /* get interface index */ ndle_tmp->ifindex = ndm->ndm_ifindex; /* convert interface index to name */ if_indextoname_from_lists((unsigned)ndm->ndm_ifindex, ndle_tmp->ifname); /* get ip address */ if(nda[NDA_DST]) { res = inet_ntop_ifa(ndm->ndm_family, nda[NDA_DST], ndle_tmp->ipaddr, sizeof(ndle_tmp->ipaddr)); if(res) { rec_log("error: %s: NDA_DST(ifindex %d): %s", __func__, ndle_tmp->ifindex, (res == 1) ? strerror(errno) : "payload too short"); free(ndle_tmp); return(1); } } /* get link local address */ if(nda[NDA_LLADDR]) { res = arphrd_ntop(ARPHRD_ETHER, nda[NDA_LLADDR], ndle_tmp->lladdr, sizeof(ndle_tmp->lladdr)); if(res) { rec_log("error: %s: NDA_LLADDR(ifindex %d): %s", __func__, ndle_tmp->ifindex, (res == 1) ? strerror(errno) : "payload too short"); free(ndle_tmp); return(1); } } /* logging neighbor discovery message */ if(nlh->nlmsg_type == RTM_NEWNEIGH) parse_rtm_newneigh(ndm_type, ndm, ndle_tmp); else if(nlh->nlmsg_type == RTM_DELNEIGH) parse_rtm_delneigh(ndm_type, ndm, ndle_tmp); return(0); } /* * parse RTM_NEWNEIGH */ int parse_rtm_newneigh(char *ndm_type, struct ndmsg *ndm, struct ndlist_entry *ndle_tmp) { struct ndlist_entry *ndle; /* search neighbor discovery entry by ip address */ ndle = search_ndlist(ndle_tmp->ipaddr, ndle_tmp->ifindex); switch(ndm->ndm_state) { case NUD_FAILED: /* change or add neighbor discovery list entry */ if(ndle) { if(memcmp(ndle->lladdr, ndle_tmp->lladdr, sizeof(ndle->lladdr))) { memcpy(ndle->lladdr, ndle_tmp->lladdr, sizeof(ndle->lladdr)); rec_log("%s invalidated: ip=%s mac=%s interface=%s", ndm_type, ndle->ipaddr, ndle->lladdr, ndle->ifname); } free(ndle_tmp); } else { add_ndlist_entry(&(ndle_tmp->list)); rec_log("%s unresolved: ip=%s mac=%s interface=%s", ndm_type, ndle_tmp->ipaddr, ndle_tmp->lladdr, ndle_tmp->ifname); } break; case NUD_PERMANENT: case NUD_PROBE: case NUD_DELAY: case NUD_STALE: case NUD_REACHABLE: /* change or add neighbor discovery list entry */ if(ndle) { if(memcmp(ndle->lladdr, ndle_tmp->lladdr, sizeof(ndle->lladdr))) { memcpy(ndle->lladdr, ndle_tmp->lladdr, sizeof(ndle->lladdr)); rec_log("%s changed: ip=%s mac=%s interface=%s", ndm_type, ndle->ipaddr, ndle->lladdr, ndle->ifname); } free(ndle_tmp); } else { add_ndlist_entry(&(ndle_tmp->list)); rec_log("%s added: ip=%s mac=%s interface=%s", ndm_type, ndle_tmp->ipaddr, ndle_tmp->lladdr, ndle_tmp->ifname); } break; case NUD_NOARP: case NUD_INCOMPLETE: break; } return(0); } /* * parse RTM_DELNEIGH */ int parse_rtm_delneigh(char *ndm_type, struct ndmsg *ndm, struct ndlist_entry *ndle_tmp) { struct list_head *l, *n; struct ndlist_entry *e; switch(ndm->ndm_state) { case NUD_FAILED: case NUD_INCOMPLETE: case NUD_PERMANENT: case NUD_REACHABLE: case NUD_STALE: case NUD_DELAY: case NUD_PROBE: case NUD_NOARP: /* search & delete neighbor discovery entry */ list_for_each_safe(l, n, &head) { e = list_entry(l, struct ndlist_entry, list); if(!memcmp(e->ipaddr, ndle_tmp->ipaddr, sizeof(e->ipaddr))) { rec_log("%s deleted: ip=%s mac=%s interface=%s", ndm_type, ndle_tmp->ipaddr, ndle_tmp->lladdr, e->ifname); list_del(l); free(e); /* because entry matched is only one */ break; } } break; } free(ndle_tmp); return(0); } /* * debug neighbor discovery message */ void debug_ndmsg(int lev, struct ndmsg *ndm, struct rtattr *nda[], int ndm_len) { char ifname[IFNAMSIZ] = ""; /* debug ndmsg */ if_indextoname_from_lists((unsigned)ndm->ndm_ifindex, ifname); rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ ndmsg(%d) ]", NLMSG_ALIGN(sizeof(struct ndmsg))); rec_dbg(lev, " ndm_family(%d): %d(%s)", sizeof(ndm->ndm_family), ndm->ndm_family, conv_af_type(ndm->ndm_family, 1)); rec_dbg(lev, " ndm_ifindex(%d): %d(%s)", sizeof(ndm->ndm_ifindex), ndm->ndm_ifindex, ifname); rec_dbg(lev, " ndm_state(%d): %d(%s)", sizeof(ndm->ndm_state), ndm->ndm_state, conv_nud_state(ndm->ndm_state, 1)); rec_dbg(lev, " ndm_flags(%d): %d(%s)", sizeof(ndm->ndm_flags), ndm->ndm_flags, conv_ntf_flags(ndm->ndm_flags, 1)); rec_dbg(lev, " ndm_type(%d): %d(%s)", sizeof(ndm->ndm_type), ndm->ndm_type, conv_rtn_type(ndm->ndm_type, 1)); /* debug neighbor discovery attributes */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ ndmsg attributes(%d) ]", NLMSG_ALIGN(ndm_len - NLMSG_ALIGN(sizeof(struct ndmsg)))); if(nda[NDA_DST]) debug_rta_af(lev+1, nda[NDA_DST], "NDA_DST", ndm->ndm_family); if(nda[NDA_LLADDR]) debug_rta_arphrd(lev+1, nda[NDA_LLADDR], "NDA_LLADDR", ARPHRD_ETHER); if(nda[NDA_CACHEINFO]) debug_nda_cacheinfo(lev+1, nda[NDA_CACHEINFO], "NDA_CACHEINFO"); if(nda[NDA_PROBES]) debug_rta_u32(lev+1, nda[NDA_PROBES], "NDA_PROBES", NULL); rec_dbg(lev, ""); return; } /* * debug attribute NDA_CACHEINFO */ void debug_nda_cacheinfo(int lev, struct rtattr *nda, const char *name) { struct nda_cacheinfo *ndac; if(debug_rta_len_chk(lev, nda, name, sizeof(*ndac))) return; ndac = (struct nda_cacheinfo *)RTA_DATA(nda); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(nda->rta_len)); rec_dbg(lev, " [ nda_cacheinfo(%d) ]", sizeof(struct nda_cacheinfo)); rec_dbg(lev, " ndm_confirmed(%d): %u", sizeof(ndac->ndm_confirmed), ndac->ndm_confirmed); rec_dbg(lev, " ndm_used(%d): %u", sizeof(ndac->ndm_used), ndac->ndm_used); rec_dbg(lev, " ndm_updated(%d): %u", sizeof(ndac->ndm_updated), ndac->ndm_updated); rec_dbg(lev, " ndm_refcnt(%d): %u", sizeof(ndac->ndm_refcnt), ndac->ndm_refcnt); return; } const char *conv_nud_state(int state, unsigned char debug) { #define _NUD_STATE(s) \ if(state == NUD_##s) \ return(#s); _NUD_STATE(INCOMPLETE); _NUD_STATE(REACHABLE); _NUD_STATE(STALE); _NUD_STATE(DELAY); _NUD_STATE(PROBE); _NUD_STATE(FAILED); _NUD_STATE(NOARP); _NUD_STATE(PERMANENT); #undef _NUD_STATE return("UNKNOWN"); } const char *conv_ntf_flags(int flags, unsigned char debug) { static char list[MAX_STR_SIZE]; unsigned len = sizeof(list); if(!flags) { strncpy(list, "NONE", len); return((const char *)list); } #define _NTF_FLAGS(f) \ if((flags & NTF_##f) && (len - strlen(list) - 1 > 0)) \ (flags &= ~NTF_##f) ? \ strncat(list, #f ",", len - strlen(list) - 1) : \ strncat(list, #f, len - strlen(list) - 1); #ifdef NTF_USE _NTF_FLAGS(USE); #endif _NTF_FLAGS(PROXY); _NTF_FLAGS(ROUTER); #undef _NTF_FLAGS if(!strlen(list)) strncpy(list, "UNKNOWN", len); return((const char *)list); } nield-0.6.2/src/nield.c000066400000000000000000000540661470100110300146360ustar00rootroot00000000000000/* * nield.c - evnent receiver * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #define SYSLOG_NAMES #include "nield.h" #include "rtnetlink.h" static int log_opts; static int facility; static int msg_opts; static int lock_fd; static int rcv_buflen; static char lock_file[MAX_STR_SIZE] = LOCK_FILE; static char log_file[MAX_STR_SIZE]; static char dbg_file[MAX_STR_SIZE]; volatile int sigterm_received = 0; volatile int sigint_received = 0; /* * main function */ int main(int argc, char *argv[]) { int sock = -1, ret; unsigned groups; /* set option */ ret = set_options(argc, argv); if(ret < 0) close_exit(sock, 0, ret); /* open log file */ ret = open_log(log_file); if(ret < 0) close_exit(sock, 0, ret); /* open debug file */ if(log_opts & L_DEBUG) { ret = open_dbg(dbg_file); if(ret < 0) close_exit(sock, 0, ret); } /* create lock file */ ret = open_lock(); if(ret < 0) close_exit(sock, 0, ret); /* set signal handlers */ ret = set_signal_handlers(); if(ret < 0) close_exit(sock, 0, ret); /* initizlize daemon */ ret = init_daemon(); if(ret < 0) close_exit(sock, 0, ret); rec_log("info: nield %s started(PID: %ld)", VERSION, (long)getpid()); /* write pid to lock file */ ret = write_lock(); if(ret < 0) close_exit(sock, 0, ret); /* open netlink socket to create list */ groups = 0; sock = open_netlink_socket(groups, NETLINK_ROUTE); if(sock < 0) close_exit(sock, 1, ret); /* request interface list */ ret = send_request(sock, RTM_GETLINK, AF_UNSPEC); if(ret < 0) close_exit(sock, 1, ret); /* receive interface list */ ret = recv_reply(sock, RTM_GETLINK); if(ret != 0) close_exit(sock, 1, ret); /* request bridge interface list */ ret = send_request(sock, RTM_GETLINK, AF_BRIDGE); if(ret < 0) close_exit(sock, 1, ret); /* receive bridge interface list */ ret = recv_reply(sock, RTM_GETLINK); if(ret != 0) close_exit(sock, 1, ret); /* request neighbor cache list */ ret = send_request(sock, RTM_GETNEIGH, AF_UNSPEC); if(ret < 0) close_exit(sock, 1, ret); /* receive & create interface list */ ret = recv_reply(sock, RTM_GETNEIGH); if(ret != 0) close_exit(sock, 1, ret); /* close socket */ close(sock); /* set rtnetlink multicast groups */ groups = set_rtnetlink_groups(); sock = open_netlink_socket(groups, NETLINK_ROUTE); if(sock < 0) close_exit(sock, 1, ret); /* recevie events */ ret = recv_events(sock); close_exit(sock, 1, ret); return(0); } /* * close a rtnetlink socket and a debug file, and then exit */ void close_exit(int sock, int log_flag, int ret) { /* close file descriptor */ if(sock > 0) close(sock); /* close debug file */ if(log_opts & L_DEBUG) close_dbg(); if(log_flag) rec_log("info: nield %s terminated(PID: %ld)", VERSION, getpid()); /* close log file */ close_log(); /* close lock file */ close_lock(); exit(ret); } /* * set options */ int set_options(int argc, char *argv[]) { int opt; /* set default value */ strcpy(log_file, LOG_FILE_DEFAULT); strcpy(dbg_file, DEBUG_FILE_DEFAULT); /* parse options */ while((opt = getopt(argc, argv, "vhp:l:s:L:d:46inarft")) != EOF) { switch(opt) { case 'v': fprintf(stderr, "version: %s\n", VERSION); return(-1); case 'h': fprintf(stderr, "usage: nield %s\n", NIELD_USAGE); return(-1); case 'p': strncpy(lock_file, optarg, MAX_STR_SIZE); break; case 'l': if(strlen(optarg) < MAX_STR_SIZE) { strcpy(log_file, optarg); } else { fprintf(stderr, "error: %s: log file path is longer than %d byte\n", __func__, MAX_STR_SIZE); return(-1); } log_opts |= L_LOCAL; break; case 'L': if(strlen(optarg) < MAX_STR_SIZE) { facility = set_facility(optarg); if(facility < 0) { fprintf(stderr, "error: %s: unknown syslog facility \"%s\"\n", __func__, optarg); return(-1); } } else { fprintf(stderr, "error: %s: syslog facility is longer than %d byte\n", __func__, MAX_STR_SIZE); return(-1); } log_opts |= L_SYSLOG; break; case 'd': if(strlen(optarg) < MAX_STR_SIZE) { strcpy(dbg_file, optarg); } else { fprintf(stderr, "error: %s: debug file path is longer than %d byte\n", __func__, MAX_STR_SIZE); return(-1); } log_opts |= L_DEBUG; break; case 's': if(strlen(optarg) < MAX_STR_SIZE) { rcv_buflen = atoi(optarg); } else { fprintf(stderr, "error: %s: receive buffer size is longer than %d byte\n", __func__, MAX_STR_SIZE); return(-1); } break; case '4': msg_opts |= M_IPV4; break; case '6': msg_opts |= M_IPV6; break; case 'i': msg_opts |= M_LINK; break; case 'n': msg_opts |= M_NEIGH; break; case 'a': msg_opts |= M_IFADDR; break; case 'r': msg_opts |= M_ROUTE; break; case 'f': msg_opts |= M_RULE; break; case 't': msg_opts |= M_TC; break; case 'x': msg_opts |= M_XFRM; default: return(-1); } } if(!(log_opts & L_LOCAL) && !(log_opts & L_SYSLOG)) { log_opts |= L_LOCAL; } return(0); } /* * get logging options */ int get_log_opts(void) { return(log_opts); } /* * get message options */ int get_msg_opts(void) { return(msg_opts); } /* * set syslog facility */ int set_facility(char *facility_name) { int i; for(i = 0; facilitynames[i].c_val >= 0; i++) { if(!strcmp(facility_name, facilitynames[i].c_name)) { break; } } return(facilitynames[i].c_val); } /* * get syslog facility */ int get_facility(void) { return(facility); } /* * create a lock file */ int open_lock(void) { int err; char pid_str[16]; if((lock_fd = open(lock_file, O_RDONLY, 0)) > 0) { err = read(lock_fd, pid_str, sizeof(pid_str)-1); if(err < 0) { fprintf(stderr, "error: %s: read(): %s\n", __func__, strerror(errno)); fprintf(stderr, "error: %s: can't read pid file\n", __func__); close(lock_fd); lock_fd = 0; return(-1); } pid_str[err] = '\0'; if(kill((pid_t)atol(pid_str), 0) == 0) { fprintf(stderr, "error %s: nield already running(PID: %ld)\n", __func__, atol(pid_str)); close(lock_fd); lock_fd = 0; return(-1); } close(lock_fd); lock_fd = open(lock_file, O_CREAT|O_TRUNC|O_WRONLY, 0644); } else { lock_fd = open(lock_file, O_CREAT|O_EXCL|O_WRONLY, 0644); } if(lock_fd < 0) { fprintf(stderr, "error %s: open(): %s\n", __func__, strerror(errno)); fprintf(stderr, "error %s: can't create lock file\n", __func__); return(-1); } return(0); } /* * write PID to a lock file */ int write_lock(void) { char pid_str[16]; int ret; snprintf(pid_str, sizeof(pid_str), "%ld\n", (long)getpid()); ret = write(lock_fd, pid_str, strlen(pid_str)); if(ret < 0) fprintf(stderr, "error %s: write(): %s\n", __func__, strerror(errno)); return(ret); } /* * close a lock file */ void close_lock(void) { if(lock_fd) { close(lock_fd); unlink(lock_file); } } /* * initialize daemon */ int init_daemon(void) { /* check user */ if(getuid() != 0) { fprintf(stderr, "error: %s: only root can run nield\n", __func__); return(-1); } /* change root directory */ if(chdir("/") == EOF) { fprintf(stderr, "error: %s: can't change root directory\n", __func__); fprintf(stderr, "error: %s: chdir(): %s\n", __func__, strerror(errno)); return(-1); } /* detach from controlling terminal */ if(daemon(0, 0) < 0) { fprintf(stderr, "error: %s: can't detach terminal\n", __func__); fprintf(stderr, "error: %s: daemon(): %s\n", __func__, strerror(errno)); return(-1); } return(0); } /* * set signal handlers(SIGTERM, SIGINT) */ int set_signal_handlers(void) { struct sigaction sigterm_act, sigint_act, sigusr1_act, sigusr2_act; /* set SIGTERM handler */ sigterm_act.sa_handler = sigterm_handler; if(sigfillset(&sigterm_act.sa_mask) < 0) { fprintf(stderr, "error: %s: sigfillset(): %s\n", __func__, strerror(errno)); return(-1); } sigterm_act.sa_flags = 0; if(sigaction(SIGTERM, &sigterm_act, 0) < 0) { fprintf(stderr, "error: %s: sigaction(): %s\n", __func__, strerror(errno)); return(-1); } /* set SIGINT handler */ sigint_act.sa_handler = sigint_handler; if(sigfillset(&sigint_act.sa_mask) < 0) { fprintf(stderr, "error: %s: sigfillset(): %s\n", __func__, strerror(errno)); return(-1); } sigint_act.sa_flags = 0; if(sigaction(SIGINT, &sigint_act, 0) < 0) { fprintf(stderr, "error: %s: sigaction(): %s\n", __func__, strerror(errno)); return(-1); } /* set SIGUSR1 handler */ sigusr1_act.sa_handler = sigusr1_handler; if(sigfillset(&sigusr1_act.sa_mask) < 0) { fprintf(stderr, "error: %s: sigfillset(): %s\n", __func__, strerror(errno)); return(-1); } sigusr1_act.sa_flags = 0; if(sigaction(SIGUSR1, &sigusr1_act, 0) < 0) { fprintf(stderr, "error: %s: sigaction(): %s\n", __func__, strerror(errno)); return(-1); } /* set SIGUSR2 handler */ sigusr2_act.sa_handler = sigusr2_handler; if(sigfillset(&sigusr2_act.sa_mask) < 0) { fprintf(stderr, "error: %s: sigfillset(): %s\n", __func__, strerror(errno)); return(-1); } sigusr2_act.sa_flags = 0; if(sigaction(SIGUSR2, &sigusr2_act, 0) < 0) { fprintf(stderr, "error: %s: sigaction(): %s\n", __func__, strerror(errno)); return(-1); } return(0); } /* * signal handler for SIGTERM */ void sigterm_handler(int sig) { rec_log("info: SIGTERM called(PID: %ld)", (long)getpid()); sigterm_received = 1; } /* * signal handler for SIGINT */ void sigint_handler(int sig) { rec_log("info: SIGINT called(PID: %ld)", (long)getpid()); sigint_received = 1; } /* * signal handler for SIGUSR1 */ void sigusr1_handler(int sig) { rec_log("info: SIGUSR1 called(PID: %ld)", (long)getpid()); print_iflist(1); print_iflist(2); } /* * signal handler for SIGUSR2 */ void sigusr2_handler(int sig) { rec_log("info: SIGUSR2 called(PID: %ld)", (long)getpid()); print_ndlist(); } int set_rtnetlink_groups(void) { int groups; /* set netlink groups flag to receive events */ groups = RTMGRP_NOTIFY; if(msg_opts & M_LINK) groups |= RTMGRP_LINK; if(msg_opts & M_NEIGH) groups |= RTMGRP_NEIGH; if(msg_opts & M_IFADDR) { if(msg_opts & M_IPV4) groups |= RTMGRP_IPV4_IFADDR; if(msg_opts & M_IPV6) groups |= RTMGRP_IPV6_IFADDR; if(!(msg_opts & (M_IPV4 | M_IPV6))) groups |= RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR; } if(msg_opts & M_ROUTE) { if(msg_opts & M_IPV4) groups |= RTMGRP_IPV4_ROUTE; if(msg_opts & M_IPV6) groups |= RTMGRP_IPV6_ROUTE; if(!(msg_opts & (M_IPV4 | M_IPV6))) groups |= RTMGRP_IPV4_ROUTE | RTMGRP_IPV6_ROUTE; } if(msg_opts & M_RULE) { if(msg_opts & M_IPV4) groups |= RTMGRP_IPV4_RULE; if(msg_opts & M_IPV6) groups |= (1 << (RTNLGRP_IPV6_RULE - 1)); if(!(msg_opts & (M_IPV4 | M_IPV6))) groups |= RTMGRP_IPV4_ROUTE | (1 << (RTNLGRP_IPV6_RULE - 1)); } if(msg_opts & M_TC) groups |= RTMGRP_TC; if(!(msg_opts & (M_LINK | M_NEIGH | M_IFADDR | M_ROUTE | M_RULE | M_TC))) { if(msg_opts & M_IPV4) groups |= RTMGRP_LINK | RTMGRP_NEIGH | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE | RTMGRP_IPV4_RULE | RTMGRP_TC; if(msg_opts & M_IPV6) groups |= RTMGRP_LINK | RTMGRP_NEIGH | RTMGRP_IPV6_IFADDR | RTMGRP_IPV6_ROUTE | (1 << (RTNLGRP_IPV6_RULE - 1)) | RTMGRP_TC; /* receive all events if the flag is set to only L_DEBUG or none */ if(!(msg_opts & (M_IPV4 | M_IPV6))) groups |= RTMGRP_LINK | RTMGRP_NEIGH | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE | RTMGRP_IPV4_RULE | RTMGRP_IPV6_IFADDR | RTMGRP_IPV6_ROUTE | (1 << (RTNLGRP_IPV6_RULE - 1)) | RTMGRP_TC; } return(groups); } /* * open a rtnetlink socket */ int open_netlink_socket(unsigned groups, int proto) { int sock, err; int len = sizeof(rcv_buflen); struct sockaddr_nl nla; /* open netlink socket */ sock = socket(AF_NETLINK, SOCK_RAW, proto); if(sock < 0) { rec_log("error: %s: socket(): %s", __func__, strerror(errno)); exit(1); } /* initialization */ memset(&nla, 0, sizeof(nla)); /* set & bind local address */ nla.nl_family = AF_NETLINK; nla.nl_pid = getpid(); nla.nl_groups = groups; bind(sock, (struct sockaddr *)&nla, sizeof(nla)); /* set receive buffer size */ if(rcv_buflen) { err = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &rcv_buflen, len); if(err < 0) { rec_log("error: %s: setsockopt(): %s", __func__, strerror(errno)); exit(1); } } return(sock); } /* * send a request to kernel through rtnetlink socket */ int send_request(int sock, int type, int family) { struct msghdr msg; struct iovec iov; struct sockaddr_nl nla; struct { struct nlmsghdr nlm; struct rtgenmsg rtgm; } req; int err; /* initialization */ memset(&msg, 0, sizeof(msg)); memset(&iov, 0, sizeof(iov)); memset(&nla, 0, sizeof(nla)); memset(&req, 0, sizeof(req)); /* set remote address */ nla.nl_family = AF_NETLINK; /* set netlink message header */ req.nlm.nlmsg_len = NLMSG_LENGTH(sizeof(req.rtgm)); req.nlm.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; req.nlm.nlmsg_type = type; /* set routing message header */ req.rtgm.rtgen_family = family; /* set message header */ iov.iov_base = (void *)&req; iov.iov_len = sizeof(req); msg.msg_name = (void *)&nla; msg.msg_namelen = sizeof(nla); msg.msg_iov = (void *)&iov; msg.msg_iovlen = 1; /* send request message */ err = sendmsg(sock, &msg, 0); if(err < 0) { rec_log("error: %s: sendmsg(): %s", __func__, strerror(errno)); return(1); } return(0); } /* * receive a reply from kernel through rtnetlink socket */ int recv_reply(int sock, int type) { struct msghdr msg; struct iovec iov; struct sockaddr_nl nla; char buf[16384]; int err, len; /* initialization */ memset(&msg, 0, sizeof(msg)); memset(&iov, 0, sizeof(iov)); memset(&nla, 0, sizeof(nla)); memset(buf, 0, sizeof(buf)); /* set message header */ msg.msg_name = (void *)&nla; msg.msg_namelen = sizeof(nla); msg.msg_iov = (void *)&iov; msg.msg_iovlen = 1; iov.iov_base = buf; iov.iov_len = sizeof(buf); /* receive loop */ while(1) { memset(buf, 0, sizeof(buf)); len = recvmsg(sock, &msg, 0); if(len < 0) { if(errno == EINTR || errno == EAGAIN) continue; rec_log("error: %s: recvmsg(): %s", __func__, strerror(errno)); return(1); } else if(len == 0) { rec_log("error: %s: recvmsg(): receive EOF", __func__); return(1); } /* verify whether a message originates from kernel */ if(nla.nl_pid) { rec_log("error: %s: received a message from invalid sender(%d)", __func__, nla.nl_pid); continue; } if(type == RTM_GETLINK) { /* create interface list */ err = create_iflist(&msg); if(err > 0) break; else if(err < 0) return(1); } else if(type == RTM_GETNEIGH) { /* create neighbor discovery list */ err = create_ndlist(&msg); if(err) break; else if(err < 0) return(1); } } return(0); } /* * receive notifications from kernel through rtnetlink socket */ int recv_events(int sock) { struct msghdr msg; struct iovec iov; struct sockaddr_nl nla; char buf[8192]; int err, buflen; int len = sizeof(buflen); /* logging a receive buffer size */ err = getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &buflen, (socklen_t *)&len); if(err < 0) { rec_log("error: %s: getsockopt(): %s", __func__, strerror(errno)); exit(1); } rec_log("info: socket receive buffer size: %d byte", buflen); /* initialization */ memset(&msg, 0, sizeof(msg)); memset(&iov, 0, sizeof(iov)); memset(&nla, 0, sizeof(nla)); memset(buf, 0, sizeof(buf)); /* set message header */ iov.iov_base = buf; iov.iov_len = sizeof(buf); msg.msg_name = (void *)&nla; msg.msg_namelen = sizeof(nla); msg.msg_iov = &iov; msg.msg_iovlen = 1; /* loop of receive event */ while(1) { /* detect signal received */ if(sigterm_received || sigint_received) break; /* clear buffer */ memset(buf, 0, sizeof(buf)); /* receive event */ len = recvmsg(sock, &msg, 0); if(len < 0) { rec_log("error: %s: recvmsg(): %s", __func__, strerror(errno)); if(errno == EINTR || errno == EAGAIN || errno == ENOBUFS || errno == ENOMEM) continue; return(1); } else if(!len) { rec_log("error: %s: recvmsg(): receive EOF", __func__); return(1); } /* verify whether a message originates from kernel */ if(nla.nl_pid) { rec_log("error: %s: received a message from invalid sender(%d)", __func__, nla.nl_pid); continue; } /* parse messages */ err = parse_events(&msg); if(err < 0) break; } return(0); } /* * parse messages in received notifications from kernel */ int parse_events(struct msghdr *mhdr) { struct nlmsghdr *nlh; struct nlmsgerr *nle; int nlh_len; /* get netlink message header */ nlh = mhdr->msg_iov->iov_base; nlh_len = mhdr->msg_iov->iov_len; /* parse netlink message type */ for( ; NLMSG_OK(nlh, nlh_len); nlh = NLMSG_NEXT(nlh, nlh_len)) { switch(nlh->nlmsg_type) { /* interface link message */ case RTM_NEWLINK: case RTM_DELLINK: parse_ifimsg(nlh); break; /* interface address message */ case RTM_NEWADDR: case RTM_DELADDR: parse_ifamsg(nlh); break; /* neighbor discovery message */ case RTM_NEWNEIGH: case RTM_DELNEIGH: parse_ndmsg(nlh); break; /* route message */ case RTM_NEWROUTE: case RTM_DELROUTE: parse_rtmsg(nlh); break; #ifdef HAVE_LINUX_FIB_RULES_H /* fib rule header */ case RTM_NEWRULE: case RTM_DELRULE: parse_frhdr(nlh); break; #endif /* traffic control header */ case RTM_NEWQDISC: case RTM_DELQDISC: case RTM_NEWTCLASS: case RTM_DELTCLASS: parse_tcmsg_qdisc(nlh); break; case RTM_NEWTFILTER: case RTM_DELTFILTER: parse_tcmsg_filter(nlh); break; case RTM_NEWACTION: case RTM_DELACTION: parse_tcamsg(nlh); break; /* error message */ case NLMSG_ERROR: nle = (struct nlmsgerr *)NLMSG_DATA(nlh); rec_log("error: %s: nlmsg error: %s", __func__, strerror(nle->error)); break; /* unknown message */ default: rec_log("error: %s: unknown nlsmg_type: %d", __func__, (int)nlh->nlmsg_type); } } return(0); } nield-0.6.2/src/nield.h000066400000000000000000001041671470100110300146410ustar00rootroot00000000000000/* * nield.c - evnent receiver * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _NIELD_ #define _NIELD_ #ifdef HAVE_CONFIG_H # include "config.h" #endif /* ANSI C header files */ #include #include #include #include #include #include #include #include #include /* not ANSI C header files */ #include #include #include #include #include #include /* INET_ADDRSTRLEN, INET6_ADDRSTRLEN */ #include #include /* bits/socket.h, PF_*, AF_* */ #include #include #include /* ETHER_ADDR_LEN */ #include /* __u8, __u16, __u32, __u64 */ #include /* linux/if_link.h */ #include #ifdef HAVE_LINUX_FIB_RULES_H # include #endif #include /* IFNAMSIZ */ #include /* struct iphdr */ #include /* VLAN_FLAG_* */ #include /* IFLA_GRE_* */ #include /* ETH_P_* */ #include #include #include #include /* linux/pkt_sched.h */ #ifdef HAVE_LINUX_TC_ACT_TC_CSUM_H # include #endif #include #ifdef HAVE_LINUX_TC_ACT_TC_IPT_H #include #endif #include #ifdef HAVE_LINUX_TC_ACT_TC_NAT_H # include #endif # include #ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H # include #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H #include #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H #include #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H #include #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_TEXT_H #include #endif #include "list.h" /* default value */ #define NIELD_USAGE "[-vh46inar] [-p lock_file] [-l log_file] [-s buffer_size] [-L syslog_facility] [-d debug_file]" #define LOG_FILE_DEFAULT "/var/log/nield.log" #define DEBUG_FILE_DEFAULT "/var/log/nield.dbg" #define LOCK_FILE "/var/run/nield.pid" #define IFLIST_FILE "/tmp/nield.iflist" #define IFHIST_FILE "/tmp/nield.ifhist" #define NDLIST_FILE "/tmp/nield.ndlist" #define MAX_STR_SIZE 128 #define MAX_MSG_SIZE 2048 #define MODULE_NAME_LEN (64 - sizeof(unsigned long)) #define BOND_MAX_ARP_TARGETS 32 /* logging option flag */ #define L_LOCAL 0x0001 #define L_SYSLOG 0x0002 #define L_DEBUG 0x0004 /* message option flag */ #define M_IPV4 0x0001 #define M_IPV6 0x0002 #define M_LINK 0x0004 #define M_NEIGH 0x0008 #define M_IFADDR 0x0010 #define M_ROUTE 0x0020 #define M_RULE 0x0040 #define M_TC 0x0080 #define M_XFRM 0x0100 /* interface message type flag */ #define IF_ADD 0x0001 #define IF_DEL 0x0002 #define IF_CHANGE 0x0004 /* interface list entry format */ struct iflist_entry { unsigned index; char name[IFNAMSIZ]; unsigned char addr[INET6_ADDRSTRLEN+1]; unsigned char brd[INET6_ADDRSTRLEN+1]; unsigned short type; unsigned flags; unsigned short vid; int mtu; char kind[MODULE_NAME_LEN]; int index_master; char name_master[IFNAMSIZ]; unsigned char br_attached; unsigned char br_state; struct list_head list; }; /* neighbor discovery cache format */ struct ndlist_entry { unsigned ifindex; char ifname[IFNAMSIZ]; char ipaddr[INET6_ADDRSTRLEN+1]; char lladdr[INET6_ADDRSTRLEN+1]; struct list_head list; }; /* defined in net/if.h but that conflicts with linux/if.h... */ extern unsigned int if_nametoindex (const char *__ifname); extern char *if_indextoname (unsigned int __ifindex, char *__ifname); /* nield.c */ void close_exit(int sock, int log_flag, int ret); int set_options(int argc, char *argv[]); int get_log_opts(void); int get_msg_opts(void); int set_facility(char *facility_name); int get_facility(void); int open_lock(void); int write_lock(void); void close_lock(void); int init_daemon(void); int set_signal_handlers(void); void sigterm_handler(int sig); void sigint_handler(int sig); void sigusr1_handler(int sig); void sigusr2_handler(int sig); int set_rtnetlink_groups(void); int open_netlink_socket(unsigned groups, int proto); int send_request(int sock, int type, int family); int recv_reply(int sock, int type); int recv_events(int sock); int parse_events(struct msghdr *mhdr); /* log.c */ int open_log(char *filename); char *add_log(char *msg, char *mp, char *format, ...); void rec_log(char *format, ...); void close_log(void); /* debug.c */ int open_dbg(char *filename); void rec_dbg(int lev, char *format, ...); void close_dbg(void); /* nlmsg.c */ void debug_nlmsg(int lev, struct nlmsghdr *nlh); const char *debug_n2s_nlmsg_type(int type); /* rta.c */ int debug_rta_len_chk(int lev, struct rtattr *rta, const char *name, size_t len); void debug_rta_ignore(int lev, struct rtattr *rta, const char *name); void debug_rta_none(int lev, struct rtattr *rta, const char *name); void debug_rta_u8(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned char num, unsigned char debug)); void debug_rta_u8x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned char num, unsigned char debug)); void debug_rta_u16(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)); void debug_rta_u16x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)); void debug_rta_n16(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)); void debug_rta_n16x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)); void debug_rta_u32(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned num, unsigned char debug)); void debug_rta_u32x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned num, unsigned char debug)); void debug_rta_s32(int lev, struct rtattr *rta, const char *name, const char *(*conv)(int num, unsigned char debug)); void debug_rta_s32x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(int num, unsigned char debug)); void debug_rta_str(int lev, struct rtattr *rta, const char *name, char *str, unsigned len); void debug_rta_ifindex(int lev, struct rtattr *rta, const char *name); void debug_rta_arphrd(int lev, struct rtattr *rta, const char *name, unsigned short type); int arphrd_ntop(unsigned short type, struct rtattr *ifla, char *addr, int addrlen); void debug_rta_af(int lev, struct rtattr *rta, const char *name, unsigned short family); int inet_ntop_ifa(int family, struct rtattr *ifa, char *saddr, int slen); void debug_rta_tc_addr(int lev, struct tcmsg *tcm, struct rtattr *rta, const char *name); int inet_ntop_tc_addr(struct tcmsg *tcm, struct rtattr *tca, char *addrstr, int addrstrlen); void debug_tca_classid(int lev, struct rtattr *tca, const char *name); void parse_tc_handle(char *p, int len, unsigned id); /* ifimsg.c */ int create_iflist(struct msghdr *msg); char *if_indextoname_from_lists(int index, char *name); char *if_indextoname_from_iflist(int index, char *name); char *if_indextoname_from_ifhist(int index, char *name); unsigned short get_type_from_iflist(int index); unsigned short get_type_from_ifhist(int index); void print_iflist(int num); int parse_ifimsg(struct nlmsghdr *nlh); void parse_rtm_newlink(char *msg, struct iflist_entry *ifle, struct iflist_entry *ifle_tmp, struct rtattr *ifla[]); void parse_rtm_dellink(char *msg, struct iflist_entry *ifle, struct iflist_entry *ifle_tmp); int parse_ifla_ifname(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_link(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_address(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_broadcast(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_mtu(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); #if HAVE_DECL_IFLA_LINKINFO int parse_ifla_linkinfo(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_info_kind(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); int parse_ifla_info_data(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); #endif int parse_ifla_master(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_protinfo(struct rtattr *ifla, struct iflist_entry *ifle, unsigned char family); void debug_ifimsg(int lev, struct ifinfomsg *ifim, struct rtattr *ifla[], int ifim_len); void debug_ifla_stats(int lev, struct rtattr *ifla, const char *name); void debug_ifla_protinfo(int lev, struct rtattr *ifla, const char *name, unsigned char family); void debug_ifla_map(int lev, struct rtattr *ifla, const char *name); #if HAVE_DECL_IFLA_LINKINFO void debug_ifla_linkinfo(int lev, struct rtattr *ifla, const char *name, struct ifinfomsg *ifim); void debug_ifla_info_data(int lev, struct rtattr *info, const char *name, struct ifinfomsg *ifim, char *kind, int len); #endif #if HAVE_DECL_IFLA_INFO_SLAVE_KIND void debug_ifla_info_slave_data(int lev, struct rtattr *info, const char *name, struct ifinfomsg *ifim, char *kind, int len); #endif #if HAVE_DECL_IFLA_STATS64 void debug_ifla_stats64(int lev, struct rtattr *ifla, const char *name); #endif const char *conv_af_type(unsigned char family, unsigned char debug); const char *conv_arphrd_type(unsigned short type, unsigned char debug); const char *conv_iff_flags(unsigned flags, unsigned char debug); const char *conv_if_oper_state(unsigned char state, unsigned char debug); const char *conv_if_link_mode(unsigned char mode, unsigned char debug); /* ifimsg_brport.c */ #if HAVE_DECL_IFLA_BRPORT_UNSPEC void parse_rtm_newlink_bridge(struct iflist_entry *ifle, struct iflist_entry *ifle_tmp, struct rtattr *ifla[]); void parse_rtm_dellink_bridge(struct iflist_entry *ifle); int parse_ifla_brport(struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_brport_state(struct rtattr *brp, struct iflist_entry *ifle); void debug_ifla_brport(int lev, struct rtattr *ifla); const char *conv_br_state(unsigned char state, unsigned char debug); #endif /* ifimsg_gre.c */ #if HAVE_DECL_IFLA_GRE_UNSPEC int parse_ifla_gre(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); int parse_ifla_gre_local(char *msg, char **mp, struct rtattr *greinfo, struct iflist_entry *ifle); int parse_ifla_gre_remote(char *msg, char **mp, struct rtattr *greinfo, struct iflist_entry *ifle); void debug_ifla_gre(int lev, struct ifinfomsg *ifim, struct rtattr *info); const char *conv_gre_flags(unsigned short flags, unsigned char debug); #endif /* ifimsg_vlan.c */ #if HAVE_DECL_IFLA_VLAN_UNSPEC int parse_ifla_vlan(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); int parse_ifla_vlan_id(char *msg, char **mp, struct rtattr *ifla, struct iflist_entry *ifle); int parse_ifla_vlan_egress_qos(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle); int parse_ifla_vlan_ingress_qos(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle); int parse_vlan_qos_mapping(char *msg, char **mp, struct rtattr *qos, struct iflist_entry *ifle); int parse_ifla_vlan_protocol(char *msg, char **mp, struct rtattr *vlan, struct iflist_entry *ifle); void debug_ifla_vlan(int lev, struct rtattr *info); void debug_ifla_vlan_flags(int lev, struct rtattr *vlan, const char *name); void debug_ifla_vlan_qos(int lev, struct rtattr *vlan, const char *name); const char *conv_vlan_flags(int flags, unsigned char debug); #endif /* ifimsg_macvlan.c */ #if HAVE_DECL_IFLA_MACVLAN_UNSPEC int parse_ifla_macvlan(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); int parse_ifla_macvlan_mode(char *msg, char **mp, struct rtattr *macvlan, struct iflist_entry *ifle); void debug_ifla_macvlan(int lev, struct rtattr *info); const char *conv_macvlan_mode(unsigned mode, unsigned char debug); #endif /* ifimsg_vxlan.c */ #if HAVE_DECL_IFLA_VXLAN_UNSPEC int parse_ifla_vxlan(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); int parse_ifla_vxlan_id(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle); int parse_ifla_vxlan_link(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle); int parse_ifla_vxlan_local(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle, unsigned short family); int parse_ifla_vxlan_port_range(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle); int parse_ifla_vxlan_group(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle, unsigned short family); #if HAVE_DECL_IFLA_VXLAN_PORT int parse_ifla_vxlan_port(char *msg, char **mp, struct rtattr *vxlan, struct iflist_entry *ifle); #endif void debug_ifla_vxlan(int lev, struct rtattr *info); void debug_ifla_vxlan_port_range(int lev, struct rtattr *vxlan, const char *name); #endif /* ifimsg_bond.c */ #if HAVE_DECL_IFLA_BOND_UNSPEC int parse_ifla_bond(char *msg, char **mp, struct rtattr *info, struct iflist_entry *ifle); int parse_ifla_bond_mode(char *msg, char **mp, struct rtattr *bond, struct iflist_entry *ifle); #if HAVE_DECL_IFLA_BOND_MIIMON int parse_ifla_bond_xmit_hash_policy(char *msg, char **mp, struct rtattr *bond, struct iflist_entry *ifle); #endif void debug_ifla_bond(int lev, struct rtattr *info); #if HAVE_DECL_IFLA_BOND_MIIMON void debug_ifla_bond_arp_ip_target(int lev, struct rtattr *bond, const char *name); void debug_ifla_bond_ad_info(int lev, struct rtattr *bond, const char *name); void debug_ifla_bond_slave(int lev, struct rtattr *bond); #endif const char *conv_bond_mode(unsigned char mode, unsigned char debug); #if HAVE_DECL_IFLA_BOND_MIIMON const char *conv_bond_xmit_policy(unsigned char policy, unsigned char debug); const char *conv_bond_state(unsigned char state, unsigned char debug); const char *conv_bond_link(unsigned char state, unsigned char debug); #endif #endif /* ifamsg.c */ int parse_ifamsg(struct nlmsghdr *nlh); void debug_ifamsg(int lev, struct ifaddrmsg *ifam, struct rtattr *ifa[], int ifam_len); void debug_ifa_cacheinfo(int lev, struct rtattr *ifa, const char *name); void conv_ifa_flags(int flags, char *flags_list, int len); const char *conv_ifa_scope(int scope, unsigned char debug); /* ndmsg.c */ int create_ndlist(struct msghdr *msg); void print_ndlist(void); int parse_ndmsg(struct nlmsghdr *nlh); int parse_rtm_newneigh(char *ndm_type, struct ndmsg *ndm, struct ndlist_entry *ndle_tmp); int parse_rtm_delneigh(char *ndm_type, struct ndmsg *ndm, struct ndlist_entry *ndle_tmp); void debug_ndmsg(int lev, struct ndmsg *ndm, struct rtattr *nda[], int ndm_len); void debug_nda_cacheinfo(int lev, struct rtattr *nda, const char *name); const char *conv_nud_state(int state, unsigned char debug); const char *conv_ntf_flags(int flags, unsigned char debug); /* rtmsg.c */ int parse_rtmsg(struct nlmsghdr *nlh); void debug_rtmsg(int lev, struct rtmsg *rtm, struct rtattr *rta[], int rtm_len); void debug_rta_metrics(int lev, struct rtattr *rta, const char *name); void debug_rta_multipath(int lev, struct rtmsg *rtm, struct rtattr *rta, const char *name); void debug_rta_cacheinfo(int lev, struct rtattr *rta, const char *name); const char *conv_rt_table(int table, unsigned char debug); const char *conv_rtprot(int protocol, unsigned char debug); const char *conv_rt_scope(int scope); const char *conv_rtn_type(int type, unsigned char debug); void conv_rtm_flags(int flags, char *flags_list, int len); void conv_rtnh_flags(int flags, char *flags_list, int len); /* frhdr.c */ #ifdef HAVE_LINUX_FIB_RULES_H int parse_frhdr(struct nlmsghdr *nlh); void debug_frhdr(int lev, struct fib_rule_hdr *frh, struct rtattr *fra[], int frh_len); const char *conv_fr_act(int action, unsigned char debug); void conv_fib_rule_flags(int flags, char *flags_list, int len); #endif /* tcmsg_qdisc.c */ int parse_tcmsg_qdisc(struct nlmsghdr *nlh); void conv_unit_rate(char *str, int len, double num); void conv_unit_size(char *str, int len, double num); void conv_unit_usec(char *str, int len, double usec); int get_us2tick(void); double get_burst_size(unsigned rate, unsigned buffer); double get_latency(unsigned rate, unsigned buffer, unsigned limit); void debug_tcmsg(int lev, struct nlmsghdr *nlh, struct tcmsg *tcm, struct rtattr *tca[], int tcm_len); void debug_tca_options(int lev, struct tcmsg *tcm, struct rtattr *tca, const char *name, char *kind, int len); void debug_tca_stats(int lev, struct rtattr *tca, const char *name); void debug_tca_xstats(int lev, struct rtattr *tca, const char *name, char *kind, int len); void debug_tca_rate(int lev, struct rtattr *tca, const char *name); void debug_tca_stats2(int lev, struct rtattr *tca, const char *name); void debug_tca_stats2_attr(int lev, struct rtattr *tca); void debug_tca_stats_basic(int lev, struct rtattr *stats2, const char *name); void debug_tca_stats_rate_est(int lev, struct rtattr *stats2, const char *name); void debug_tca_stats_queue(int lev, struct rtattr *stats2, const char *name); void debug_tca_stats_app(int lev, struct rtattr *stats2, const char *name); #if HAVE_DECL_TCA_STAB_UNSPEC void debug_tca_stab(int lev, struct rtattr *tca, const char *name); void debug_tca_stab_base(int lev, struct rtattr *stab, const char *name); #endif void debug_tc_ratespec(int lev, struct tc_ratespec *rate, char *name); /* tcmsg_qdisc_prio.c */ int parse_tca_options_prio(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_prio(int lev, struct rtattr *tca, const char *name); /* tcmsg_qdisc_fifo.c */ int parse_tca_options_pfifo(char *msg, char **mp, struct rtattr *tca); int parse_tca_options_bfifo(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_fifo(int lev, struct rtattr *tca, const char *name); /* tcmsg_qdisc_multiq.c */ #ifdef HAVE_STRUCT_TC_MULTIQ_QOPT_BANDS int parse_tca_options_multiq(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_multiq(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_plug.c */ #ifdef HAVE_STRUCT_TC_PLUG_QOPT_ACTION int parse_tca_options_plug(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_plug(int lev, struct rtattr *tca, const char *name); const char *conv_tcq_plug_action(int action); #endif /* tcmsg_qdisc_tbf.c */ int parse_tca_options_tbf(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_tbf(int lev, struct rtattr *tca, const char *name); void debug_tca_tbf_parms(int lev, struct rtattr *tbf, const char *name); /* tcmsg_qdisc_sfq.c */ int parse_tca_options_sfq(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_sfq(int lev, struct rtattr *tca, const char *name); #ifdef HAVE_STRUCT_TC_SFQ_XSTATS_ALLOT void debug_tc_sfq_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_red.c */ int parse_tca_options_red(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_red(int lev, struct rtattr *tca, const char *name); void debug_tca_red_parms(int lev, struct rtattr *red, const char *name); void debug_tc_red_xstats(int lev, struct rtattr *tca, const char *name); void conv_tc_red_flags(int flags, char *flags_list, int len, unsigned char debug); /* tcmsg_qdisc_gred.c */ int parse_tca_options_gred(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_gred(int lev, struct rtattr *tca, const char *name); void debug_tca_gred_parms(int lev, struct rtattr *gred, const char *name); void debug_tca_gred_dps(int lev, struct rtattr *gred, const char *name); #if HAVE_DECL_TCA_GRED_MAX_P void debug_tca_gred_max_p(int lev, struct rtattr *gred, const char *name); #endif /* tcmsg_qdisc_choke.c */ #if HAVE_DECL_TCA_CHOKE_UNSPEC int parse_tca_options_choke(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_choke(int lev, struct rtattr *tca, const char *name); void debug_tca_choke_parms(int lev, struct rtattr *choke, const char *name); void debug_tc_choke_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_htb.c */ int parse_tca_options_htb(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_htb(int lev, struct rtattr *tca, const char *name); void debug_tca_htb_parms(int lev, struct rtattr *htb, const char *name); void debug_tca_htb_init(int lev, struct rtattr *htb, const char *name); void debug_tc_htb_xstats(int lev, struct rtattr *tca, const char *name); /* tcmsg_qdisc_hfsc.c */ int parse_tca_options_hfsc(char *msg, char **mp, struct rtattr *tca); int print_hfsc_sc(char *msg, char **mp, char *name, struct tc_service_curve *sc); void debug_tca_options_hfsc(int lev, struct rtattr *tca, const char *name); void debug_tca_hfsc_sc(int lev, struct rtattr *hfsc, const char *name); /* tcmsg_qdisc_cbq.c */ #if HAVE_DECL_TCA_CBQ_UNSPEC int parse_tca_options_cbq(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_cbq(int lev, struct rtattr *tca, const char *name); void debug_tca_cbq_lssopt(int lev, struct rtattr *cbq, const char *name); void debug_tca_cbq_wrropt(int lev, struct rtattr *cbq, const char *name); void debug_tca_cbq_fopt(int lev, struct rtattr *cbq, const char *name); void debug_tca_cbq_ovl_strategy(int lev, struct rtattr *cbq, const char *name); void debug_tca_cbq_rate(int lev, struct rtattr *cbq, const char *name); void debug_tca_cbq_police(int lev, struct rtattr *cbq, const char *name); void debug_tc_cbq_xstats(int lev, struct rtattr *tca, const char *name); void conv_tcf_cbq_lss_change(int change, char *change_list, int len); void conv_tcf_cbq_lss_flags(int flags, char *flags_list, int len); void conv_tc_cbq_ovl_strategy(int strategy, char *strategy_list, int len); #endif /* tcmsg_qdisc_dsmark.c */ #if HAVE_DECL_TCA_DSMARK_UNSPEC int parse_tca_options_dsmark(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_dsmark(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_netem.c */ int parse_tca_options_netem(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_netem(int lev, struct rtattr *tca, const char *name); void debug_tca_netem_corr(int lev, struct rtattr *netem, const char *name); void debug_tca_netem_reorder(int lev, struct rtattr *netem, const char *name); void debug_tca_netem_corrupt(int lev, struct rtattr *netem, const char *name); #if HAVE_DECL_TCA_NETEM_LOSS void debug_tca_netem_loss(int lev, struct rtattr *netem, const char *name); void debug_netem_loss_gi(int lev, struct rtattr *loss, const char *name); void debug_netem_loss_ge(int lev, struct rtattr *loss, const char *name); #endif #if HAVE_DECL_TCA_NETEM_RATE void debug_tca_netem_rate(int lev, struct rtattr *netem, const char *name); #endif /* tcmsg_qdisc_drr.c */ #if HAVE_DECL_TCA_DRR_UNSPEC int parse_tca_options_drr(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_drr(int lev, struct rtattr *tca, const char *name); void debug_tc_drr_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_sfb.c */ #if HAVE_DECL_TCA_SFB_UNSPEC int parse_tca_options_sfb(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_sfb(int lev, struct rtattr *tca, const char *name); void debug_tca_sfb_parms(int lev, struct rtattr *sfb, const char *name); void debug_tc_sfb_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_qfq.c */ #if HAVE_DECL_TCA_QFQ_UNSPEC int parse_tca_options_qfq(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_qfq(int lev, struct rtattr *tca, const char *name); void debug_tc_qfq_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_codel.c */ #if HAVE_DECL_TCA_CODEL_UNSPEC int parse_tca_options_codel(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_codel(int lev, struct rtattr *tca, const char *name); void debug_tc_codel_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_qdisc_fq_codel.c */ #if HAVE_DECL_TCA_FQ_CODEL_UNSPEC int parse_tca_options_fq_codel(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_fq_codel(int lev, struct rtattr *tca, const char *name); void debug_tc_fq_codel_xstats(int lev, struct rtattr *tca, const char *name); #endif /* tcmsg_filter.c */ int parse_tcmsg_filter(struct nlmsghdr *nlh); int parse_tca_classid(char *msg, char **mp, struct rtattr *tca); int parse_tca_indev(char *msg, char **mp, struct rtattr *tca); int parse_tca_mask(char *msg, char **mp, struct rtattr *tca); void parse_u32_handle(char *p, int len, unsigned handle); int parse_tca_ematch(char *msg, char *mp, struct rtattr *tca); int parse_tca_ematch_tree_hdr(struct rtattr *em_tree, int *num); int parse_tca_ematch_tree_list(char *msg, char *mp, struct rtattr *em_tree, int num); #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H int parse_ematch_cmp(char *msg, char *mp, void *p, int len); #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H int parse_ematch_nbyte(char *msg, char *mp, void *p, int len); #endif int parse_ematch_u32(char *msg, char *mp, void *p, int len); #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H int parse_ematch_meta(char *msg, char *mp, void *p, int len); int parse_tca_em_meta_value(char *msg, char **mp, struct tcf_meta_val *val, struct rtattr *meta); #endif void debug_tca_ematch(int lev, struct rtattr *tca, const char *name); int debug_tca_ematch_tree_hdr(int lev, struct rtattr *ematch, const char *name); void debug_tca_ematch_tree_list(int lev, struct rtattr *em_tree, const char *name, int num); #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H void debug_ematch_cmp(int lev, void *p, int len); #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H void debug_ematch_nbyte(int lev, void *p, int len); #endif void debug_ematch_u32(int lev, void *p, int len); #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H void debug_ematch_meta(int lev, void *p, int len); struct tcf_meta_hdr *debug_tca_em_meta_hdr(int lev, struct rtattr *meta, const char *name); void debug_tca_em_meta_value(int lev, struct rtattr *meta, const char *name, struct tcf_meta_val *p); #endif void conv_tc_u32_flags(int flags, char *flags_list, int len, unsigned char debug); const char *conv_eth_p(unsigned short proto, unsigned char debug); const char *conv_tcf_em_kind(int kind, unsigned char debug); const char *conv_tcf_em_flag(int flag, unsigned char debug); #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H const char *conv_tcf_em_align(int align, unsigned char debug); #endif const char *conv_tcf_em_opnd(int opnd, unsigned char debug); #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H const char *conv_tcf_meta_type(int type, unsigned char debug); const char *conv_tcf_meta_id(int id, unsigned char debug); #endif /* tcmsg_filter_u32.c */ int parse_tca_options_u32(char *msg, char **mp, struct rtattr *tca); int parse_tca_u32_hash(char *msg, char **mp, struct rtattr *u32); int parse_tca_u32_link(char *msg, char **mp, struct rtattr *u32); int parse_tca_u32_divisor(char *msg, char **mp, struct rtattr *u32); int parse_tca_u32_mark(char *msg, char **mp, struct rtattr *u32); int parse_tca_u32_sel(char *msg, char *mp, struct rtattr *u32); void debug_tca_options_u32(int lev, struct rtattr *tca, const char *name); void debug_tca_u32_link(int lev, struct rtattr *u32, const char *name); void debug_tca_u32_sel(int lev, struct rtattr *u32, const char *name); void debug_tca_u32_pcnt(int lev, struct rtattr *u32[], const char *name); void debug_tca_u32_mark(int lev, struct rtattr *u32, const char *name); const char *conv_tca_u32_hash(unsigned num, unsigned char debug); /* tcmsg_filter_rsvp.c */ int parse_tca_options_rsvp(char *msg, char **mp, struct tcmsg *tcm, struct rtattr *tca); int parse_tca_rsvp_dst(char *msg, char **mp, struct tcmsg *tcm, struct rtattr *rsvp); int parse_tca_rsvp_src(char *msg, char **mp, struct tcmsg *tcm, struct rtattr *rsvp); int parse_tca_rsvp_pinfo(char *msg, char **mp, struct rtattr *rsvp); void debug_tca_options_rsvp(int lev, struct tcmsg *tcm, struct rtattr *tca, const char *name); void debug_tca_rsvp_pinfo(int lev, struct rtattr *rsvp, const char *name); /* tcmsg_filter_route.c */ int parse_tca_options_route(char *msg, char **mp, struct rtattr *tca); int parse_tca_route4_from(char *msg, char **mp, struct rtattr *route); int parse_tca_route4_to(char *msg, char **mp, struct rtattr *route); int parse_tca_route4_iif(char *msg, char **mp, struct rtattr *route); void debug_tca_options_route(int lev, struct rtattr *tca, const char *name); /* tcmsg_filter_fw.c */ int parse_tca_options_fw(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_fw(int lev, struct rtattr *tca, const char *name); /* tcmsg_filter_tcindex.c */ int parse_tca_options_tcindex(char *msg, char **mp, struct rtattr *tca); int parse_tca_tcindex_hash(char *msg, char **mp, struct rtattr *tcindex); int parse_tca_tcindex_mask(char *msg, char **mp, struct rtattr *tcindex); int parse_tca_tcindex_shift(char *msg, char **mp, struct rtattr *tcindex); int parse_tca_tcindex_fall_through(char *msg, char **mp, struct rtattr *tcindex); void debug_tca_options_tcindex(int lev, struct rtattr *tca, const char *name); /* tcmsg_filter_flow.c */ #if HAVE_DECL_TCA_FLOW_UNSPEC int parse_tca_options_flow(char *msg, char **mp, struct rtattr *tca); int parse_tca_flow_keys(char *msg, char **mp, struct rtattr *flow); int parse_tca_flow_mode(char *msg, char **mp, struct rtattr *flow); int parse_tca_flow_xor(char *msg, char **mp, struct rtattr *flow); int parse_tca_flow_rshift(char *msg, char **mp, struct rtattr *flow); int parse_tca_flow_addend(char *msg, char **mp, struct rtattr *flow); int parse_tca_flow_divisor(char *msg, char **mp, struct rtattr *flow); int parse_tca_flow_perturb(char *msg, char **mp, struct rtattr *flow); void debug_tca_options_flow(int lev, struct rtattr *tca, const char *name); const char *conv_flow_key(unsigned flags, unsigned char debug); const char *conv_flow_mode(unsigned mode, unsigned char debug); #endif /* tcmsg_filter_basic.c */ int parse_tca_options_basic(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_basic(int lev, struct rtattr *tca, const char *name); /* tcmsg_filter_cgroup.c */ #if HAVE_DECL_TCA_CGROUP_UNSPEC int parse_tca_options_cgroup(char *msg, char **mp, struct rtattr *tca); void debug_tca_options_cgroup(int lev, struct rtattr *tca, const char *name); #endif /* tcamsg.c */ int parse_tcamsg(struct nlmsghdr *nlh); int parse_tca_acts(char *msg, char *mp, struct rtattr *tcaa); int parse_tca_act(char *msg, char *mp, struct rtattr *acts); void debug_tcamsg(int lev, struct tcamsg *tcam, struct rtattr *tcaa[], int tcam_len); void debug_tca_acts(int lev, struct rtattr *tcaa, const char *name); void debug_tca_act(int lev, struct rtattr *acts); void debug_tca_act_options(int lev, struct rtattr *act, const char *name, char *kind, int len); void debug_tca_act_stats(int lev, struct rtattr *act, const char *name); void debug_tcf_t(int lev, struct tcf_t *tm); const char *conv_tc_action(int action, unsigned char debug); /* tcamsg_police.c */ int parse_tca_act_options_police(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_police(int lev, struct rtattr *act, const char *name); void debug_tca_police_tbf(int lev, struct rtattr *police, const char *name); const char *conv_tc_police_action(unsigned action, unsigned char debug); /* tcamsg_gact.c */ int parse_tca_act_options_gact(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_gact(int lev, struct rtattr *act); void debug_tca_gact_tm(int lev, struct rtattr *gact, const char *name); void debug_tca_gact_parms(int lev, struct rtattr *gact, const char *name); void debug_tca_gact_prob(int lev, struct rtattr *gact, const char *name); const char *conv_pgact(int pgact, unsigned char debug); /* tcamsg_pedit.c */ int parse_tca_act_options_pedit(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_pedit(int lev, struct rtattr *act); void debug_tca_pedit_tm(int lev, struct rtattr *pedit, const char *name); void debug_tca_pedit_parms(int lev, struct rtattr *pedit, const char *name); /* tcamsg_mirred.c */ int parse_tca_act_options_mirred(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_mirred(int lev, struct rtattr *act); void debug_tca_mirred_tm(int lev, struct rtattr *mirred, const char *name); void debug_tca_mirred_parms(int lev, struct rtattr *mirred, const char *name); const char *conv_tca_mirred_action(int action, unsigned char debug); /* tcamsg_nat.c */ #ifdef HAVE_LINUX_TC_ACT_TC_NAT_H int parse_tca_act_options_nat(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_nat(int lev, struct rtattr *act); void debug_tca_nat_parms(int lev, struct rtattr *nat, const char *name); void debug_tca_nat_tm(int lev, struct rtattr *nat, const char *name); #endif /* tcamsg_skbedit.c */ #ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H int parse_tca_act_options_skbedit(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_skbedit(int lev, struct rtattr *act); void debug_tca_skbedit_tm(int lev, struct rtattr *skb, const char *name); void debug_tca_skbedit_parms(int lev, struct rtattr *skb, const char *name); #endif /* tcamsg_csum.c */ #ifdef HAVE_LINUX_TC_ACT_TC_CSUM_H int parse_tca_act_options_csum(char *msg, char *mp, struct rtattr *act); void debug_tca_act_options_csum(int lev, struct rtattr *act); void debug_tca_csum_tm(int lev, struct rtattr *csum, const char *name); void debug_tca_csum_parms(int lev, struct rtattr *csum, const char *name); void conv_tca_csum_update_flags(int flags, char *flags_list, int len, unsigned char debug); #endif #define APPEND_SNPRINTF(RC, P, LEN, ...) do { \ int RC = snprintf(P, LEN, __VA_ARGS__); \ RC = RC < 0 ? 0 : RC >= LEN ? LEN : RC; \ P += RC; \ LEN -= RC; \ } while(0) #endif /* _NIELD_ */ nield-0.6.2/src/nlmsg.c000066400000000000000000000057561470100110300146650ustar00rootroot00000000000000/* * nlmsg.c - netlink message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" /* * debug netlink messages */ void debug_nlmsg(int lev, struct nlmsghdr *nlh) { /* logging struct nlmsghdr */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ nlmsghdr(%d) ]", NLMSG_HDRLEN); rec_dbg(lev, " nlmsg_len(%d): %u", sizeof(nlh->nlmsg_len), nlh->nlmsg_len); rec_dbg(lev, " nlmsg_type(%d): %hu(%s)", sizeof(nlh->nlmsg_type), nlh->nlmsg_type, debug_n2s_nlmsg_type(nlh->nlmsg_type)); rec_dbg(lev, " nlmsg_flags(%d): %hu", sizeof(nlh->nlmsg_flags), nlh->nlmsg_flags); rec_dbg(lev, " nlmsg_seq(%d): %u", sizeof(nlh->nlmsg_seq), nlh->nlmsg_seq); rec_dbg(lev, " nlmsg_pid(%d): %u", sizeof(nlh->nlmsg_pid), nlh->nlmsg_pid); return; } /* * convert a netlink message type from number to string */ const char *debug_n2s_nlmsg_type(int type) { #define _NLMSG_TYPE(s) \ if(type == RTM_##s) \ return #s; _NLMSG_TYPE(NEWLINK); _NLMSG_TYPE(DELLINK); _NLMSG_TYPE(GETLINK); _NLMSG_TYPE(SETLINK); _NLMSG_TYPE(NEWADDR); _NLMSG_TYPE(DELADDR); _NLMSG_TYPE(GETADDR); _NLMSG_TYPE(NEWROUTE); _NLMSG_TYPE(DELROUTE); _NLMSG_TYPE(GETROUTE); _NLMSG_TYPE(NEWNEIGH); _NLMSG_TYPE(DELNEIGH); _NLMSG_TYPE(GETNEIGH); _NLMSG_TYPE(NEWRULE); _NLMSG_TYPE(DELRULE); _NLMSG_TYPE(GETRULE); _NLMSG_TYPE(NEWQDISC); _NLMSG_TYPE(DELQDISC); _NLMSG_TYPE(GETQDISC); _NLMSG_TYPE(NEWTCLASS); _NLMSG_TYPE(DELTCLASS); _NLMSG_TYPE(GETTCLASS); _NLMSG_TYPE(NEWTFILTER); _NLMSG_TYPE(DELTFILTER); _NLMSG_TYPE(GETTFILTER); _NLMSG_TYPE(NEWACTION); _NLMSG_TYPE(DELACTION); _NLMSG_TYPE(GETACTION); _NLMSG_TYPE(NEWPREFIX); _NLMSG_TYPE(GETMULTICAST); _NLMSG_TYPE(GETANYCAST); _NLMSG_TYPE(NEWNEIGHTBL); _NLMSG_TYPE(GETNEIGHTBL); _NLMSG_TYPE(SETNEIGHTBL); #ifdef RTM_NEWDUSEROPT _NLMSG_TYPE(NEWNDUSEROPT); #endif _NLMSG_TYPE(NEWADDRLABEL); _NLMSG_TYPE(DELADDRLABEL); _NLMSG_TYPE(GETADDRLABEL); #ifdef RTM_GETDCB _NLMSG_TYPE(GETDCB); #endif #ifdef RTM_SETDCB _NLMSG_TYPE(SETDCB); #endif #undef _NLMSG_TYPE return("UNKNOWN"); } nield-0.6.2/src/rta.c000066400000000000000000000301521470100110300143170ustar00rootroot00000000000000/* * rta.c - interface information message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * check attribute payload length for debug */ int debug_rta_len_chk(int lev, struct rtattr *rta, const char *name, size_t len) { if(RTA_PAYLOAD(rta) < len) { rec_dbg(lev, "%s(%hu): -- payload too short --", name, RTA_ALIGN(rta->rta_len)); return(1); } return(0); } /* * ignore attribute */ void debug_rta_ignore(int lev, struct rtattr *rta, const char *name) { rec_dbg(lev, "%s(%hu): -- ignored --", name, RTA_ALIGN(rta->rta_len)); } /* * no value attribute */ void debug_rta_none(int lev, struct rtattr *rta, const char *name) { rec_dbg(lev, "%s(%hu): -- none --", name, RTA_ALIGN(rta->rta_len)); } /* * debug unsigned char attribute */ void debug_rta_u8(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned char num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned char))) return; unsigned char data = *(unsigned char *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): %u(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): %u", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned char attribute */ void debug_rta_u8x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned char num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned char))) return; unsigned char data = *(unsigned char *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): %02x(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): %02x", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned short attribute */ void debug_rta_u16(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned short))) return; unsigned short data = *(unsigned short *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): %hu(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): %hu", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned short attribute */ void debug_rta_u16x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned short))) return; unsigned short data = *(unsigned short *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): 0x%04x(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): 0x%04x", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned short attribute */ void debug_rta_n16(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned short))) return; unsigned short data = ntohs(*(unsigned short *)RTA_DATA(rta)); if(conv) rec_dbg(lev, "%s(%hu): %hu(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): %hu", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned short attribute */ void debug_rta_n16x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned short num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned short))) return; unsigned short data = ntohs(*(unsigned short *)RTA_DATA(rta)); if(conv) rec_dbg(lev, "%s(%hu): 0x%04x(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): 0x%04x", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned attribute */ void debug_rta_u32(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned))) return; unsigned data = *(unsigned *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): %u(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): %u", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug unsigned attribute */ void debug_rta_u32x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(unsigned num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned))) return; unsigned data = *(unsigned *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): 0x%08u(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): 0x%08u", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug int attribute */ void debug_rta_s32(int lev, struct rtattr *rta, const char *name, const char *(*conv)(int num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(int))) return; int data = *(int *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): %d(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): %d", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug int attribute */ void debug_rta_s32x(int lev, struct rtattr *rta, const char *name, const char *(*conv)(int num, unsigned char debug)) { if(debug_rta_len_chk(lev, rta, name, sizeof(int))) return; int data = *(int *)RTA_DATA(rta); if(conv) rec_dbg(lev, "%s(%hu): 0x%08x(%s)", name, RTA_ALIGN(rta->rta_len), data, conv(data, 1)); else rec_dbg(lev, "%s(%hu): 0x%08x", name, RTA_ALIGN(rta->rta_len), data); return; } /* * debug string attribute */ void debug_rta_str(int lev, struct rtattr *rta, const char *name, char *str, unsigned len) { if(RTA_PAYLOAD(rta) > len) { rec_dbg(lev, "%s(%hu): -- payload too long --", name, RTA_ALIGN(rta->rta_len)); return; } char *p = (char *)malloc(len); if(p == NULL) return; memset(p, 0, len); /* always p[len] == NULL */ strncpy(p, (char *)RTA_DATA(rta), len - 1); rec_dbg(lev, "%s(%hu): %s", name, RTA_ALIGN(rta->rta_len), p); if(str) strncpy(str, p, len); free(p); return; } /* * debug interface index attribute */ void debug_rta_ifindex(int lev, struct rtattr *rta, const char *name) { unsigned ifindex; char ifname[IFNAMSIZ] = ""; if(debug_rta_len_chk(lev, rta, name, sizeof(unsigned))) return; ifindex = *(unsigned *)RTA_DATA(rta); if_indextoname_from_lists(ifindex, ifname); rec_dbg(lev, "%s(%hu): %u(%s)", name, RTA_ALIGN(rta->rta_len), ifindex, ifname); return; } /* * debug ARPHRD_* address attribute */ void debug_rta_arphrd(int lev, struct rtattr *rta, const char *name, unsigned short type) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = arphrd_ntop(type, rta, addr, sizeof(addr)); if(res) { rec_dbg(lev, "%s(%hu): -- %s --", name, RTA_ALIGN(rta->rta_len), (res == 1) ? strerror(errno) : "payload too short"); return; } rec_dbg(lev, "%s(%hu): %s", name, RTA_ALIGN(rta->rta_len), addr); return; } /* * convert interface address from binary to text */ int arphrd_ntop(unsigned short type, struct rtattr *ifla, char *dst, int dstlen) { unsigned char *src = RTA_DATA(ifla); int i, srclen = RTA_PAYLOAD(ifla); char *p = dst; switch(type) { case ARPHRD_TUNNEL: case ARPHRD_IPGRE: case ARPHRD_SIT: if(srclen < 4) return(2); if(!inet_ntop(AF_INET, src, dst, dstlen)) return(1); return(0); case ARPHRD_TUNNEL6: #ifdef ARPHRD_IP6GRE case ARPHRD_IP6GRE: #endif if(srclen < 16) return(2); if(!inet_ntop(AF_INET6, src, dst, dstlen)) return(1); return(0); } for(i = 0; i < srclen; i++) APPEND_SNPRINTF(rc, p, dstlen, "%02x%s", src[i], (i + 1 == srclen) ? "" : ":"); return(0); } /* * debug AF_* address attribute */ void debug_rta_af(int lev, struct rtattr *rta, const char *name, unsigned short family) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = inet_ntop_ifa(family, rta, addr, sizeof(addr)); if(res) { rec_dbg(lev, "%s(%hu): -- %s --", name, RTA_ALIGN(rta->rta_len), (res == 1) ? strerror(errno) : "payload too short"); return; } rec_dbg(lev, "%s(%hu): %s", name, RTA_ALIGN(rta->rta_len), addr); return; } /* * convert interface address from binary to text */ int inet_ntop_ifa(int family, struct rtattr *ifa, char *saddr, int slen) { unsigned char *addr = (unsigned char *)RTA_DATA(ifa); int len = RTA_PAYLOAD(ifa); switch(family) { case AF_INET: if(len < 4) return(2); break; case AF_INET6: if(len < 16) return(2); break; } if(!inet_ntop(family, addr, saddr, slen)) return(1); return(0); } /* * debug attribute */ void debug_rta_tc_addr(int lev, struct tcmsg *tcm, struct rtattr *rta, const char *name) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = inet_ntop_tc_addr(tcm, rta, addr, sizeof(addr)); if(res) { rec_dbg(lev, "%s(%hu): -- %s --", name, RTA_ALIGN(rta->rta_len), (res == 1) ? strerror(errno) : "payload too short"); return; } rec_dbg(lev, "%s(%hu): %s", name, RTA_ALIGN(rta->rta_len), addr); } /* * convert interface address from binary to text */ int inet_ntop_tc_addr(struct tcmsg *tcm, struct rtattr *tca, char *saddr, int slen) { int af = -1; unsigned char *addr = (unsigned char *)RTA_DATA(tca); int len = RTA_PAYLOAD(tca); switch(ntohs(TC_H_MIN(tcm->tcm_info))) { case ETH_P_IP: af = AF_INET; if(len < 4) return(2); break; case ETH_P_IPV6: af = AF_INET6; if(len < 16) return(2); break; } if(!inet_ntop(af, addr, saddr, slen)) return(1); return(0); } /* * debug attribute TCA_*_CLASSID */ void debug_tca_classid(int lev, struct rtattr *tca, const char *name) { unsigned n_classid; char s_classid[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, tca, name, sizeof(n_classid))) return; n_classid = *(unsigned *)RTA_DATA(tca); parse_tc_handle(s_classid, sizeof(s_classid), n_classid); rec_dbg(lev, "%s(%hu): 0x%08x(%s)", name, RTA_ALIGN(tca->rta_len), n_classid, s_classid); } /* * parse qdisc handle */ void parse_tc_handle(char *p, int len, unsigned id) { if (id == TC_H_ROOT) snprintf(p, len, "root"); else if(id == TC_H_INGRESS) snprintf(p, len, "ingress"); else if(id == TC_H_UNSPEC) snprintf(p, len, "none"); else if(!TC_H_MAJ(id)) snprintf(p, len, ":%x", TC_H_MIN(id)); else if(!TC_H_MIN(id)) snprintf(p, len, "%x:", TC_H_MAJ(id)>>16); else if(id) snprintf(p, len, "%x:%x", TC_H_MAJ(id)>>16, TC_H_MIN(id)); } nield-0.6.2/src/rtmsg.c000066400000000000000000000450421470100110300146710ustar00rootroot00000000000000/* * rtmsg.c - route message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse route message */ int parse_rtmsg(struct nlmsghdr *nlh) { struct rtmsg *rtm; int rtm_len; struct rtattr *rta[__RTA_MAX]; char ipv[MAX_STR_SIZE] = ""; char msg[MAX_MSG_SIZE] = ""; char *mp = msg; int log_opts = get_log_opts(); int res; /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get rtmsg */ rtm_len = NLMSG_PAYLOAD(nlh, 0); if(rtm_len < sizeof(*rtm)) { rec_log("error: %s: rtmsg: length too short", __func__); return(1); } rtm = (struct rtmsg *)NLMSG_DATA(nlh); /* parse route attributes */ parse_rtattr(rta, RTA_MAX, RTM_RTA(rtm), RTM_PAYLOAD(nlh)); /* debug rtmsg */ if(log_opts & L_DEBUG) debug_rtmsg(0, rtm, rta, rtm_len); /* check address family */ char dst[INET6_ADDRSTRLEN] = ""; if(rtm->rtm_family == AF_INET) { strcpy(ipv, "ipv4"); strcpy(dst, "0.0.0.0"); } else if(rtm->rtm_family == AF_INET6) { strcpy(ipv, "ipv6"); strcpy(dst, "::"); } else { rec_log("error: %s: unknown address family: %d", __func__, rtm->rtm_family); return(1); } /* convert from table id to table name */ char table[MAX_STR_SIZE] = ""; snprintf(table, sizeof(table), "%s", conv_rt_table(rtm->rtm_table, 0)); if(!strncmp(table, "unknown", sizeof(table))) snprintf(table, sizeof(table), "%d", rtm->rtm_table); /* check route table id(other than RT_TABLE_LOCAL) */ if(rtm->rtm_table == RT_TABLE_LOCAL) return(1); /* check route protocol(other than RTPROT_UNSPEC) */ if(rtm->rtm_protocol == RTPROT_UNSPEC) return(1); /* check route flags(other then RTM_F_CLONED) */ if(rtm->rtm_flags & RTM_F_CLONED) return(1); /* get destination prefix */ if(rta[RTA_DST]) { res = inet_ntop_ifa(rtm->rtm_family, rta[RTA_DST], dst, sizeof(dst)); if(res) { rec_log("error: %s: RTA_DST: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } } /* no RTA_DST attribute if destination is a default gateway */ mp = add_log(msg, mp, "destination=%s/%d ", dst, rtm->rtm_dst_len); /* get source prefix */ if(rta[RTA_SRC]) { char src[INET6_ADDRSTRLEN] = ""; res = inet_ntop_ifa(rtm->rtm_family, rta[RTA_SRC], src, sizeof(src)); if(res == 1) { rec_log("error: %s: RTA_SRC: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } mp = add_log(msg, mp, "source=%s/%d ", src, rtm->rtm_src_len); } /* get preferred source address */ if(rta[RTA_PREFSRC]) { char prefsrc[INET6_ADDRSTRLEN] = ""; res = inet_ntop_ifa(rtm->rtm_family, rta[RTA_PREFSRC], prefsrc, sizeof(prefsrc)); if(res) { rec_log("error: %s: RTA_PREFSRC: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } mp = add_log(msg, mp, "preferred-source=%s ", prefsrc); } /* get tos */ if(rtm->rtm_tos) mp = add_log(msg, mp, "tos=0x%.2x ", rtm->rtm_tos); /* get ingress interface */ if(rta[RTA_IIF]) { unsigned iifindex; char iifname[IFNAMSIZ] = ""; if(RTA_PAYLOAD(rta[RTA_IIF]) < sizeof(iifindex)) { rec_log("error: %s: RTA_IIF: payload too short", __func__); return(1); } iifindex = *((unsigned *)RTA_DATA(rta[RTA_IIF])); if_indextoname_from_lists(iifindex, iifname); mp = add_log(msg, mp, "in=%s ", iifname); } /* get gateway address */ if(rta[RTA_GATEWAY]) { char nexthop[INET6_ADDRSTRLEN] = ""; res = inet_ntop_ifa(rtm->rtm_family, rta[RTA_GATEWAY], nexthop, sizeof(nexthop)); if(res) { rec_log("error: %s: RTA_GATEWAY: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } mp = add_log(msg, mp, "nexthop=%s ", nexthop); } /* get egress interface */ if(rta[RTA_OIF]) { unsigned oifindex; char oifname[IFNAMSIZ] = ""; if(RTA_PAYLOAD(rta[RTA_OIF]) < sizeof(oifindex)) { rec_log("error: %s: RTA_OIF: payload too short", __func__); return(1); } oifindex = *((unsigned *)RTA_DATA(rta[RTA_OIF])); if_indextoname_from_lists(oifindex, oifname); mp = add_log(msg, mp, "interface=%s ", oifname); } /* get priority(but metric) */ char metric[MAX_STR_SIZE] = ""; if(rta[RTA_PRIORITY]) { if(RTA_PAYLOAD(rta[RTA_PRIORITY]) < sizeof(int)) { rec_log("error: %s: RTA_PRIORITY: payload too short", __func__); return(1); } snprintf(metric, sizeof(metric), "metric=%d ", *((int *)RTA_DATA(rta[RTA_PRIORITY]))); } /* convert route message type */ char type[MAX_STR_SIZE] = ""; snprintf(type, sizeof(type), "%s", conv_rtn_type(rtm->rtm_type, 0)); /* convert route message protocol */ char proto[MAX_STR_SIZE] = ""; snprintf(proto, sizeof(proto), "%s", conv_rtprot(rtm->rtm_protocol, 0)); /* get table id & name */ if(rta[RTA_TABLE]) { int table_id = *(int *)RTA_DATA(rta[RTA_TABLE]); if(RTA_PAYLOAD(rta[RTA_TABLE]) < sizeof(int)) { rec_log("error: %s: RTA_TABLE: payload too short", __func__); return(1); } snprintf(table, sizeof(table), "%s", conv_rt_table(table_id, 0)); if(!strncmp(table, "unknown", sizeof(table))) snprintf(table, sizeof(table), "%d", table_id); } /* get multipath */ if(rta[RTA_MULTIPATH]) { struct rtnexthop *rtnh; int rtnh_len = RTA_PAYLOAD(rta[RTA_MULTIPATH]); struct rtattr *rtna[__RTA_MAX]; char rtnh_ifname[IFNAMSIZ] = ""; char rtnh_nexthop[INET6_ADDRSTRLEN] = ""; if(RTA_PAYLOAD(rta[RTA_MULTIPATH]) < sizeof(*rtnh)) { rec_log("error: %s: RTA_MULTIPATH: payload too short", __func__); return(1); } rtnh = RTA_DATA(rta[RTA_MULTIPATH]); for(; RTNH_OK(rtnh, rtnh_len); rtnh = RTNH_NEXT(rtnh), rtnh_len -= RTNH_ALIGN(rtnh->rtnh_len)) { parse_rtattr(rtna, RTA_MAX, RTNH_DATA(rtnh), rtnh->rtnh_len - sizeof(*rtnh)); if(rtna[RTA_GATEWAY]) { res = inet_ntop_ifa(rtm->rtm_family, rtna[RTA_GATEWAY], rtnh_nexthop, sizeof(rtnh_nexthop)); if(res) { rec_log("error: %s: RTA_GATEWAY: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } } /* get interface name & logging routing table message */ if_indextoname_from_lists(rtnh->rtnh_ifindex, rtnh_ifname); if(nlh->nlmsg_type == RTM_NEWROUTE) rec_log("%s route added: %snexthop=%s interface=%s " "%sweight=%d type=%s protocol=%s table=%s", ipv, msg, rtnh_nexthop, rtnh_ifname, metric, rtnh->rtnh_hops+1, type, proto, table); else if(nlh->nlmsg_type == RTM_DELROUTE) rec_log("%s route deleted: %snexthop=%s interface=%s " "%sweight=%d type=%s protocol=%s table=%s", ipv, msg, rtnh_nexthop, rtnh_ifname, metric, rtnh->rtnh_hops+1, type, proto, table); } return(0); } /* logging routing message */ if(nlh->nlmsg_type == RTM_NEWROUTE) rec_log("%s route added: %s%stype=%s protocol=%s table=%s", ipv, msg, metric, type, proto, table); else if(nlh->nlmsg_type == RTM_DELROUTE) rec_log("%s route deleted: %s%stype=%s proto=%s table=%s", ipv, msg, metric, type, proto, table); return(0); } /* * debug route message */ void debug_rtmsg(int lev, struct rtmsg *rtm, struct rtattr *rta[], int rtm_len) { /* debug rtmsg */ char flags_list[MAX_STR_SIZE] = ""; conv_rtm_flags(rtm->rtm_flags, flags_list, sizeof(flags_list)); rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ rtmsg(%d) ]", NLMSG_ALIGN(sizeof(struct rtmsg))); rec_dbg(lev, " rtm_family(%d): %d(%s)", sizeof(rtm->rtm_family), rtm->rtm_family, conv_af_type(rtm->rtm_family, 1)); rec_dbg(lev, " rtm_dst_len(%d): %d", sizeof(rtm->rtm_dst_len), rtm->rtm_dst_len); rec_dbg(lev, " rtm_src_len(%d): %d", sizeof(rtm->rtm_src_len), rtm->rtm_src_len); rec_dbg(lev, " rtm_tos(%d): %d", sizeof(rtm->rtm_tos), rtm->rtm_tos); rec_dbg(lev, " rtm_table(%d): %d(%s)", sizeof(rtm->rtm_table), rtm->rtm_table, conv_rt_table(rtm->rtm_table, 1)); rec_dbg(lev, " rtm_protocol(%d): %d(%s)", sizeof(rtm->rtm_protocol), rtm->rtm_protocol, conv_rtprot(rtm->rtm_protocol, 1)); rec_dbg(lev, " rtm_scope(%d): %d(%s)", sizeof(rtm->rtm_scope), rtm->rtm_scope, conv_rt_scope(rtm->rtm_scope)); rec_dbg(lev, " rtm_type(%d): %d(%s)", sizeof(rtm->rtm_type), rtm->rtm_type, conv_rtn_type(rtm->rtm_type, 1)); rec_dbg(lev, " rtm_flags(%d): %d(%s)", sizeof(rtm->rtm_flags), rtm->rtm_flags, flags_list); /* debug route attributes */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ rtmsg attributes(%d) ]", NLMSG_ALIGN(rtm_len - NLMSG_ALIGN(sizeof(struct rtmsg)))); if(rta[RTA_DST]) debug_rta_af(lev+1, rta[RTA_DST], "RTA_DST", rtm->rtm_family); if(rta[RTA_SRC]) debug_rta_af(lev+1, rta[RTA_SRC], "RTA_SRC", rtm->rtm_family); if(rta[RTA_IIF]) debug_rta_ifindex(lev+1, rta[RTA_IIF], "RTA_IIF"); if(rta[RTA_OIF]) debug_rta_ifindex(lev+1, rta[RTA_OIF], "RTA_OIF"); if(rta[RTA_GATEWAY]) debug_rta_af(lev+1, rta[RTA_GATEWAY], "RTA_GATEWAY", rtm->rtm_family); if(rta[RTA_PRIORITY]) debug_rta_s32(lev+1, rta[RTA_PRIORITY], "RTA_PRIORITY", NULL); if(rta[RTA_PREFSRC]) debug_rta_af(lev+1, rta[RTA_PREFSRC], "RTA_PREFSRC", rtm->rtm_family); if(rta[RTA_METRICS]) debug_rta_metrics(lev+1, rta[RTA_METRICS], "RTA_METRICS"); if(rta[RTA_MULTIPATH]) debug_rta_multipath(lev+1, rtm, rta[RTA_MULTIPATH], "RTA_MULTIPATH"); if(rta[RTA_FLOW]) debug_rta_u32(lev+1, rta[RTA_FLOW], "RTA_FLOW", NULL); if(rta[RTA_CACHEINFO]) debug_rta_cacheinfo(lev+1, rta[RTA_CACHEINFO], "RTA_CACHEINFO"); if(rta[RTA_TABLE]) debug_rta_s32(lev+1, rta[RTA_TABLE], "RTA_TABLE", conv_rt_table); #if HAVE_DECL_RTA_MARK if(rta[RTA_MARK]) debug_rta_u32(lev+1, rta[RTA_MARK], "RTA_MARK", NULL); #endif rec_dbg(lev, ""); return; } /* * debug attribute RTA_METRICS */ void debug_rta_metrics(int lev, struct rtattr *rta, const char *name) { struct rtattr *rtax[RTAX_MAX+1]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(rta->rta_len)); parse_rtattr(rtax, RTAX_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta)); if(rtax[RTAX_LOCK]) debug_rta_u32(lev+1, rtax[RTAX_LOCK], "RTAX_LOCK", NULL); if(rtax[RTAX_MTU]) debug_rta_u32(lev+1, rtax[RTAX_MTU], "RTAX_MTU", NULL); if(rtax[RTAX_ADVMSS]) debug_rta_u32(lev+1, rtax[RTAX_ADVMSS], "RTAX_ADVMSS", NULL); if(rtax[RTAX_HOPLIMIT]) debug_rta_s32(lev+1, rtax[RTAX_HOPLIMIT], "RTAX_HOPLIMIT", NULL); if(rtax[RTAX_WINDOW]) debug_rta_u32(lev+1, rtax[RTAX_WINDOW], "RTAX_WINDOW", NULL); } /* * debug attribute RTA_MULTIPATH */ void debug_rta_multipath(int lev, struct rtmsg *rtm, struct rtattr *rta, const char *name) { struct rtnexthop *rtnh; int rtnh_len = RTA_PAYLOAD(rta); struct rtattr *rtnha[__RTA_MAX]; char ifname[IFNAMSIZ] = ""; char flags_list[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, rta, name, sizeof(*rtnh))) return; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(rta->rta_len)); for(rtnh = RTA_DATA(rta); RTNH_OK(rtnh, rtnh_len); rtnh = RTNH_NEXT(rtnh), rtnh_len -= RTNH_ALIGN(rtnh->rtnh_len)) { conv_rtnh_flags(rtnh->rtnh_flags, flags_list, sizeof(flags_list)); if_indextoname_from_lists(rtnh->rtnh_ifindex, ifname); rec_dbg(lev, " [ rtnexthop(%d) ]", sizeof(*rtnh)); rec_dbg(lev, " rtnh_len(%d): %hu", sizeof(rtnh->rtnh_len), rtnh->rtnh_len); rec_dbg(lev, " rtnh_flags(%d): %d(%s)", sizeof(rtnh->rtnh_flags), rtnh->rtnh_flags, flags_list); rec_dbg(lev, " rtnh_hops(%d): %d", sizeof(rtnh->rtnh_hops), rtnh->rtnh_hops); rec_dbg(lev, " rtnh_ifindex(%d): %d(%s)", sizeof(rtnh->rtnh_ifindex), rtnh->rtnh_ifindex, ifname); parse_rtattr(rtnha, RTA_MAX, RTNH_DATA(rtnh), rtnh->rtnh_len - sizeof(*rtnh)); if(rtnha[RTA_GATEWAY]) debug_rta_af(lev+3, rtnha[RTA_GATEWAY], "RTA_GATEWAY", rtm->rtm_family); } } /* * debug attribute RTA_CACHEINFO */ void debug_rta_cacheinfo(int lev, struct rtattr *rta, const char *name) { struct rta_cacheinfo *rtac; if(debug_rta_len_chk(lev, rta, name, sizeof(*rtac))) return; rtac = (struct rta_cacheinfo *)RTA_DATA(rta); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(rta->rta_len)); rec_dbg(lev, " [ rta_cacheinfo(%d) ]", sizeof(*rtac)); rec_dbg(lev, " rta_clntref(%d): %u", sizeof(rtac->rta_clntref), rtac->rta_clntref); rec_dbg(lev, " rta_lastuse(%d): %u", sizeof(rtac->rta_lastuse), rtac->rta_lastuse); rec_dbg(lev, " rta_expires(%d): %d", sizeof(rtac->rta_expires), rtac->rta_expires); rec_dbg(lev, " rta_error(%d): %u", sizeof(rtac->rta_error), rtac->rta_error); rec_dbg(lev, " rta_used(%d): %u", sizeof(rtac->rta_used), rtac->rta_used); rec_dbg(lev, " rta_id(%d): %u", sizeof(rtac->rta_id), rtac->rta_id); rec_dbg(lev, " rta_ts(%d): %u", sizeof(rtac->rta_ts), rtac->rta_ts); rec_dbg(lev, " rta_tsage(%d): %u", sizeof(rtac->rta_tsage), rtac->rta_tsage); } /* * convert rtm_table from number to string */ const char *conv_rt_table(int table, unsigned char debug) { #define _RT_TABLE(s1, s2) \ if(table == RT_TABLE_##s1) \ return(debug ? #s1 : #s2); _RT_TABLE(UNSPEC, none); #if HAVE_DECL_RT_TABLE_COMPAT _RT_TABLE(COMPAT, compat); #endif _RT_TABLE(DEFAULT, default); _RT_TABLE(MAIN, main); _RT_TABLE(LOCAL, local); #undef _RT_TABLE return(debug ? "UNKNOWN" : "unknown"); } /* * convert rtm_protocol from number to string */ const char *conv_rtprot(int protocol, unsigned char debug) { #define _RTM_PROTOCOL(s1, s2) \ if(protocol == RTPROT_##s1) \ return(debug ? #s1: #s2); _RTM_PROTOCOL(UNSPEC, none); _RTM_PROTOCOL(REDIRECT, redirect); _RTM_PROTOCOL(KERNEL, kernel); _RTM_PROTOCOL(BOOT, boot); _RTM_PROTOCOL(STATIC, static); _RTM_PROTOCOL(GATED, gated); _RTM_PROTOCOL(RA, ra); _RTM_PROTOCOL(MRT, ra); _RTM_PROTOCOL(ZEBRA, zebra); _RTM_PROTOCOL(BIRD, bird); _RTM_PROTOCOL(DNROUTED, dnrouted); _RTM_PROTOCOL(XORP, xorp); _RTM_PROTOCOL(NTK, ntk); #if HAVE_DECL_RTPROT_DHCP _RTM_PROTOCOL(DHCP, dhcp); #endif #undef _RTM_PROTOCOL return(debug ? "UNKNOWN" : "unknown"); } /* * convert rtm_scope from number to string */ const char *conv_rt_scope(int scope) { #define _RT_SCOPE(s) \ if(scope == RT_SCOPE_##s) \ return(#s); _RT_SCOPE(UNIVERSE); _RT_SCOPE(SITE); _RT_SCOPE(LINK); _RT_SCOPE(HOST); _RT_SCOPE(NOWHERE); #undef _RT_SCOPE return("UNKNOWN"); } /* * convert rtm_type from number to string */ const char *conv_rtn_type(int type, unsigned char debug) { #define _RTN_TYPE(s1, s2) \ if(type == RTN_##s1) \ return(debug ? #s1 : #s2); _RTN_TYPE(UNSPEC, none); _RTN_TYPE(UNICAST, unicast); _RTN_TYPE(LOCAL, local); _RTN_TYPE(BROADCAST, broadcast); _RTN_TYPE(ANYCAST, anycast); _RTN_TYPE(MULTICAST, multicast); _RTN_TYPE(BLACKHOLE, blackhole); _RTN_TYPE(UNREACHABLE, unreachable); _RTN_TYPE(PROHIBIT, prohibit); _RTN_TYPE(THROW, throw); _RTN_TYPE(NAT, nat); _RTN_TYPE(XRESOLVE, external); #undef _RTN_TYPE return(debug ? "UNKNOWN" : "unknown"); } /* * convert rtm_flags from number to string */ void conv_rtm_flags(int flags, char *flags_list, int len) { if(!flags) { strncpy(flags_list, "NONE", len); return; } #define _RTM_FLAGS(s) \ if((flags & RTM_F_##s) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~RTM_F_##s) ? \ strncat(flags_list, #s ", ", len - strlen(flags_list) - 1) : \ strncat(flags_list, #s, len - strlen(flags_list) - 1); _RTM_FLAGS(NOTIFY); _RTM_FLAGS(CLONED); _RTM_FLAGS(EQUALIZE); _RTM_FLAGS(PREFIX); #undef _RTM_FLAGS if(!strlen(flags_list)) strncpy(flags_list, "UNKNOWN", len); } /* * convert rtnh_flags from number to string */ void conv_rtnh_flags(int flags, char *flags_list, int len) { if(!flags) { strncpy(flags_list, "NONE", len); return; } #define _RTNH_FLAGS(s) \ if((flags & RTNH_F_##s) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~RTNH_F_##s) ? \ strncat(flags_list, #s ", ", len - strlen(flags_list) - 1) : \ strncat(flags_list, #s, len - strlen(flags_list) - 1); _RTNH_FLAGS(DEAD); _RTNH_FLAGS(PERVASIVE); _RTNH_FLAGS(ONLINK); #undef _RTNH_FLAGS if(!strlen(flags_list)) strncpy(flags_list, "UNKNOWN", len); } nield-0.6.2/src/rtnetlink.h000066400000000000000000000102031470100110300155430ustar00rootroot00000000000000/* * rtnetlink.h - route attribute parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _RTNETLINK_ #define _RTNETLINK_ /* * parse route attributes */ static inline void parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta, int len, unsigned short flags) { unsigned short type; memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); while (RTA_OK(rta, len)) { type = rta->rta_type & ~flags; if (type <= max) tb[type] = rta; rta = RTA_NEXT(rta, len); } } static inline void parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) { parse_rtattr_flags(tb, max, rta, len, 0); } /* * parse route attributes nested */ static inline void parse_nested_rtattr(struct rtattr *tb[], int max, struct rtattr *rta) { parse_rtattr(tb, max, RTA_DATA(rta), RTA_PAYLOAD(rta)); } #ifndef IFLA_RTA #define IFLA_RTA(r) \ ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) #endif #ifndef IFLA_PAYLOAD #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) #endif /* * parse interface infromation attributes */ static inline void parse_ifinfo(struct rtattr *tb[], struct nlmsghdr *nlh) { struct ifinfomsg *ifim = NLMSG_DATA(nlh); parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(ifim), IFLA_PAYLOAD(nlh), 1<<15); } #ifndef NDA_RTA #define NDA_RTA(r) \ ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg)))) #endif #ifndef NDA_PAYLOAD #define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg)) #endif /* * parse neighbor discovery attributes */ static inline void parse_ndisc(struct rtattr *tb[], struct nlmsghdr *nlh) { struct ndmsg *ndm = NLMSG_DATA(nlh); parse_rtattr(tb, NDA_MAX, NDA_RTA(ndm), NDA_PAYLOAD(nlh)); } #ifndef IFA_RTA #define IFA_RTA(r) \ ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) #endif #ifndef IFA_PAYLOAD #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) #endif /* * parse interface address attributes */ static inline void parse_ifaddr(struct rtattr *tb[], struct nlmsghdr *nlh) { struct ifaddrmsg *ifam = NLMSG_DATA(nlh); parse_rtattr(tb, IFA_MAX, IFA_RTA(ifam), IFA_PAYLOAD(nlh)); } #ifdef HAVE_LINUX_FIB_RULES_H #ifndef FRA_RTA #define FRA_RTA(r) \ ((struct rtattr *)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct fib_rule_hdr)))) #endif #ifndef FRA_PAYLOAD #define FRA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct fib_rule_hdr)) #endif /* * parse fib rule attributes */ static inline void parse_frule(struct rtattr *tb[], struct nlmsghdr *nlh) { struct fib_rule_hdr *frh = NLMSG_DATA(nlh); parse_rtattr(tb, FRA_MAX, FRA_RTA(frh), FRA_PAYLOAD(nlh)); } #endif #ifndef TCA_RTA #define TCA_RTA(r) \ ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) #endif #ifndef TCA_PAYLOAD #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) #endif /* * parse traffic control attributes */ static inline void parse_tc(struct rtattr *tb[], struct nlmsghdr *nlh) { struct tcmsg *tcm = NLMSG_DATA(nlh); parse_rtattr(tb, TCA_MAX, TCA_RTA(tcm), TCA_PAYLOAD(nlh)); } #ifndef TA_RTA #define TA_RTA(r) \ ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) #endif #ifndef TA_PAYLOAD #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) #endif /* * parse traffic control attributes */ static inline void parse_tca(struct rtattr *tb[], struct nlmsghdr *nlh) { struct tcamsg *tcam = NLMSG_DATA(nlh); parse_rtattr(tb, TCAA_MAX, TA_RTA(tcam), TA_PAYLOAD(nlh)); } #endif nield-0.6.2/src/tcamsg.c000066400000000000000000000211141470100110300150050ustar00rootroot00000000000000/* * tcamsg.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse traffic control message */ int parse_tcamsg(struct nlmsghdr *nlh) { struct tcamsg *tcam; int tcam_len; struct rtattr *tcaa[TCAA_MAX+1]; char msg[MAX_MSG_SIZE] = ""; char *mp = msg; int log_opts = get_log_opts(); /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get tcamsg */ tcam_len = NLMSG_PAYLOAD(nlh, 0); if(tcam_len < sizeof(*tcam)) { rec_log("error: %s: length too short", __func__); return(1); } tcam = (struct tcamsg *)NLMSG_DATA(nlh); /* parse traffic control action message attributes */ parse_tca(tcaa, nlh); /* debug tcamsg */ if(log_opts & L_DEBUG) debug_tcamsg(0, tcam, tcaa, tcam_len); /* kind of message */ switch(nlh->nlmsg_type) { case RTM_NEWACTION: mp = add_log(msg, mp, "tc action added: "); break; case RTM_DELACTION: mp = add_log(msg, mp, "tc action deleted: "); break; default: return(1); } if(tcaa[TCA_ACT_TAB]) if(parse_tca_acts(msg, mp, tcaa[TCA_ACT_TAB])) return(1); return(0); } /* * parse actions */ int parse_tca_acts(char *msg, char *mp, struct rtattr *tcaa) { struct rtattr *acts[TCA_ACT_MAX_PRIO+1]; parse_nested_rtattr(acts, TCA_ACT_MAX_PRIO, tcaa); /* logging for each action */ int i; for(i = 0; i < TCA_ACT_MAX_PRIO; i++) if(acts[i] && parse_tca_act(msg, mp, acts[i])) return(1); return(0); } /* * parse attributes TCA_ACT_* */ int parse_tca_act(char *msg, char *mp, struct rtattr *acts) { struct rtattr *act[__TCA_ACT_MAX]; char kind[IFNAMSIZ] = ""; mp = add_log(msg, mp, "order=%d ", acts->rta_type); parse_nested_rtattr(act, __TCA_ACT_MAX-1, acts); if(act[TCA_ACT_KIND]) { strncpy(kind, (char *)RTA_DATA(act[TCA_ACT_KIND]), sizeof(kind)); mp = add_log(msg, mp, "action=%s ", kind); } if(act[TCA_ACT_OPTIONS]) { if(!strncmp(kind, "police", sizeof(kind))) { if(parse_tca_act_options_police(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); } else if(!strncmp(kind, "gact", sizeof(kind))) { if(parse_tca_act_options_gact(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); } else if(!strncmp(kind, "pedit", sizeof(kind))) { if(parse_tca_act_options_pedit(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); } else if(!strncmp(kind, "mirred", sizeof(kind))) { if(parse_tca_act_options_mirred(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); #ifdef HAVE_LINUX_TC_ACT_TC_NAT_H } else if(!strncmp(kind, "nat", sizeof(kind))) { if(parse_tca_act_options_nat(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); #endif #ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H } else if(!strncmp(kind, "skbedit", sizeof(kind))) { if(parse_tca_act_options_skbedit(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); #endif #ifdef HAVE_LINUX_TC_ACT_TC_CSUM_H } else if(!strncmp(kind, "csum", sizeof(kind))) { if(parse_tca_act_options_csum(msg, mp, act[TCA_ACT_OPTIONS])) return(1); return(0); #endif } } rec_log("%s", msg); return(0); } /* * debug traffic control action message */ void debug_tcamsg(int lev, struct tcamsg *tcam, struct rtattr *tcaa[], int tcam_len) { /* debug tcamsg */ rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ tcamsg(%d) ]", NLMSG_ALIGN(sizeof(*tcam))); rec_dbg(lev, " tca_family(%d): 0x%02x(%s)", sizeof(tcam->tca_family), tcam->tca_family, conv_af_type(tcam->tca_family, 1)); rec_dbg(lev, " tca__pad1(%d): 0x%02x", sizeof(tcam->tca__pad1), tcam->tca__pad1); rec_dbg(lev, " tca__pad2(%d): 0x%04x", sizeof(tcam->tca__pad2), tcam->tca__pad2); /* debug traffic control action attributes */ rec_dbg(lev,"*********************************************************************"); rec_dbg(lev, "[ tcamsg attributes(%d) ]", NLMSG_ALIGN(tcam_len - NLMSG_ALIGN(sizeof(*tcam)))); if(tcaa[TCA_ACT_TAB]) debug_tca_acts(lev+1, tcaa[TCA_ACT_TAB], "TCA_ACT_TAB"); rec_dbg(lev, ""); } /* * debug attributes of multiple actions */ void debug_tca_acts(int lev, struct rtattr *tcaa, const char *name) { struct rtattr *acts[TCA_ACT_MAX_PRIO+1]; int i; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tcaa->rta_len)); parse_nested_rtattr(acts, TCA_ACT_MAX_PRIO, tcaa); for(i = 0; i < TCA_ACT_MAX_PRIO; i++) if(acts[i]) { rec_dbg(lev+1, "acts[%hu](%hu):", acts[i]->rta_type, acts[i]->rta_len); debug_tca_act(lev+1, acts[i]); } } /* * debug attributes TCA_ACT_* */ void debug_tca_act(int lev, struct rtattr *acts) { struct rtattr *act[__TCA_ACT_MAX]; char kind[IFNAMSIZ]; parse_nested_rtattr(act, __TCA_ACT_MAX-1, acts); if(act[TCA_ACT_KIND]) debug_rta_str(lev+1, act[TCA_ACT_KIND], "TCA_ACT_KIND", kind, sizeof(kind)); if(act[TCA_ACT_OPTIONS]) debug_tca_act_options(lev+1, act[TCA_ACT_OPTIONS], "TCA_ACT_OPTIONS", kind, sizeof(kind)); if(act[TCA_ACT_INDEX]) debug_rta_s32(lev+1, act[TCA_ACT_INDEX], "TCA_ACT_INDEX", NULL); if(act[TCA_ACT_STATS]) debug_tca_act_stats(lev+1, act[TCA_ACT_STATS], "TCA_ACT_STATS"); } /* * debug attribute TCA_ACT_OPTIONS */ void debug_tca_act_options(int lev, struct rtattr *act, const char *name, char *kind, int len) { rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(act->rta_len)); if(!strncmp(kind, "police", len)) debug_tca_act_options_police(lev, act, NULL); else if(!strncmp(kind, "gact", len)) debug_tca_act_options_gact(lev, act); else if(!strncmp(kind, "pedit", len)) debug_tca_act_options_pedit(lev, act); else if(!strncmp(kind, "mirred", len)) debug_tca_act_options_mirred(lev, act); #ifdef HAVE_LINUX_TC_ACT_TC_NAT_H else if(!strncmp(kind, "nat", len)) debug_tca_act_options_nat(lev, act); #endif #ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H else if(!strncmp(kind, "skbedit", len)) debug_tca_act_options_skbedit(lev, act); #endif #ifdef HAVE_LINUX_TC_ACT_TC_CSUM_H else if(!strncmp(kind, "csum", len)) debug_tca_act_options_csum(lev, act); #endif else rec_dbg(lev, " -- unknown action %s --", kind); } /* * debug attribute TCA_ACT_STATS */ void debug_tca_act_stats(int lev, struct rtattr *act, const char *name) { rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(act->rta_len)); debug_tca_stats2_attr(lev, act); } /* * debug tcf_t */ void debug_tcf_t(int lev, struct tcf_t *tm) { rec_dbg(lev, "[ tcf_t(%d) ]", sizeof(*tm)); rec_dbg(lev, " install(%d): 0x%016x", sizeof(tm->install), tm->install); rec_dbg(lev, " lastuse(%d): 0x%016x", sizeof(tm->lastuse), tm->lastuse); rec_dbg(lev, " expires(%d): 0x%016x", sizeof(tm->expires), tm->expires); } /* * convert TC_ACT_* action for debug */ const char *conv_tc_action(int action, unsigned char debug) { #define _TC_ACTION(s1, s2) \ if(action == TC_ACT_##s1) \ return(debug ? #s1 : #s2); _TC_ACTION(UNSPEC, continue); _TC_ACTION(OK, ok); _TC_ACTION(RECLASSIFY, reclassify); _TC_ACTION(SHOT, drop); _TC_ACTION(PIPE, pipe); _TC_ACTION(STOLEN, stolen); _TC_ACTION(QUEUED, queued); _TC_ACTION(REPEAT, repeat); _TC_ACTION(JUMP, jump); #undef _TC_ACTION return(debug ? "UNKNOWN" : "unknown"); } nield-0.6.2/src/tcamsg_csum.c000066400000000000000000000110601470100110300160330ustar00rootroot00000000000000/* * tcamsg_csum.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #ifdef HAVE_LINUX_TC_ACT_TC_CSUM_H /* * parse csum options(TCA_ACT_CSUM: 16) */ int parse_tca_act_options_csum(char *msg, char *mp, struct rtattr *act) { struct rtattr *csum[__TCA_CSUM_MAX]; parse_nested_rtattr(csum, TCA_CSUM_MAX, act); if(csum[TCA_CSUM_PARMS]) { struct tc_csum *parms; char flags_list[MAX_STR_SIZE] = ""; if(RTA_PAYLOAD(csum[TCA_CSUM_PARMS]) < sizeof(*parms)) { rec_log("error: %s: payload too short", __func__); return(1); } parms = (struct tc_csum *)RTA_DATA(csum[TCA_CSUM_PARMS]); conv_tca_csum_update_flags(parms->update_flags, flags_list, sizeof(flags_list), 0); mp = add_log(msg, mp, "index=%d protocol=%s next=%s ", parms->index, flags_list, conv_tc_action(parms->action, 0)); } rec_log("%s", msg); return(0); } /* * debug csum options(TCA_ACT_CSUM: 16) */ void debug_tca_act_options_csum(int lev, struct rtattr *act) { struct rtattr *csum[__TCA_CSUM_MAX]; parse_nested_rtattr(csum, TCA_CSUM_MAX, act); if(csum[TCA_CSUM_TM]) debug_tca_csum_tm(lev+1, csum[TCA_CSUM_TM], "TCA_CSUM_TM"); if(csum[TCA_CSUM_PARMS]) debug_tca_csum_parms(lev+1, csum[TCA_CSUM_PARMS], "TCA_CSUM_PARMS"); } /* * debug attribute TCA_CSUM_TM */ void debug_tca_csum_tm(int lev, struct rtattr *csum, const char *name) { struct tcf_t *tm; if(debug_rta_len_chk(lev, csum, name, sizeof(*tm))) return; tm = (struct tcf_t *)RTA_DATA(csum); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(csum->rta_len)); debug_tcf_t(lev+1, tm); } /* * debug attribute TCA_CSUM_PARMS */ void debug_tca_csum_parms(int lev, struct rtattr *csum, const char *name) { struct tc_csum *parms; char flags_list[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, csum, name, sizeof(*parms))) return; parms = (struct tc_csum *)RTA_DATA(csum); conv_tca_csum_update_flags(parms->update_flags, flags_list, sizeof(flags_list), 1); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(csum->rta_len)); rec_dbg(lev, " [ tc_csum(%d) ]", sizeof(*parms)); rec_dbg(lev, " index(%d): 0x%08x", sizeof(parms->index), parms->index); rec_dbg(lev, " capab(%d): 0x%08x", sizeof(parms->capab), parms->capab); rec_dbg(lev, " action(%d): 0x%08x(%s)", sizeof(parms->action), parms->action, conv_tc_action(parms->action, 1)); rec_dbg(lev, " refcnt(%d): 0x%08x", sizeof(parms->refcnt), parms->refcnt); rec_dbg(lev, " bindcnt(%d): 0x%08x", sizeof(parms->bindcnt), parms->bindcnt); rec_dbg(lev, " update_flags(%d): 0x%08x(%s)", sizeof(parms->update_flags), parms->update_flags, flags_list); } #ifdef HAVE_LINUX_TC_ACT_TC_CSUM_H /* * convert TCA_CSUM_UPDATE_FLAG_* flags for parse */ void conv_tca_csum_update_flags(int flags, char *flags_list, int len, unsigned char debug) { if(!flags) { strncpy(flags_list, debug ? "NONE" : "none", len); return; } #define _TCA_CSUM_UPDATE_FLAGS(s1, s2) \ if((flags & TCA_CSUM_UPDATE_FLAG_##s1) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~TCA_CSUM_UPDATE_FLAG_##s1) ? \ strncat(flags_list, #s2 ",", len - strlen(flags_list) - 1) : \ strncat(flags_list, #s2, len - strlen(flags_list) - 1); _TCA_CSUM_UPDATE_FLAGS(IPV4HDR, ipv4hdr); _TCA_CSUM_UPDATE_FLAGS(ICMP, icmp); _TCA_CSUM_UPDATE_FLAGS(IGMP, igmp); _TCA_CSUM_UPDATE_FLAGS(TCP, tcp); _TCA_CSUM_UPDATE_FLAGS(UDP, udp); _TCA_CSUM_UPDATE_FLAGS(UDPLITE, udplite); #undef _TCA_CSUM_UPDATE_FLAGS if(!strlen(flags_list)) strncpy(flags_list, debug ? "UNKNOWN" : "unknown", len); } #endif #endif nield-0.6.2/src/tcamsg_gact.c000066400000000000000000000113101470100110300160000ustar00rootroot00000000000000/* * tcamsg_gact.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse gact options(TCA_ACT_GACT: 5) */ int parse_tca_act_options_gact(char *msg, char *mp, struct rtattr *act) { struct rtattr *gact[__TCA_GACT_MAX]; parse_nested_rtattr(gact, TCA_GACT_MAX, act); if(gact[TCA_GACT_PARMS]) { struct tc_gact *parms; if(RTA_PAYLOAD(gact[TCA_GACT_PARMS]) < sizeof(*parms)) { rec_log("error: %s: TCA_GACT_PARMS: payload too short", __func__); return(1); } parms = (struct tc_gact *)RTA_DATA(gact[TCA_GACT_PARMS]); mp = add_log(msg, mp, "index=%d kind=%s ", parms->index, conv_tc_action(parms->action, 0)); } if(gact[TCA_GACT_PROB]) { struct tc_gact_p *prob; if(RTA_PAYLOAD(gact[TCA_GACT_PROB]) < sizeof(*prob)) { rec_log("error: %s: TCA_GACT_PROB: payload too short", __func__); return(1); } prob = (struct tc_gact_p *)RTA_DATA(gact); mp = add_log(msg, mp, "random(type/value/action)=%s/%d/%s ", conv_pgact(prob->ptype, 0), prob->pval, conv_tc_action(prob->paction, 0)); } rec_log("%s", msg); return(0); } /* * debug gact options(TCA_ACT_GACT: 5) */ void debug_tca_act_options_gact(int lev, struct rtattr *act) { struct rtattr *gact[__TCA_GACT_MAX]; parse_nested_rtattr(gact, TCA_GACT_MAX, act); if(gact[TCA_GACT_TM]) debug_tca_gact_tm(lev+1, gact[TCA_GACT_TM], "TCA_GACT_TM"); if(gact[TCA_GACT_PARMS]) debug_tca_gact_parms(lev+1, gact[TCA_GACT_PARMS], "TCA_GACT_PARMS"); if(gact[TCA_GACT_PROB]) debug_tca_gact_prob(lev+1, gact[TCA_GACT_PROB], "TCA_GACT_PROB"); } /* * debug attribute TCA_GACT_TM */ void debug_tca_gact_tm(int lev, struct rtattr *gact, const char *name) { struct tcf_t *tm; if(debug_rta_len_chk(lev, gact, name, sizeof(*tm))) return; tm = (struct tcf_t *)RTA_DATA(gact); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(gact->rta_len)); debug_tcf_t(lev+1, tm); } /* * debug attribute TCA_GACT_PARMS */ void debug_tca_gact_parms(int lev, struct rtattr *gact, const char *name) { struct tc_gact *parms; if(debug_rta_len_chk(lev, gact, name, sizeof(*parms))) return; parms = (struct tc_gact *)RTA_DATA(gact); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(gact->rta_len)); rec_dbg(lev, " [ tc_gact(%d) ]", sizeof(*parms)); rec_dbg(lev, " index(%d): %u", sizeof(parms->index), parms->index); rec_dbg(lev, " capab(%d): %u", sizeof(parms->capab), parms->capab); rec_dbg(lev, " action(%d): %d(%s)", sizeof(parms->action), parms->action, conv_tc_action(parms->action, 1)); rec_dbg(lev, " refcnt(%d): %d", sizeof(parms->refcnt), parms->refcnt); rec_dbg(lev, " bindcnt(%d): %d", sizeof(parms->bindcnt), parms->bindcnt); } /* * debug attribute TCA_GACT_PROB */ void debug_tca_gact_prob(int lev, struct rtattr *gact, const char *name) { struct tc_gact_p *prob; if(debug_rta_len_chk(lev, gact, name, sizeof(*prob))) return; prob = (struct tc_gact_p *)RTA_DATA(gact); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(gact->rta_len)); rec_dbg(lev, " [ tc_gact_p(%d) ]", sizeof(*prob)); rec_dbg(lev, " ptype(%d): %d(%s)", sizeof(prob->ptype), prob->ptype, conv_pgact(prob->ptype, 1)); rec_dbg(lev, " pval(%d): %d", sizeof(prob->pval), prob->pval); rec_dbg(lev, " paction(%d): %d(%s)", sizeof(prob->paction), prob->paction, conv_tc_action(prob->paction, 0)); } /* * convert PGACT_* from number to string */ const char *conv_pgact(int pgact, unsigned char debug) { #define _PGACT(s1, s2) \ if(pgact == PGACT_##s1) \ return(debug ? #s1 : #s2); _PGACT(NONE, none); _PGACT(NETRAND, netrand); _PGACT(DETERM, determ); #undef _PGACT return(debug ? "UNKNOWN" : "unknown"); } nield-0.6.2/src/tcamsg_mirred.c000066400000000000000000000104451470100110300163540ustar00rootroot00000000000000/* * tcamsg_mirred.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse mirred options(TCA_ACT_MIRRED: 8) */ int parse_tca_act_options_mirred(char *msg, char *mp, struct rtattr *act) { struct rtattr *mirred[__TCA_MIRRED_MAX]; parse_nested_rtattr(mirred, TCA_MIRRED_MAX, act); if(mirred[TCA_MIRRED_PARMS]) { struct tc_mirred *parms; char ifname[IFNAMSIZ] = ""; if(RTA_PAYLOAD(mirred[TCA_MIRRED_PARMS]) < sizeof(*parms)) { rec_log("error: %s: payload too short", __func__); return(1); } parms = (struct tc_mirred *)RTA_DATA(mirred[TCA_MIRRED_PARMS]); if_indextoname_from_lists(parms->ifindex, ifname); mp = add_log(msg, mp, "index=%d %s to=%s next=%s ", parms->index, conv_tca_mirred_action(parms->eaction, 0), ifname, conv_tc_action(parms->action, 0)); } rec_log("%s", msg); return(0); } /* * debug mirred options(TCA_ACT_MIRRED: 8) */ void debug_tca_act_options_mirred(int lev, struct rtattr *act) { struct rtattr *mirred[__TCA_MIRRED_MAX]; parse_nested_rtattr(mirred, TCA_MIRRED_MAX, act); if(mirred[TCA_MIRRED_TM]) debug_tca_mirred_tm(lev+1, mirred[TCA_MIRRED_TM], "TCA_MIRRED_TM"); if(mirred[TCA_MIRRED_PARMS]) debug_tca_mirred_parms(lev+1, mirred[TCA_MIRRED_PARMS], "TCA_MIRRED_PARMS"); } /* * debug attribute TCA_MIRRED_TM */ void debug_tca_mirred_tm(int lev, struct rtattr *mirred, const char *name) { struct tcf_t *tm; if(debug_rta_len_chk(lev, mirred, name, sizeof(*tm))) return; tm = (struct tcf_t *)RTA_DATA(mirred); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(mirred->rta_len)); debug_tcf_t(lev+1, tm); } /* * debug attribute TCA_MIRRED_PARMS */ void debug_tca_mirred_parms(int lev, struct rtattr *mirred, const char *name) { struct tc_mirred *parms; char ifname[IFNAMSIZ] = ""; if(debug_rta_len_chk(lev, mirred, name, sizeof(*parms))) return; parms = (struct tc_mirred *)RTA_DATA(mirred); if_indextoname_from_lists(parms->ifindex, ifname); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(mirred->rta_len)); rec_dbg(lev, " [ tc_mirred(%d) ]", sizeof(*parms)); rec_dbg(lev, " index(%d): %u", sizeof(parms->index), parms->index); rec_dbg(lev, " capab(%d): %u", sizeof(parms->capab), parms->capab); rec_dbg(lev, " action(%d): %d(%s)", sizeof(parms->action), parms->action, conv_tc_action(parms->action, 1)); rec_dbg(lev, " refcnt(%d): %d", sizeof(parms->refcnt), parms->refcnt); rec_dbg(lev, " bindcnt(%d): %d", sizeof(parms->bindcnt), parms->bindcnt); rec_dbg(lev, " eaction(%d): %d(%s)", sizeof(parms->eaction), parms->eaction, conv_tca_mirred_action(parms->eaction, 1)); rec_dbg(lev, " ifindex(%d): %u(%s)", sizeof(parms->ifindex), parms->ifindex, ifname); } /* * convert TCA_EGRESS/INGRESS_REDIR/MIRROR from number to string */ const char *conv_tca_mirred_action(int action, unsigned char debug) { #define _TCA_MIRRED_ACTION(s1, s2) \ if(action == TCA_##s1) \ return(debug ? #s1 : #s2); _TCA_MIRRED_ACTION(EGRESS_REDIR, mode=redirect direction=egress); _TCA_MIRRED_ACTION(EGRESS_MIRROR, mode=mirror direction=egress); _TCA_MIRRED_ACTION(INGRESS_REDIR, mode=redirect direction=ingress); _TCA_MIRRED_ACTION(INGRESS_MIRROR, mode=mirror direction=ingress); #undef _TCA_MIRRED_ACTION return(debug ? "UNKNOWN" : "mode=unknown direction=unknown"); } nield-0.6.2/src/tcamsg_nat.c000066400000000000000000000104211470100110300156460ustar00rootroot00000000000000/* * tcamsg_nat.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #ifdef HAVE_LINUX_TC_ACT_TC_NAT_H /* * parse nat options(TCA_ACT_NAT: 9) */ int parse_tca_act_options_nat(char *msg, char *mp, struct rtattr *act) { struct rtattr *nat[__TCA_NAT_MAX]; parse_nested_rtattr(nat, TCA_NAT_MAX, act); if(nat[TCA_NAT_PARMS]) { struct tc_nat *parms; char old[INET_ADDRSTRLEN+1] = ""; char new[INET_ADDRSTRLEN+1] = ""; int i, mask; if(RTA_PAYLOAD(nat[TCA_NAT_PARMS]) < sizeof(*parms)) { rec_log("error: %s: payload too short", __func__); return(1); } parms = (struct tc_nat *)RTA_DATA(nat[TCA_NAT_PARMS]); inet_ntop(AF_INET, &(parms->old_addr), old, sizeof(old)); inet_ntop(AF_INET, &(parms->new_addr), new, sizeof(new)); for(i = 0, mask = 0; i < 32; i++) if(parms->mask & (1 << i)) ++mask; mp = add_log(msg, mp, "index=%d from=%s/%d to=%s direction=%s ", parms->index, old, mask, new, (parms->flags & TCA_NAT_FLAG_EGRESS) ? "egress" : "ingress"); } rec_log("%s", msg); return(0); } /* * debug nat options(TCA_ACT_NAT: 9) */ void debug_tca_act_options_nat(int lev, struct rtattr *act) { struct rtattr *nat[__TCA_NAT_MAX]; parse_nested_rtattr(nat, TCA_NAT_MAX, act); if(nat[TCA_NAT_PARMS]) debug_tca_nat_parms(lev+1, nat[TCA_NAT_PARMS], "TCA_NAT_PARMS"); if(nat[TCA_NAT_TM]) debug_tca_nat_tm(lev+1, nat[TCA_NAT_TM], "TCA_NAT_TM"); } /* * debug attribute TCA_NAT_PARMS */ void debug_tca_nat_parms(int lev, struct rtattr *nat, const char *name) { struct tc_nat *parms; char old[INET_ADDRSTRLEN+1] = ""; char new[INET_ADDRSTRLEN+1] = ""; char mask[INET_ADDRSTRLEN+1] = ""; if(debug_rta_len_chk(lev, nat, name, sizeof(*parms))) return; parms = (struct tc_nat *)RTA_DATA(nat); inet_ntop(AF_INET, &(parms->old_addr), old, sizeof(old)); inet_ntop(AF_INET, &(parms->new_addr), new, sizeof(new)); inet_ntop(AF_INET, &(parms->mask), mask, sizeof(mask)); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(nat->rta_len)); rec_dbg(lev, " [ tc_nat(%d) ]", sizeof(*parms)); rec_dbg(lev, " index(%d): %u", sizeof(parms->index), parms->index); rec_dbg(lev, " capab(%d): %u", sizeof(parms->capab), parms->capab); rec_dbg(lev, " action(%d): %d(%s)", sizeof(parms->action), parms->action, conv_tc_action(parms->action, 1)); rec_dbg(lev, " refcnt(%d): %d", sizeof(parms->refcnt), parms->refcnt); rec_dbg(lev, " bindcnt(%d): %d", sizeof(parms->bindcnt), parms->bindcnt); rec_dbg(lev, " old_addr(%d): 0x%08x(%s)", sizeof(parms->old_addr), parms->old_addr, old); rec_dbg(lev, " new_addr(%d): 0x%08x(%s)", sizeof(parms->new_addr), parms->new_addr, new); rec_dbg(lev, " mask(%d): 0x%08x(%s)", sizeof(parms->mask), parms->mask, mask); rec_dbg(lev, " flags(%d): 0x%08x(%s)", sizeof(parms->flags), parms->flags, (parms->flags & TCA_NAT_FLAG_EGRESS) ? "EGRESS" : "INGRESS"); } /* * debug attribute TCA_NAT_TM */ void debug_tca_nat_tm(int lev, struct rtattr *nat, const char *name) { struct tcf_t *tm; if(debug_rta_len_chk(lev, nat, name, sizeof(*tm))) return; tm = (struct tcf_t *)RTA_DATA(nat); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(nat->rta_len)); debug_tcf_t(lev+1, tm); } #endif nield-0.6.2/src/tcamsg_pedit.c000066400000000000000000000123341470100110300161760ustar00rootroot00000000000000/* * tcamsg_pedit.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse pedit options(TCA_ACT_PEDIT: 7) */ int parse_tca_act_options_pedit(char *msg, char *mp, struct rtattr *act) { struct rtattr *pedit[__TCA_PEDIT_MAX]; char *mp_tmp; parse_nested_rtattr(pedit, TCA_PEDIT_MAX, act); if(pedit[TCA_PEDIT_PARMS]) { struct tc_pedit_sel *parms; struct tc_pedit_key *keys; int len, i; if(RTA_PAYLOAD(pedit[TCA_PEDIT_PARMS]) < sizeof(*parms)) { rec_log("error: %s: TCA_PEDIT_PARMS: payload too short", __func__); return(1); } parms = (struct tc_pedit_sel *)RTA_DATA(pedit[TCA_PEDIT_PARMS]); len = sizeof(*parms) + (sizeof(*keys) * parms->nkeys); if(RTA_PAYLOAD(pedit[TCA_PEDIT_PARMS]) < len) { rec_log("error: %s: TCA_PEDIT_PARMS: payload too short", __func__); return(1); } mp = add_log(msg, mp, "index=%d ", parms->index); mp_tmp = mp; keys = parms->keys; if(!keys) { rec_log("error: %s: no key", __func__); return(1); } for(i = 0; i < parms->nkeys; i++, keys++, mp = mp_tmp) { mp = add_log(msg, mp, "key=%d value=0x%08x/0x%08x offset=%d " "at=%d offmask=0x%08x shift=%d next=%s ", i+1, ntohl(keys->val), ntohl(keys->mask), keys->off, keys->at, ntohl(keys->offmask), keys->shift, conv_tc_action(parms->action, 0)); rec_log("%s", msg); } return(0); } rec_log("%s", msg); return(0); } /* * debug pedit options(TCA_ACT_PEDIT: 7) */ void debug_tca_act_options_pedit(int lev, struct rtattr *act) { struct rtattr *pedit[__TCA_PEDIT_MAX]; parse_nested_rtattr(pedit, TCA_PEDIT_MAX, act); if(pedit[TCA_PEDIT_TM]) debug_tca_pedit_tm(lev, pedit[TCA_PEDIT_TM], "TCA_PEDIT_TM"); if(pedit[TCA_PEDIT_PARMS]) debug_tca_pedit_parms(lev, pedit[TCA_PEDIT_PARMS], "TCA_PEDIT_PARMS"); } /* * debug attribute TCA_PEDIT_TM */ void debug_tca_pedit_tm(int lev, struct rtattr *pedit, const char *name) { struct tcf_t *tm; if(debug_rta_len_chk(lev, pedit, name, sizeof(*tm))) return; tm = (struct tcf_t *)RTA_DATA(pedit); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(pedit->rta_len)); debug_tcf_t(lev+1, tm); } /* * debug attribute TCA_PEDIT_PARMS */ void debug_tca_pedit_parms(int lev, struct rtattr *pedit, const char *name) { struct tc_pedit_sel *parms; if(debug_rta_len_chk(lev, pedit, name, sizeof(*parms))) return; parms = (struct tc_pedit_sel *)RTA_DATA(pedit); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(pedit->rta_len)); rec_dbg(lev, " [ tc_pedit_sel(%d) ]", sizeof(*parms)); rec_dbg(lev, " index(%d): 0x%08x", sizeof(parms->index), parms->index); rec_dbg(lev, " capab(%d): 0x%08x", sizeof(parms->capab), parms->capab); rec_dbg(lev, " action(%d): 0x%08x(%s)", sizeof(parms->action), parms->action, conv_tc_action(parms->action, 1)); rec_dbg(lev, " refcnt(%d): 0x%08x", sizeof(parms->refcnt), parms->refcnt); rec_dbg(lev, " bindcnt(%d): 0x%08x", sizeof(parms->bindcnt), parms->bindcnt); rec_dbg(lev, " nkeys(%d): 0x%02x", sizeof(parms->nkeys), parms->nkeys); rec_dbg(lev, " flags(%d): 0x%02x", sizeof(parms->flags), parms->flags); int i, len; struct tc_pedit_key *keys = parms->keys; len = sizeof(*parms) + (sizeof(*keys) * parms->nkeys); if(RTA_PAYLOAD(pedit) < len) { rec_dbg(lev, " nkeys[0](%d): -- payload too short --", RTA_PAYLOAD(pedit) - sizeof(*parms)); return; } for(i = 0; i < parms->nkeys; i++, keys++) { rec_dbg(lev+2, "[ tc_pedit_key keys[%d](%d) ]", i, sizeof(*keys)); rec_dbg(lev+3, " mask(%d): 0x%08x(0x%08x)", sizeof(keys->mask), keys->mask, ntohl(keys->mask)); /* AND */ rec_dbg(lev+3, " val(%d): 0x%08x(0x%08x)", sizeof(keys->val), keys->val, ntohl(keys->val)); /* XOR */ rec_dbg(lev+3, " off(%d): %d", sizeof(keys->off), keys->off); /* Offset */ rec_dbg(lev+3, " at(%d): %d", sizeof(keys->at), keys->at); rec_dbg(lev+3, " offmask(%d): 0x%08x(0x%08x)", sizeof(keys->offmask), keys->offmask, ntohl(keys->offmask)); rec_dbg(lev+3, " shift(%d): %d", sizeof(keys->shift), keys->shift); } } nield-0.6.2/src/tcamsg_police.c000066400000000000000000000133061470100110300163440ustar00rootroot00000000000000/* * tcamsg_police.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse attribute TCA_POLICE_* */ int parse_tca_act_options_police(char *msg, char *mp, struct rtattr *act) { struct rtattr *police[__TCA_POLICE_MAX]; parse_nested_rtattr(police, TCA_POLICE_MAX, act); if(police[TCA_POLICE_TBF]) { struct tc_police *tc_police; char rate[MAX_STR_SIZE]; char burst[MAX_STR_SIZE]; char peakrate[MAX_STR_SIZE]; char mtu[MAX_STR_SIZE]; double rate_latency = 0; double peakrate_latency = 0; char latency[MAX_STR_SIZE]; if(RTA_PAYLOAD(police[TCA_POLICE_TBF]) < sizeof(*tc_police)) { rec_log("error: %s: payload too short", __func__); return(1); } tc_police = (struct tc_police *)RTA_DATA(police[TCA_POLICE_TBF]); mp = add_log(msg, mp, "index=%d ", tc_police->index); get_us2tick(); conv_unit_rate(rate, sizeof(rate), tc_police->rate.rate); conv_unit_size(burst, sizeof(burst), get_burst_size(tc_police->rate.rate, tc_police->burst)); rate_latency = get_latency(tc_police->rate.rate, tc_police->burst, tc_police->limit); mp = add_log(msg, mp, "rate=%s burst=%s ", rate, burst); if(tc_police->peakrate.rate) { conv_unit_rate(peakrate, sizeof(peakrate), tc_police->peakrate.rate); conv_unit_size(mtu, sizeof(mtu), get_burst_size(tc_police->peakrate.rate, tc_police->mtu)); peakrate_latency = get_latency(tc_police->peakrate.rate, tc_police->mtu, tc_police->limit); mp = add_log(msg, mp, "peakrate=%s minburst=%s ", peakrate, mtu); } if(rate_latency < peakrate_latency) conv_unit_usec(latency, sizeof(latency), peakrate_latency); else conv_unit_usec(latency, sizeof(latency), rate_latency); mp = add_log(msg, mp, "latency=%s exceed=%s ", latency, conv_tc_police_action(tc_police->action, 0)); } rec_log("%s", msg); return(0); } /* * debug attribute TCA_POLICE_* */ void debug_tca_act_options_police(int lev, struct rtattr *act, const char *name) { struct rtattr *police[__TCA_POLICE_MAX]; if(name) rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(act->rta_len)); parse_nested_rtattr(police, TCA_POLICE_MAX, act); if(police[TCA_POLICE_TBF]) debug_tca_police_tbf(lev+1, police[TCA_POLICE_TBF], "TCA_POLICE_TBF"); if(police[TCA_POLICE_RATE]) debug_rta_ignore(lev+1, police[TCA_POLICE_RATE], "TCA_POLICE_RATE"); if(police[TCA_POLICE_PEAKRATE]) debug_rta_ignore(lev+1, police[TCA_POLICE_PEAKRATE], "TCA_POLICE_PEAKRATE"); if(police[TCA_POLICE_AVRATE]) debug_rta_u32(lev+1, police[TCA_POLICE_AVRATE], "TCA_POLICE_AVRATE", NULL); if(police[TCA_POLICE_RESULT]) debug_rta_u32(lev+1, police[TCA_POLICE_RESULT], "TCA_POLICE_RESULT", conv_tc_police_action); } /* * debug attribute TCA_POLICE_TBF */ void debug_tca_police_tbf(int lev, struct rtattr *police, const char *name) { struct tc_police *tc_police; struct tc_ratespec *rate; struct tc_ratespec *peak; if(debug_rta_len_chk(lev, police, name, sizeof(*tc_police))) return; tc_police = (struct tc_police *)RTA_DATA(police); rate = &(tc_police->rate); peak = &(tc_police->peakrate); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(police->rta_len)); rec_dbg(lev, " [ tc_police(%d) ]", sizeof(*tc_police)); rec_dbg(lev, " index(%d): %u", sizeof(tc_police->index), tc_police->index); rec_dbg(lev, " action(%d): %d(%s)", sizeof(tc_police->action), tc_police->action, conv_tc_police_action(tc_police->action, 1)); rec_dbg(lev, " limit(%d): %u", sizeof(tc_police->limit), tc_police->limit); rec_dbg(lev, " burst(%d): %u", sizeof(tc_police->burst), tc_police->burst); rec_dbg(lev, " mtu(%d): %u", sizeof(tc_police->mtu), tc_police->mtu); debug_tc_ratespec(lev+2, rate, "rate"); debug_tc_ratespec(lev+2, peak, "peakrate"); rec_dbg(lev, " refcnt(%d): %d", sizeof(tc_police->refcnt), tc_police->refcnt); rec_dbg(lev, " bindcnt(%d): %d", sizeof(tc_police->bindcnt), tc_police->bindcnt); rec_dbg(lev, " capab(%d): %u", sizeof(tc_police->capab), tc_police->capab); } /* * convert TC_POLICE_* action from number to string */ const char *conv_tc_police_action(unsigned action, unsigned char debug) { #define _TC_POLICE_ACTION(s1, s2) \ if(action == TC_POLICE_##s1) \ return(debug ? #s1 : #s2); _TC_POLICE_ACTION(UNSPEC, continue); _TC_POLICE_ACTION(OK, ok); _TC_POLICE_ACTION(RECLASSIFY, reclassify); _TC_POLICE_ACTION(SHOT, drop); _TC_POLICE_ACTION(PIPE, pipe); #undef _TC_POLICE_ACTION return(debug ? "UNKNOWN" : "unknown"); } nield-0.6.2/src/tcamsg_skbedit.c000066400000000000000000000114021470100110300165110ustar00rootroot00000000000000/* * tcamsg_skbedit.c - traffic control message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #ifdef HAVE_LINUX_TC_ACT_TC_SKBEDIT_H /* * parse skbedit options(TCA_ACT_SKBEDIT: 11) */ int parse_tca_act_options_skbedit(char *msg, char *mp, struct rtattr *act) { struct rtattr *skb[__TCA_SKBEDIT_MAX]; struct tc_skbedit *parms = NULL; parse_nested_rtattr(skb, TCA_SKBEDIT_MAX, act); if(skb[TCA_SKBEDIT_PARMS]) { if(RTA_PAYLOAD(skb[TCA_SKBEDIT_PARMS]) < sizeof(*parms)) { rec_log("error: %s: TCA_SKBEDIT_PARMS: payload too short", __func__); return(1); } parms = (struct tc_skbedit *)RTA_DATA(skb[TCA_SKBEDIT_PARMS]); mp = add_log(msg, mp, "index=%d ", parms->index); } if(skb[TCA_SKBEDIT_PRIORITY]) { if(RTA_PAYLOAD(skb[TCA_SKBEDIT_PRIORITY]) < sizeof(unsigned)) { rec_log("error: %s: TCA_SKBEDIT_PRIORITY: payload too short", __func__); return(1); } mp = add_log(msg, mp, "priority=0x%x ", *(unsigned *)RTA_DATA(skb[TCA_SKBEDIT_PRIORITY])); } if(skb[TCA_SKBEDIT_QUEUE_MAPPING]) { if(RTA_PAYLOAD(skb[TCA_SKBEDIT_QUEUE_MAPPING]) < sizeof(unsigned short)) { rec_log("error: %s: TCA_SKBEDIT_QUEUE_MAPPING: payload too short", __func__); return(1); } mp = add_log(msg, mp, "queue-mapping=%u ", *(unsigned *)RTA_DATA(skb[TCA_SKBEDIT_QUEUE_MAPPING])); } #if HAVE_DECL_TCA_SKBEDIT_MARK if(skb[TCA_SKBEDIT_MARK]) { if(RTA_PAYLOAD(skb[TCA_SKBEDIT_MARK]) < sizeof(unsigned)) { rec_log("error: %s: TCA_SKBEDIT_MARK: payload too short", __func__); return(1); } mp = add_log(msg, mp, "mark=%u ", *(unsigned *)RTA_DATA(skb[TCA_SKBEDIT_MARK])); } #endif if(parms) mp = add_log(msg, mp, "next=%s ", conv_tc_action(parms->action, 0)); rec_log("%s", msg); return(0); } /* * debug skbedit options(TCA_ACT_SKBEDIT: 11) */ void debug_tca_act_options_skbedit(int lev, struct rtattr *act) { struct rtattr *skb[__TCA_SKBEDIT_MAX]; parse_nested_rtattr(skb, TCA_SKBEDIT_MAX, act); if(skb[TCA_SKBEDIT_TM]) debug_tca_skbedit_tm(lev+1, skb[TCA_SKBEDIT_TM], "TCA_SKBEDIT_TM"); if(skb[TCA_SKBEDIT_PARMS]) debug_tca_skbedit_parms(lev+1, skb[TCA_SKBEDIT_PARMS], "TCA_SKBEDIT_PARMS"); if(skb[TCA_SKBEDIT_PRIORITY]) debug_rta_u32x(lev+1, skb[TCA_SKBEDIT_PRIORITY], "TCA_SKBEDIT_PRIORITY", NULL); if(skb[TCA_SKBEDIT_QUEUE_MAPPING]) debug_rta_u16(lev+1, skb[TCA_SKBEDIT_QUEUE_MAPPING], "TCA_SKBEDIT_QUEUE_MAPPING", NULL); #if HAVE_DECL_TCA_SKBEDIT_MARK if(skb[TCA_SKBEDIT_MARK]) debug_rta_u32(lev+1, skb[TCA_SKBEDIT_MARK], "TCA_SKBEDIT_MARK", NULL); #endif } /* * debug attribute TCA_SKBEDIT_TM */ void debug_tca_skbedit_tm(int lev, struct rtattr *skb, const char *name) { struct tcf_t *tm; if(debug_rta_len_chk(lev, skb, name, sizeof(*tm))) return; tm = (struct tcf_t *)RTA_DATA(skb); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(skb->rta_len)); debug_tcf_t(lev+1, tm); } /* * debug attribute TCA_SKBEDIT_PARMS */ void debug_tca_skbedit_parms(int lev, struct rtattr *skb, const char *name) { struct tc_skbedit *parms; if(debug_rta_len_chk(lev, skb, name, sizeof(*parms))) return; parms = (struct tc_skbedit *)RTA_DATA(skb); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(skb->rta_len)); rec_dbg(lev, " [ tc_skbedit(%d) ]", sizeof(*parms)); rec_dbg(lev, " index(%d): %u", sizeof(parms->index), parms->index); rec_dbg(lev, " capab(%d): %u", sizeof(parms->capab), parms->capab); rec_dbg(lev, " action(%d): %d(%s)", sizeof(parms->action), parms->action, conv_tc_action(parms->action, 0)); rec_dbg(lev, " refcnt(%d): %d", sizeof(parms->refcnt), parms->refcnt); rec_dbg(lev, " bindcnt(%d): %d", sizeof(parms->bindcnt), parms->bindcnt); } #endif nield-0.6.2/src/tcmsg_filter.c000066400000000000000000000771661470100110300162330ustar00rootroot00000000000000/* * tcmsg_filter.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse traffic control filter messages */ int parse_tcmsg_filter(struct nlmsghdr *nlh) { struct tcmsg *tcm; int tcm_len; struct rtattr *tca[__TCA_MAX]; char msg[MAX_MSG_SIZE] = ""; char *mp = msg; char ifname[IFNAMSIZ]; char handle[MAX_STR_SIZE] = ""; char kind[IFNAMSIZ] = "(unknown)"; char proto[MAX_STR_SIZE]; int log_opts = get_log_opts(); /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get tcmsg */ tcm_len = NLMSG_PAYLOAD(nlh, 0); if(tcm_len < sizeof(*tcm)) { rec_log("error: %s: tcmsg: length too short", __func__); return(1); } tcm = (struct tcmsg *)NLMSG_DATA(nlh); /* parse traffic control message attributes */ parse_tc(tca, nlh); /* debug tcmsg */ if(log_opts & L_DEBUG) debug_tcmsg(0, nlh, tcm, tca, tcm_len); /* kind of message */ switch(nlh->nlmsg_type) { case RTM_NEWTFILTER: mp = add_log(msg, mp, "tc filter added: "); break; case RTM_DELTFILTER: mp = add_log(msg, mp, "tc filter deleted: "); break; default: rec_log("error: %s: nlmsg_type: unknown message", __func__); return(1); } /* get interface name */ if_indextoname_from_lists(tcm->tcm_ifindex, ifname); mp = add_log(msg, mp, "interface=%s ", ifname); /* get qdisc kind */ if(tca[TCA_KIND]) strncpy(kind, (char *)RTA_DATA(tca[TCA_KIND]), sizeof(kind)); /* get filter handle */ if(!strncmp(kind, "u32", sizeof(kind))) parse_u32_handle(handle, sizeof(handle), tcm->tcm_handle); else snprintf(handle, sizeof(handle), "0x%x", tcm->tcm_handle); mp = add_log(msg, mp, "handle=%s ", handle); /* get priority */ mp = add_log(msg, mp, "priority=%u ", TC_H_MAJ(tcm->tcm_info)>>16); /* get priority */ strncpy(proto, conv_eth_p(ntohs(TC_H_MIN(tcm->tcm_info)), 0), sizeof(proto)); if(strlen(proto)) mp = add_log(msg, mp, "protocol=%s ", proto); else mp = add_log(msg, mp, "protocol=0x%04x ", ntohs(TC_H_MIN(tcm->tcm_info))); /* get filter options */ mp = add_log(msg, mp, "filter=%s ", kind); if(tca[TCA_OPTIONS]) { if(!strncmp(kind, "u32", sizeof(kind))) { if(parse_tca_options_u32(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #if HAVE_DECL_TCA_RSVP_UNSPEC } else if(!strncmp(kind, "rsvp", sizeof(kind))) { if(parse_tca_options_rsvp(msg, &mp, tcm, tca[TCA_OPTIONS])) return(1); return(0); #endif } else if(!strncmp(kind, "route", sizeof(kind))) { if(parse_tca_options_route(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); } else if(!strncmp(kind, "fw", sizeof(kind))) { if(parse_tca_options_fw(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #if HAVE_DECL_TCA_TCINDEX_UNSPEC } else if(!strncmp(kind, "tcindex", sizeof(kind))) { if(parse_tca_options_tcindex(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #endif #if HAVE_DECL_TCA_FLOW_UNSPEC } else if(!strncmp(kind, "flow", sizeof(kind))) { if(parse_tca_options_flow(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #endif } else if(!strncmp(kind, "basic", sizeof(kind))) { if(parse_tca_options_basic(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #if HAVE_DECL_TCA_CGROUP_UNSPEC } else if(!strncmp(kind, "cgroup", sizeof(kind))) { if(parse_tca_options_cgroup(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #endif } } rec_log("%s", msg); return(0); } /* * parse attribute TCA_*_CLASSID */ int parse_tca_classid(char *msg, char **mp, struct rtattr *tca) { char classid[MAX_STR_SIZE] = ""; if(RTA_PAYLOAD(tca) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } parse_tc_handle(classid, sizeof(classid), *(unsigned *)RTA_DATA(tca)); *mp = add_log(msg, *mp, "classid=%s ", classid); return(0); } /* * parse attribute TCA_*_INDEV */ int parse_tca_indev(char *msg, char **mp, struct rtattr *tca) { char name[IFNAMSIZ]; if(!RTA_PAYLOAD(tca)) { rec_log("error: %s: no payload", __func__); return(1); } else if(RTA_PAYLOAD(tca) > sizeof(name)) { rec_log("error: %s: payload too long", __func__); return(1); } strncpy(name, (char *)RTA_DATA(tca), sizeof(name)); *mp = add_log(msg, *mp, "in=%s ", name); return(0); } /* * parse attribute TCA_*_MASK */ int parse_tca_mask(char *msg, char **mp, struct rtattr *tca) { if(RTA_PAYLOAD(tca) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "mask=0x%08x ", *(unsigned *)RTA_DATA(tca)); return(0); } /* * parse filter handle */ void parse_u32_handle(char *p, int len, unsigned handle) { if(TC_U32_HTID(handle)) APPEND_SNPRINTF(rc, p, len, "%x", TC_U32_HTID(handle)>>20); APPEND_SNPRINTF(rc, p, len, ":"); if(TC_U32_HASH(handle)) APPEND_SNPRINTF(rc, p, len, "%x", TC_U32_HASH(handle)); APPEND_SNPRINTF(rc, p, len, ":"); if(TC_U32_NODE(handle)) APPEND_SNPRINTF(rc, p, len, "%x", TC_U32_NODE(handle)); } /* * parse attribute TCA_EMATCH_* */ int parse_tca_ematch(char *msg, char *mp, struct rtattr *tca) { struct rtattr *em_tree[__TCA_EMATCH_TREE_MAX]; int num = -1; parse_nested_rtattr(em_tree, TCA_EMATCH_TREE_MAX, tca); if(em_tree[TCA_EMATCH_TREE_HDR]) if(parse_tca_ematch_tree_hdr(em_tree[TCA_EMATCH_TREE_HDR], &num)) return(1); if(em_tree[TCA_EMATCH_TREE_LIST]) if(parse_tca_ematch_tree_list(msg, mp, em_tree[TCA_EMATCH_TREE_LIST], num)) return(1); return(0); } /* * parse attribute TCA_EMATCH_TREE_HDR */ int parse_tca_ematch_tree_hdr(struct rtattr *em_tree, int *num) { struct tcf_ematch_tree_hdr *hdr; if(RTA_PAYLOAD(em_tree) < sizeof(*hdr)) { rec_log("error: %s: payload too short", __func__); return(1); } hdr = (struct tcf_ematch_tree_hdr *)RTA_DATA(em_tree); *num = hdr->nmatches; return(0); } /* * parse attribute TCA_EMATCH_TREE_LIST */ int parse_tca_ematch_tree_list(char *msg, char *mp, struct rtattr *em_tree, int num) { struct rtattr *em_list[num+1]; struct tcf_ematch_hdr *hdr; int i; char *mp_tmp = mp; parse_nested_rtattr(em_list, num, em_tree); /* no exist em_list[0] */ for(i = 1; i < num + 1; i++, mp = mp_tmp) { if(!em_list[i]) return(0); if(RTA_PAYLOAD(em_list[i]) < sizeof(*hdr)) { rec_log("error: %s: payload too short", __func__); return(1); } hdr = (struct tcf_ematch_hdr *)RTA_DATA(em_list[i]); mp = add_log(msg, mp, "ematch=%s ", conv_tcf_em_kind(hdr->kind, 0)); /* use (char*)hdr in order to count by one byte */ switch(hdr->kind) { #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H case TCF_EM_CMP: if(parse_ematch_cmp(msg, mp, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr))) return(1); break; #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H case TCF_EM_NBYTE: if(parse_ematch_nbyte(msg, mp, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr))) return(1); break; #endif case TCF_EM_U32: if(parse_ematch_u32(msg, mp, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr))) return(1); break; #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H case TCF_EM_META: if(parse_ematch_meta(msg, mp, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr))) return(1); break; #endif /* not implemented yet case TCF_EM_TEXT: case TCF_EM_VLAN: case TCF_EM_CANID: case TCF_EM_IPSET: */ default: rec_log("%s", msg); } } return(0); } #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H /* * parse ematch cmp */ int parse_ematch_cmp(char *msg, char *mp, void *p, int len) { struct tcf_em_cmp *cmp; if(len < sizeof(struct tcf_em_cmp)) { rec_log("error: %s: payload too short", __func__); return(1); } cmp = (struct tcf_em_cmp *)p; mp = add_log(msg, mp, "layer=%d align=%s flag=%s operand=%s value=0x%08x mask=0x%08x offset=%hu ", cmp->layer, conv_tcf_em_align(cmp->align, 0), cmp->flags ? "trans" : "none", conv_tcf_em_opnd(cmp->opnd, 0), cmp->val, cmp->mask, cmp->off); rec_log("%s", msg); return(0); } #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H /* * parse ematch nbyte */ int parse_ematch_nbyte(char *msg, char *mp, void *p, int len) { struct tcf_em_nbyte *nbyte; int i; char *data; if(len < sizeof(struct tcf_em_nbyte)) { rec_log("error: %s: tcf_em_nbyte: payload too short", __func__); return(1); } nbyte = (struct tcf_em_nbyte *)p; if(len - sizeof(*nbyte) < nbyte->len) { rec_log("error: %s: len: payload too short", __func__); return(1); } data = (char *)nbyte + sizeof(*nbyte); mp = add_log(msg, mp, "layer=%d ", nbyte->layer); for(i = 0; i < nbyte->len; i++) { if(!i) mp = add_log(msg, mp, "value=\""); mp = add_log(msg, mp, "%c", isprint(data[i]) ? data[i] : '.'); if(nbyte->len - i == 1) mp = add_log(msg, mp, "\""); } mp = add_log(msg, mp, " offset=%hu ", nbyte->off); rec_log("%s", msg); return(0); } #endif /* * parse ematch u32 */ int parse_ematch_u32(char *msg, char *mp, void *p, int len) { struct tc_u32_key *key; if(len < sizeof(*key)) { rec_log("error: %s: payload too short", __func__); return(1); } key = (struct tc_u32_key *)p; mp = add_log(msg, mp, "value=0x%08x mask=0x%08x offset=%d offmask=0x%08x", ntohl(key->val), ntohl(key->mask), key->off, key->offmask); rec_log("%s", msg); return(0); } #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H /* * parse ematch meta */ int parse_ematch_meta(char *msg, char *mp, void *p, int len) { struct rtattr *meta[__TCA_EM_META_MAX]; struct tcf_meta_hdr *hdr = NULL; struct tcf_meta_val *left = NULL, *right = NULL; parse_rtattr(meta, TCA_EM_META_MAX, p, len); if(meta[TCA_EM_META_HDR]) { if(RTA_PAYLOAD(meta[TCA_EM_META_HDR]) < sizeof(*hdr)) { rec_log("error: %s: TCA_EM_META_HDR: payload too short", __func__); return(1); } hdr = (struct tcf_meta_hdr *)RTA_DATA(meta[TCA_EM_META_HDR]); left = &(hdr->left); right = &(hdr->right); } else { rec_log("error: %s: TCA_EM_META_HDR: no attribute", __func__); return(1); } mp = add_log(msg, mp, "match=("); if(meta[TCA_EM_META_LVALUE]) { if(parse_tca_em_meta_value(msg, &mp, left, meta[TCA_EM_META_LVALUE])) return(1); } else { rec_log("error: %s: TCA_EM_META_LVALUE: no attribute", __func__); return(1); } mp = add_log(msg, mp, "%s ", conv_tcf_em_opnd(left->op, 0)); if(meta[TCA_EM_META_RVALUE]) { if(parse_tca_em_meta_value(msg, &mp, right, meta[TCA_EM_META_RVALUE])) return(1); } else { rec_log("error: %s: TCA_EM_META_RVALUE: no attribute", __func__); return(1); } mp = add_log(msg, mp, ") "); rec_log("%s", msg); return(0); } /* * parse ematch meta value */ int parse_tca_em_meta_value(char *msg, char **mp, struct tcf_meta_val *val, struct rtattr *meta) { int id = TCF_META_ID(val->kind); int type = TCF_META_TYPE(val->kind); char *data = (char *)RTA_DATA(meta); int i; if(id != TCF_META_ID_VALUE) { *mp = add_log(msg, *mp, "%s ", conv_tcf_meta_id(id, 0)); if(val->shift) *mp = add_log(msg, *mp, "shift %d ", val->shift); if(type == TCF_META_TYPE_INT && *(unsigned *)RTA_DATA(meta)) { if(RTA_PAYLOAD(meta) < sizeof(__u32)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "mask 0x%08x ", *(unsigned *)RTA_DATA(meta)); } return(0); } switch(type) { case TCF_META_TYPE_VAR: for(i = 0; i < RTA_PAYLOAD(meta); i++) *mp = add_log(msg, *mp, "%c", isprint(data[i]) ? data[i] : '.'); break; case TCF_META_TYPE_INT: if(RTA_PAYLOAD(meta) < sizeof(__u32)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "%d", *(int *)RTA_DATA(meta)); break; default: rec_log("error: %s: unknown type(%d)", __func__, type); return(1); } return(0); } #endif /* * debug attribute TCA_EMATCH_* */ void debug_tca_ematch(int lev, struct rtattr *tca, const char *name) { struct rtattr *em_tree[__TCA_EMATCH_TREE_MAX]; int num = -1; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(em_tree, TCA_EMATCH_TREE_MAX, tca); if(em_tree[TCA_EMATCH_TREE_HDR]) num = debug_tca_ematch_tree_hdr(lev+1, em_tree[TCA_EMATCH_TREE_HDR], "TCA_EMATCH_TREE_HDR"); if(em_tree[TCA_EMATCH_TREE_LIST]) debug_tca_ematch_tree_list(lev+1, em_tree[TCA_EMATCH_TREE_LIST], "TCA_EMATCH_TREE_LIST", num); } /* * debug attribute TCA_EMATCH_TREE_HDR */ int debug_tca_ematch_tree_hdr(int lev, struct rtattr *em_tree, const char *name) { struct tcf_ematch_tree_hdr *hdr; if(debug_rta_len_chk(lev, em_tree, name, sizeof(*hdr))) return(-1); hdr = (struct tcf_ematch_tree_hdr *)RTA_DATA(em_tree); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(em_tree->rta_len)); rec_dbg(lev, " [ tcf_ematch_tree_hdr(%d) ]", sizeof(*hdr)); rec_dbg(lev, " nmatches(%d): %hu", sizeof(hdr->nmatches), hdr->nmatches); rec_dbg(lev, " progid(%d): %hu", sizeof(hdr->progid), hdr->progid); return(hdr->nmatches); } /* * debug attribute TCA_EMATCH_TREE_LIST */ void debug_tca_ematch_tree_list(int lev, struct rtattr *em_tree, const char *name, int num) { struct rtattr *em_list[num+1]; struct tcf_ematch_hdr *hdr; int i; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(em_tree->rta_len)); parse_nested_rtattr(em_list, num, em_tree); /* no exist em_list[0] */ for(i = 1; i < num + 1; i++) { if(!em_list[i]) return; if(RTA_PAYLOAD(em_list[i]) < sizeof(*hdr)) { rec_dbg(lev+1, "[ tcf_ematch_hdr[%d](%d) ] -- payload too short --", i, sizeof(*hdr)); return; } hdr = (struct tcf_ematch_hdr *)RTA_DATA(em_list[i]); rec_dbg(lev+1, "[ tcf_ematch_hdr[%d](%d) ]", i, sizeof(*hdr)); rec_dbg(lev+1, " matchid(%d): %hu", sizeof(hdr->matchid), hdr->matchid); rec_dbg(lev+1, " kind(%d): %hu(%s)", sizeof(hdr->kind), hdr->kind, conv_tcf_em_kind(hdr->kind, 1)); rec_dbg(lev+1, " flags(%d): %hu(%s)", sizeof(hdr->flags), hdr->flags, conv_tcf_em_flag(hdr->flags, 1)); rec_dbg(lev+1, " pad(%d): %hu", sizeof(hdr->pad), hdr->pad); /* use (char*)hdr in order to count by one byte */ switch(hdr->kind) { #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H case TCF_EM_CMP: debug_ematch_cmp(lev+1, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr)); break; #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H case TCF_EM_NBYTE: debug_ematch_nbyte(lev+1, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr)); break; #endif case TCF_EM_U32: debug_ematch_u32(lev+1, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr)); break; #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H case TCF_EM_META: debug_ematch_meta(lev+1, (char *)hdr + sizeof(*hdr), RTA_PAYLOAD(em_list[i]) - sizeof(*hdr)); break; #endif /* not implemented yet case TCF_EM_TEXT: case TCF_EM_VLAN: case TCF_EM_CANID: case TCF_EM_IPSET: */ default: break; } } } #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H /* * debug ematch cmp */ void debug_ematch_cmp(int lev, void *p, int len) { struct tcf_em_cmp *cmp; if(len < sizeof(struct tcf_em_cmp)) { rec_dbg(lev, "[ tcf_em_cmp(%d) ] -- payload too short --", len); return; } cmp = (struct tcf_em_cmp *)p; rec_dbg(lev, "[ tcf_em_cmp(%d) ]", len); rec_dbg(lev, " val(%d): 0x%08x", sizeof(cmp->val), cmp->val); rec_dbg(lev, " mask(%d): 0x%08x", sizeof(cmp->mask), cmp->mask); rec_dbg(lev, " off(%d): %hu", sizeof(cmp->off), cmp->off); rec_dbg(lev, " align:4(%d): 0x%x(%s)", sizeof(__u8), cmp->align, conv_tcf_em_align(cmp->align, 1)); rec_dbg(lev, " flags:4(%d): 0x%x(%s)", sizeof(__u8), cmp->flags, TCF_EM_CMP_TRANS ? "TRANS" : "none"); rec_dbg(lev, " layer:4(%d): 0x%x", sizeof(__u8), cmp->layer); rec_dbg(lev, " opnd:4(%d): 0x%x(%s)", sizeof(__u8), cmp->opnd, conv_tcf_em_opnd(cmp->opnd, 1)); } #endif #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_NBYTE_H /* * debug ematch nbyte */ void debug_ematch_nbyte(int lev, void *p, int len) { struct tcf_em_nbyte *nbyte; int i; char *data; if(len < sizeof(struct tcf_em_nbyte)) { rec_dbg(lev, "[ tcf_em_nbyte(%d) ] -- payload too short --", len); return; } nbyte = (struct tcf_em_nbyte *)p; rec_dbg(lev, "[ tcf_em_nbyte(%d) ]", len); rec_dbg(lev, " off(%d): %hu", sizeof(nbyte->off), nbyte->off); rec_dbg(lev, " len:12(%d): %hu", sizeof(__u16), nbyte->len); rec_dbg(lev, " layer:4(%d): %hu", sizeof(__u8), nbyte->layer); if(len - sizeof(*nbyte) < nbyte->len) { rec_dbg(lev, " data(%d): -- payload too short --", nbyte->len); return; } data = (char *)nbyte + sizeof(*nbyte); for(i = 0; i < nbyte->len; i++) data[i] = isprint(data[i]) ? data[i] : '.'; data[i] = '\0'; rec_dbg(lev, " data(%d): %s", nbyte->len, data); } #endif /* * debug ematch u32 */ void debug_ematch_u32(int lev, void *p, int len) { struct tc_u32_key *key; if(len < sizeof(*key)) { rec_dbg(lev, "[ tc_u32_key(%d) ] -- payload too short --", len); return; } key = (struct tc_u32_key *)p; rec_dbg(lev, "[ tc_u32_key(%d) ]", sizeof(*key)); rec_dbg(lev, " mask(%d): 0x%08x", sizeof(key->mask), key->mask); /* AND */ rec_dbg(lev, " val(%d): 0x%08x", sizeof(key->val), key->val); /* XOR */ rec_dbg(lev, " off(%d): %d", sizeof(key->off), key->off); /* Offset */ rec_dbg(lev, " offmask(%d): 0x%08x", sizeof(key->offmask), key->offmask); } #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H /* * debug ematch meta */ void debug_ematch_meta(int lev, void *p, int len) { struct rtattr *meta[__TCA_EM_META_MAX]; struct tcf_meta_hdr *hdr = NULL; parse_rtattr(meta, TCA_EM_META_MAX, p, len); if(meta[TCA_EM_META_HDR]) hdr = debug_tca_em_meta_hdr(lev, meta[TCA_EM_META_HDR], "TCA_EM_META_HDR"); if(!hdr) return; if(meta[TCA_EM_META_LVALUE]) debug_tca_em_meta_value(lev, meta[TCA_EM_META_LVALUE], "TCA_EM_META_LVALUE", &(hdr->left)); if(meta[TCA_EM_META_RVALUE]) debug_tca_em_meta_value(lev, meta[TCA_EM_META_RVALUE], "TCA_EM_META_RVALUE", &(hdr->right)); } /* * debug attribute TCA_EM_META_HDR */ struct tcf_meta_hdr *debug_tca_em_meta_hdr(int lev, struct rtattr *meta, const char *name) { struct tcf_meta_hdr *hdr; struct tcf_meta_val *left, *right; if(debug_rta_len_chk(lev, meta, name, sizeof(*hdr))) return(NULL); hdr = (struct tcf_meta_hdr *)RTA_DATA(meta); left = &(hdr->left); right = &(hdr->right); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(meta->rta_len)); rec_dbg(lev, " [ tcf_meta_hdr(%d) ]", sizeof(*hdr)); rec_dbg(lev, " [ tcf_meta_val left(%d) ]", sizeof(*left)); rec_dbg(lev, " kind(%d): 0x%04x(%s,%s)", sizeof(left->kind), left->kind, conv_tcf_meta_type(TCF_META_TYPE(left->kind), 1), conv_tcf_meta_id(TCF_META_ID(left->kind), 1)); rec_dbg(lev, " shift(%d): %d", sizeof(left->shift), left->shift); rec_dbg(lev, " op(%d): %d(%s)", sizeof(left->op), left->op, conv_tcf_em_opnd(left->op, 1)); rec_dbg(lev, " [ tcf_meta_val right(%d) ]", sizeof(*right)); rec_dbg(lev, " kind(%d): 0x%04x(%s,%s)", sizeof(right->kind), right->kind, conv_tcf_meta_type(TCF_META_TYPE(right->kind), 1), conv_tcf_meta_id(TCF_META_ID(right->kind), 1)); rec_dbg(lev, " shift(%d): %d", sizeof(right->shift), right->shift); rec_dbg(lev, " op(%d): %d(%s)", sizeof(right->op), right->op, conv_tcf_em_opnd(right->op, 1)); return(hdr); } /* * debug attribute TCA_EM_META_LVALUE */ void debug_tca_em_meta_value(int lev, struct rtattr *meta, const char *name, struct tcf_meta_val *p) { int i, type, len = RTA_PAYLOAD(meta) + 1; char *data = (char *)RTA_DATA(meta), *val; type = TCF_META_TYPE(p->kind); switch(type) { case TCF_META_TYPE_VAR: val = malloc(len); if(!val) { rec_dbg(lev, "%s(%hu): -- %s --", name, RTA_ALIGN(meta->rta_len), strerror(errno)); return; } memset(val, 0, len); for(i = 0; i < RTA_PAYLOAD(meta); i++) val[i] = isprint(data[i]) ? data[i] : '.'; data[i] = '\0'; rec_dbg(lev, "%s(%hu): %s", name, RTA_ALIGN(meta->rta_len), data); free(val); break; case TCF_META_TYPE_INT: if(RTA_PAYLOAD(meta) < sizeof(__u32)) { rec_dbg(lev, "%s(%hu): -- payload too short --", name, RTA_ALIGN(meta->rta_len)); return; } rec_dbg(lev, "%s(%hu): %d", name, RTA_ALIGN(meta->rta_len), *(int *)RTA_DATA(meta)); break; default: rec_dbg(lev, "%s(%hu): -- unknown type(%d) --", name, RTA_ALIGN(meta->rta_len), type); return; } } #endif /* * convert TC_U32_* flags from number to string */ void conv_tc_u32_flags(int flags, char *flags_list, int len, unsigned char debug) { if(!flags) { strncpy(flags_list, debug ? "NONE" : "none", len); return; } #define _TC_U32_FLAGS(s1, s2) \ if((flags & TC_U32_##s1) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~ TC_U32_##s1) ? \ strncat(flags_list, debug ? #s1 "," : #s2 ",", \ len - strlen(flags_list) - 1) : \ strncat(flags_list, debug ? #s1 : #s2, \ len - strlen(flags_list) - 1); _TC_U32_FLAGS(TERMINAL, terminal); _TC_U32_FLAGS(OFFSET, offset); _TC_U32_FLAGS(VAROFFSET, varoffset); _TC_U32_FLAGS(EAT, eat); #undef _TC_U32_FLAGS if(!strlen(flags_list)) strncpy(flags_list, debug ? "UNKNOWN" : "unknown", len); } /* * convert ETH_P_* protocol from number to string */ const char *conv_eth_p(unsigned short proto, unsigned char debug) { #define _ETH_P(s1, s2) \ if(proto == ETH_P_##s1) \ return(debug ? #s1 : #s2); _ETH_P(LOOP, loop) _ETH_P(PUP, pup) _ETH_P(PUPAT, PUPAT) _ETH_P(IP, ip) _ETH_P(X25, x25) _ETH_P(ARP, arp) _ETH_P(BPQ, bpq) _ETH_P(IEEEPUP, ieeepup) _ETH_P(IEEEPUPAT, ieeeupat) _ETH_P(DEC, dec) _ETH_P(DNA_DL, dna_dl) _ETH_P(DNA_RC, dna_rc) _ETH_P(DNA_RT, dna_rt) _ETH_P(LAT, lat) _ETH_P(DIAG, diag) _ETH_P(CUST, cust) _ETH_P(SCA, sca) #ifdef ETH_P_TEB _ETH_P(TEB, teb) #endif _ETH_P(RARP, rarp) _ETH_P(ATALK, atalk) _ETH_P(AARP, aarp) _ETH_P(8021Q, 802.1q) _ETH_P(IPX, ipx) _ETH_P(IPV6, ipv6) #ifdef ETH_P_PAUSE _ETH_P(PAUSE, pause) #endif _ETH_P(SLOW, slow) _ETH_P(WCCP, wccp) _ETH_P(PPP_DISC, ppp_disc) _ETH_P(PPP_SES, ppp_ses) _ETH_P(MPLS_UC, mpls_uc) _ETH_P(MPLS_MC, mpls_mc) _ETH_P(ATMMPOA, atmmpoa) #ifdef ETH_P_LINK_CTL _ETH_P(LINK_CTL, link_ctl) #endif _ETH_P(ATMFATE, atmfate) #ifdef ETH_P_PAE _ETH_P(PAE, pae) #endif _ETH_P(AOE, aoe) #ifdef ETH_P_8021AD _ETH_P(8021AD, 802.1ad) #endif #ifdef ETH_P_802_EX1 _ETH_P(802_EX1, 802_ex1) #endif _ETH_P(TIPC, tipc) #ifdef ETH_P_8021AH _ETH_P(8021AH, 802.1ah) #endif #ifdef ETH_P_1588 _ETH_P(1588, 1588) #endif _ETH_P(FCOE, fcoe) #ifdef ETH_P_TDLS _ETH_P(TDLS, tdls) #endif _ETH_P(FIP, fip) #ifdef ETH_P_QINQ1 _ETH_P(QINQ1, q-in-q1) #endif #ifdef ETH_P_QINQ2 _ETH_P(QINQ2, q-in-q2) #endif #ifdef ETH_P_QINQ3 _ETH_P(QINQ3, q-in-q3) #endif #ifdef ETH_P_EDSA _ETH_P(EDSA, edsa) #endif #ifdef ETH_P_AF_IUCV _ETH_P(AF_IUCV, af_iucv) #endif _ETH_P(802_3, 802_3) _ETH_P(AX25, ax25) _ETH_P(ALL, all) _ETH_P(802_2, 802_2) _ETH_P(SNAP, snap) _ETH_P(DDCMP, ddcmp) _ETH_P(WAN_PPP, wan_ppp) _ETH_P(PPP_MP, ppp_mp) _ETH_P(LOCALTALK, localtalk) #ifdef ETH_P_CAN _ETH_P(CAN, can) #endif #ifdef ETH_P_CANFD _ETH_P(CANFD, canfd) #endif _ETH_P(PPPTALK, ppptalk) _ETH_P(TR_802_2, tr_802_2) _ETH_P(MOBITEX, mobitex) _ETH_P(CONTROL, control) _ETH_P(IRDA, irda) _ETH_P(ECONET, econet) _ETH_P(HDLC, hdlc) _ETH_P(ARCNET, arcnet) #ifdef ETH_P_DSA _ETH_P(DSA, dsa) #endif #ifdef ETH_P_TRAILER _ETH_P(TRAILER, trailer) #endif #ifdef ETH_P_PHONET _ETH_P(PHONET, phonet) #endif #ifdef ETH_P_IEEE802154 _ETH_P(IEEE802154, ieee802154) #endif #ifdef ETH_P_CAIF _ETH_P(CAIF, caif) #endif #undef _ETH_P return((const char *)(debug ? "UNKNOWN" : "unknown")); } /* * convert TCF_EM_* kind from number to string */ const char *conv_tcf_em_kind(int kind, unsigned char debug) { #define _TCF_EM(s1, s2) \ if(kind == TCF_EM_##s1) \ return(debug ? #s1 : #s2); _TCF_EM(CONTAINER, container) _TCF_EM(CMP, cmp) _TCF_EM(NBYTE, nbyte) _TCF_EM(U32, u32) _TCF_EM(META, meta) _TCF_EM(TEXT, text) #if HAVE_DECL_TCF_EM_VLAN _TCF_EM(VLAN, vlan) #endif #if HAVE_DECL_TCF_EM_CANID _TCF_EM(CANID, canid) #endif #if HAVE_DECL_TCF_EM_IPSET _TCF_EM(IPSET, ipset) #endif #undef _TCF_EM return(debug ? "UNKNOWN" : "unknown"); } /* * convert TCF_EM_* flags from number to string */ const char *conv_tcf_em_flag(int flag, unsigned char debug) { #define _TCF_EM(s1, s2) \ if(flag == TCF_EM_##s1) \ return(debug ? #s1 : #s2); _TCF_EM(REL_END, end) _TCF_EM(REL_AND, and) _TCF_EM(REL_OR, or) _TCF_EM(INVERT, invert) _TCF_EM(SIMPLE, simple) #undef _TCF_EM return(debug ? "UNKNOWN" : "unknown"); } #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_CMP_H /* * convert TCF_EM_ALIGN_* from number to string */ const char *conv_tcf_em_align(int align, unsigned char debug) { #define _TCF_EM_ALIGN(s1, s2) \ if(align == TCF_EM_ALIGN_##s1) \ return(debug ? #s1 : #s2); _TCF_EM_ALIGN(U8, u8) _TCF_EM_ALIGN(U16, u16) _TCF_EM_ALIGN(U32, u32) #undef _TCF_EM_ALIGN return(debug ? "UNKNOWN" : "unknown"); } #endif /* * convert TCF_EM_OPND_* from number to string */ const char *conv_tcf_em_opnd(int opnd, unsigned char debug) { #define _TCF_EM_OPND(s1, s2) \ if(opnd == TCF_EM_OPND_##s1) \ return(debug ? #s1 : #s2); _TCF_EM_OPND(EQ, eq) _TCF_EM_OPND(GT, gt) _TCF_EM_OPND(LT, lt) #undef _TCF_EM_OPND return(debug ? "UNKNOWN" : "unknown"); } #ifdef HAVE_LINUX_TC_EMATCH_TC_EM_META_H /* * convert TCF_META_TYPE_* from number to string */ const char *conv_tcf_meta_type(int type, unsigned char debug) { #define _TCF_META_TYPE(s1, s2) \ if(type == TCF_META_TYPE_##s1) \ return(debug ? #s1 : #s2); _TCF_META_TYPE(VAR, var) _TCF_META_TYPE(INT, int) #undef _TCF_META_TYPE return(debug ? "UNKNOWN" : "unknown"); } /* * convert TCF_META_ID_* from number to string */ const char *conv_tcf_meta_id(int id, unsigned char debug) { #define _TCF_META_ID(s1, s2) \ if(id == TCF_META_ID_##s1) \ return(debug ? #s1 : #s2); _TCF_META_ID(VALUE, value) _TCF_META_ID(RANDOM, random) _TCF_META_ID(LOADAVG_0, loadavg_0) _TCF_META_ID(LOADAVG_1, loadavg_1) _TCF_META_ID(LOADAVG_2, loadavg_2) _TCF_META_ID(DEV, dev) _TCF_META_ID(PRIORITY, priority) _TCF_META_ID(PROTOCOL, protocol) _TCF_META_ID(PKTTYPE, pkttype) _TCF_META_ID(PKTLEN, pktlen) _TCF_META_ID(DATALEN, datalen) _TCF_META_ID(MACLEN, maclen) _TCF_META_ID(NFMARK, nfmark) #if HAVE_DECL_TCA_TCINDEX_UNSPEC _TCF_META_ID(TCINDEX, tcindex) #endif _TCF_META_ID(RTCLASSID, rtclassid) _TCF_META_ID(RTIIF, rtiif) _TCF_META_ID(SK_FAMILY, sk_family) _TCF_META_ID(SK_STATE, sk_state) _TCF_META_ID(SK_REUSE, sk_reuse) _TCF_META_ID(SK_BOUND_IF, sk_bound_if) _TCF_META_ID(SK_REFCNT, sk_refcnt) _TCF_META_ID(SK_SHUTDOWN, sk_shutdown) _TCF_META_ID(SK_PROTO, sk_proto) _TCF_META_ID(SK_TYPE, sk_type) _TCF_META_ID(SK_RCVBUF, sk_rcvbuf) _TCF_META_ID(SK_RMEM_ALLOC, sk_rmem_alloc) _TCF_META_ID(SK_WMEM_ALLOC, sk_wmem_alloc) _TCF_META_ID(SK_OMEM_ALLOC, sk_omem_alloc) _TCF_META_ID(SK_WMEM_QUEUED, sk_wmem_queued) _TCF_META_ID(SK_RCV_QLEN, sk_rcv_qlen) _TCF_META_ID(SK_SND_QLEN, sk_snd_qlen) _TCF_META_ID(SK_ERR_QLEN, sk_err_qlen) _TCF_META_ID(SK_FORWARD_ALLOCS, sk_forward_allocs) _TCF_META_ID(SK_SNDBUF, sk_sndbug) _TCF_META_ID(SK_ALLOCS, sk_allocs) /* __TCF_META_ID_SK_ROUTE_CAPS */ _TCF_META_ID(SK_HASH, sk_hash) _TCF_META_ID(SK_LINGERTIME, sk_lingertime) _TCF_META_ID(SK_ACK_BACKLOG, sk_ack_backlog) _TCF_META_ID(SK_MAX_ACK_BACKLOG, sk_max_ack_backlog) _TCF_META_ID(SK_PRIO, sk_prio) _TCF_META_ID(SK_RCVLOWAT, sk_rcvlowat) _TCF_META_ID(SK_RCVTIMEO, sk_rcvtimeo) _TCF_META_ID(SK_SNDTIMEO, sk_sndtimeo) _TCF_META_ID(SK_SENDMSG_OFF, sk_sendmsg_off) _TCF_META_ID(SK_WRITE_PENDING, sk_write_pending) _TCF_META_ID(VLAN_TAG, vlan_tag) #if HAVE_DECL_TCF_META_ID_RXHASH _TCF_META_ID(RXHASH, rxhash) #endif #undef _TCF_META_ID return(debug ? "UNKNOWN" : "unknown"); } #endif nield-0.6.2/src/tcmsg_filter_basic.c000066400000000000000000000047551470100110300173660ustar00rootroot00000000000000/* * tcmsg_filter_basic.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse basic options */ int parse_tca_options_basic(char *msg, char **mp, struct rtattr *tca) { struct rtattr *basic[__TCA_BASIC_MAX]; char *mp_tmp = *mp; parse_nested_rtattr(basic, TCA_BASIC_MAX, tca); if(basic[TCA_BASIC_CLASSID]) if(parse_tca_classid(msg, mp, basic[TCA_BASIC_CLASSID])) return(1); if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(basic[TCA_BASIC_EMATCHES]) if(parse_tca_ematch(msg, *mp, basic[TCA_BASIC_EMATCHES])) return(1); if(basic[TCA_BASIC_POLICE]) if(parse_tca_act_options_police(msg, *mp, basic[TCA_BASIC_POLICE])) return(1); if(basic[TCA_BASIC_ACT]) if(parse_tca_acts(msg, *mp, basic[TCA_BASIC_ACT])) return(1); return(0); } /* * debug basic options */ void debug_tca_options_basic(int lev, struct rtattr *tca, const char *name) { struct rtattr *basic[__TCA_BASIC_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(basic, TCA_BASIC_MAX, tca); if(basic[TCA_BASIC_CLASSID]) debug_tca_classid(lev+1, basic[TCA_BASIC_CLASSID], "TCA_BASIC_CLASSID"); if(basic[TCA_BASIC_EMATCHES]) debug_tca_ematch(lev+1, basic[TCA_BASIC_EMATCHES], "TCA_BASIC_EMATCHES"); if(basic[TCA_BASIC_ACT]) debug_tca_acts(lev+1, basic[TCA_BASIC_ACT], "TCA_BASIC_ACT"); if(basic[TCA_BASIC_POLICE]) debug_tca_act_options_police(lev+1, basic[TCA_BASIC_POLICE], "TCA_BASIC_POLICE"); } nield-0.6.2/src/tcmsg_filter_cgroup.c000066400000000000000000000043131470100110300175720ustar00rootroot00000000000000/* * tcmsg_filter_cgroup.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_CGROUP_UNSPEC /* * parse cgroup options */ int parse_tca_options_cgroup(char *msg, char **mp, struct rtattr *tca) { struct rtattr *cgroup[__TCA_CGROUP_MAX]; parse_nested_rtattr(cgroup, TCA_CGROUP_MAX, tca); /* logging for each attribute below */ if(cgroup[TCA_CGROUP_EMATCHES]) if(parse_tca_ematch(msg, *mp, cgroup[TCA_CGROUP_EMATCHES])) return(1); if(cgroup[TCA_CGROUP_POLICE]) if(parse_tca_act_options_police(msg, *mp, cgroup[TCA_CGROUP_POLICE])) return(1); if(cgroup[TCA_CGROUP_ACT]) if(parse_tca_acts(msg, *mp, cgroup[TCA_CGROUP_ACT])) return(1); return(0); } /* * debug cgroup options */ void debug_tca_options_cgroup(int lev, struct rtattr *tca, const char *name) { struct rtattr *cgroup[__TCA_CGROUP_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(cgroup, TCA_CGROUP_MAX, tca); if(cgroup[TCA_CGROUP_ACT]) debug_tca_acts(lev+1, cgroup[TCA_CGROUP_ACT], "TCA_CGROUP_ACT"); if(cgroup[TCA_CGROUP_POLICE]) debug_tca_act_options_police(lev+1, cgroup[TCA_CGROUP_POLICE], "TCA_CGROUP_POLICE"); if(cgroup[TCA_CGROUP_EMATCHES]) debug_tca_ematch(lev+1, cgroup[TCA_CGROUP_EMATCHES], "TCA_CGROUP_EMATCHES"); } #endif nield-0.6.2/src/tcmsg_filter_flow.c000066400000000000000000000207261470100110300172500ustar00rootroot00000000000000/* * tcmsg_filter_flow.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_FLOW_UNSPEC /* * parse flow options */ int parse_tca_options_flow(char *msg, char **mp, struct rtattr *tca) { struct rtattr *flow[__TCA_FLOW_MAX]; char *mp_tmp = *mp; parse_nested_rtattr(flow, TCA_FLOW_MAX, tca); if(flow[TCA_FLOW_BASECLASS]) if(parse_tca_classid(msg, mp, flow[TCA_FLOW_BASECLASS])) return(1); if(flow[TCA_FLOW_KEYS]) if(parse_tca_flow_keys(msg, mp, flow[TCA_FLOW_KEYS])) return(1); if(flow[TCA_FLOW_MODE]) if(parse_tca_flow_mode(msg, mp, flow[TCA_FLOW_MODE])) return(1); if(flow[TCA_FLOW_MASK]) if(parse_tca_mask(msg, mp, flow[TCA_FLOW_MASK])) return(1); if(flow[TCA_FLOW_XOR]) if(parse_tca_flow_xor(msg, mp, flow[TCA_FLOW_XOR])) return(1); if(flow[TCA_FLOW_RSHIFT]) if(parse_tca_flow_rshift(msg, mp, flow[TCA_FLOW_RSHIFT])) return(1); if(flow[TCA_FLOW_ADDEND]) if(parse_tca_flow_addend(msg, mp, flow[TCA_FLOW_ADDEND])) return(1); if(flow[TCA_FLOW_DIVISOR]) if(parse_tca_flow_divisor(msg, mp, flow[TCA_FLOW_DIVISOR])) return(1); if(flow[TCA_FLOW_PERTURB]) if(parse_tca_flow_perturb(msg, mp, flow[TCA_FLOW_PERTURB])) return(1); if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(flow[TCA_FLOW_EMATCHES]) if(parse_tca_ematch(msg, *mp, flow[TCA_FLOW_EMATCHES])) return(1); if(flow[TCA_FLOW_POLICE]) if(parse_tca_act_options_police(msg, *mp, flow[TCA_FLOW_POLICE])) return(1); if(flow[TCA_FLOW_ACT]) if(parse_tca_acts(msg, *mp, flow[TCA_FLOW_ACT])) return(1); return(0); } /* * parse attribute TCA_FLOW_KEYS */ int parse_tca_flow_keys(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "keys=%s ", conv_flow_key(*(unsigned *)RTA_DATA(flow), 0)); return(0); } /* * parse attribute TCA_FLOW_MODE */ int parse_tca_flow_mode(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "mode=%s ", conv_flow_mode(*(unsigned *)RTA_DATA(flow), 0)); return(0); } /* * parse attribute TCA_FLOW_XOR */ int parse_tca_flow_xor(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "xor=0x%08x ", *(unsigned *)RTA_DATA(flow)); return(0); } /* * parse attribute TCA_FLOW_RSHIFT */ int parse_tca_flow_rshift(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "rshift=%u ", *(unsigned *)RTA_DATA(flow)); return(0); } /* * parse attribute TCA_FLOW_ADDEND */ int parse_tca_flow_addend(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "addend=0x%x ", *(unsigned *)RTA_DATA(flow)); return(0); } /* * parse attribute TCA_FLOW_DIVISOR */ int parse_tca_flow_divisor(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "divisor=%u ", *(unsigned *)RTA_DATA(flow)); return(0); } /* * parse attribute TCA_FLOW_PERTURB */ int parse_tca_flow_perturb(char *msg, char **mp, struct rtattr *flow) { if(RTA_PAYLOAD(flow) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "perturb=%u(sec) ", *(unsigned *)RTA_DATA(flow)); return(0); } /* * debug flow options */ void debug_tca_options_flow(int lev, struct rtattr *tca, const char *name) { struct rtattr *flow[__TCA_FLOW_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(flow, TCA_FLOW_MAX, tca); if(flow[TCA_FLOW_KEYS]) debug_rta_u32(lev+1, flow[TCA_FLOW_KEYS], "TCA_FLOW_KEYS", conv_flow_key); if(flow[TCA_FLOW_MODE]) debug_rta_u32(lev+1, flow[TCA_FLOW_MODE], "TCA_FLOW_MODE", conv_flow_mode); if(flow[TCA_FLOW_BASECLASS]) debug_tca_classid(lev+1, flow[TCA_FLOW_BASECLASS], "TCA_FLOW_BASECLASS"); if(flow[TCA_FLOW_RSHIFT]) debug_rta_u32(lev+1, flow[TCA_FLOW_RSHIFT], "TCA_FLOW_RSHIT", NULL); if(flow[TCA_FLOW_ADDEND]) debug_rta_u32x(lev+1, flow[TCA_FLOW_ADDEND], "TCA_FLOW_ADDEND", NULL); if(flow[TCA_FLOW_MASK]) debug_rta_u32x(lev+1, flow[TCA_FLOW_MASK], "TCA_FLOW_MASK", NULL); if(flow[TCA_FLOW_XOR]) debug_rta_u32x(lev+1, flow[TCA_FLOW_XOR], "TCA_FLOW_XOR", NULL); if(flow[TCA_FLOW_DIVISOR]) debug_rta_u32(lev+1, flow[TCA_FLOW_DIVISOR], "TCA_FLOW_DIVISOR", NULL); if(flow[TCA_FLOW_ACT]) debug_tca_acts(lev+1, flow[TCA_FLOW_ACT], "TCA_FLOW_ACT"); if(flow[TCA_FLOW_POLICE]) debug_tca_act_options_police(lev+1, flow[TCA_FLOW_POLICE], "TCA_FLOW_POLICE"); if(flow[TCA_FLOW_EMATCHES]) debug_tca_ematch(lev+1, flow[TCA_FLOW_EMATCHES], "TCA_FLOW_EMATCHES"); if(flow[TCA_FLOW_PERTURB]) debug_rta_u32(lev+1, flow[TCA_FLOW_PERTURB], "TCA_FLOW_PERTURB", NULL); } /* * convert FLOW_KEY_* flags from number to string */ const char *conv_flow_key(unsigned flags, unsigned char debug) { static char list[MAX_STR_SIZE]; unsigned len = sizeof(list); strncpy(list, "", sizeof(list)); if(!flags) { strncpy(list, debug ? "NONE" : "none", len); return((const char *)list); } #define _FLOW_KEY(s1, s2) \ if((flags & (1 << FLOW_KEY_##s1)) && (len - strlen(list) - 1 > 0)) \ (flags &= ~(1 << FLOW_KEY_##s1)) ? \ strncat(list, debug ? #s1 "," : #s2 ",", \ len - strlen(list) - 1) : \ strncat(list, debug ? #s1 : #s2, \ len - strlen(list) - 1); _FLOW_KEY(SRC, src) _FLOW_KEY(DST, dst) _FLOW_KEY(PROTO, proto) _FLOW_KEY(PROTO_SRC, proto-src) _FLOW_KEY(PROTO_DST, proto-dst) _FLOW_KEY(IIF, iif) _FLOW_KEY(PRIORITY, priority) _FLOW_KEY(MARK, mark) _FLOW_KEY(NFCT, nfct) _FLOW_KEY(NFCT_SRC, nfct-src) _FLOW_KEY(NFCT_DST, nfct-dst) _FLOW_KEY(NFCT_PROTO_SRC, nfct-proto-src) _FLOW_KEY(NFCT_PROTO_DST, nfct-proto-dst) _FLOW_KEY(RTCLASSID, rt-classid) _FLOW_KEY(SKUID, sk-uid) _FLOW_KEY(SKGID, sk-gid) _FLOW_KEY(VLAN_TAG, vlan-tag) #if HAVE_DECL_FLOW_KEY_RXHASH _FLOW_KEY(RXHASH, rxhash) #endif #undef _FLOW_KEY if(!strlen(list)) strncpy(list, debug ? "UNKNOWN" : "unknown", len); return((const char *)list); } /* * convert FLOW_MODE_* protocol from number to string */ const char *conv_flow_mode(unsigned mode, unsigned char debug) { #define _FLOW_MODE(s1, s2) \ if(mode == FLOW_MODE_##s1) \ return(debug ? #s1 : #s2); _FLOW_MODE(MAP, map) _FLOW_MODE(HASH, hash) #undef _FLOW_MODE return(debug ? "UNKNOWN" : "unknown"); } #endif nield-0.6.2/src/tcmsg_filter_fw.c000066400000000000000000000051471470100110300167150ustar00rootroot00000000000000/* * tcmsg_filter_fw.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse fw options */ int parse_tca_options_fw(char *msg, char **mp, struct rtattr *tca) { struct rtattr *fw[__TCA_FW_MAX]; char *mp_tmp = *mp; parse_nested_rtattr(fw, TCA_FW_MAX, tca); if(fw[TCA_FW_CLASSID]) if(parse_tca_classid(msg, mp, fw[TCA_FW_CLASSID])) return(1); if(fw[TCA_FW_INDEV]) if(parse_tca_indev(msg, mp, fw[TCA_FW_INDEV])) return(1); #if HAVE_DECL_TCA_FW_MASK if(fw[TCA_FW_MASK]) if(parse_tca_mask(msg, mp, fw[TCA_FW_MASK])) return(1); #endif if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(fw[TCA_FW_POLICE]) if(parse_tca_act_options_police(msg, *mp, fw[TCA_FW_POLICE])) return(1); if(fw[TCA_FW_ACT]) if(parse_tca_acts(msg, *mp, fw[TCA_FW_ACT])) return(1); return(0); } /* * debug fw options */ void debug_tca_options_fw(int lev, struct rtattr *tca, const char *name) { struct rtattr *fw[__TCA_FW_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(fw, TCA_FW_MAX, tca); if(fw[TCA_FW_CLASSID]) debug_tca_classid(lev+1, fw[TCA_FW_CLASSID], "TCA_FW_CLASSID"); if(fw[TCA_FW_POLICE]) debug_tca_act_options_police(lev+1, fw[TCA_FW_POLICE], "TCA_FW_POLICE"); if(fw[TCA_FW_INDEV]) debug_rta_str(lev+1, fw[TCA_FW_INDEV], "TCA_FW_INDEV", NULL, IFNAMSIZ); if(fw[TCA_FW_ACT]) debug_tca_acts(lev+1, fw[TCA_FW_ACT], "TCA_FW_ACT"); #if HAVE_DECL_TCA_FW_MASK if(fw[TCA_FW_MASK]) debug_rta_u32x(lev+1, fw[TCA_FW_MASK], "TCA_FW_MASK", NULL); #endif } nield-0.6.2/src/tcmsg_filter_route.c000066400000000000000000000102021470100110300174230ustar00rootroot00000000000000/* * tcmsg_filter_route.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse route options */ int parse_tca_options_route(char *msg, char **mp, struct rtattr *tca) { struct rtattr *route[__TCA_ROUTE4_MAX]; #if HAVE_DECL_TCA_RSVP_UNSPEC char *mp_tmp = *mp; #endif parse_nested_rtattr(route, TCA_ROUTE4_MAX, tca); if(route[TCA_ROUTE4_CLASSID]) if(parse_tca_classid(msg, mp, route[TCA_ROUTE4_CLASSID])) return(1); if(route[TCA_ROUTE4_FROM]) if(parse_tca_route4_from(msg, mp, route[TCA_ROUTE4_FROM])) return(1); if(route[TCA_ROUTE4_IIF]) if(parse_tca_route4_iif(msg, mp, route[TCA_ROUTE4_IIF])) return(1); if(route[TCA_ROUTE4_TO]) if(parse_tca_route4_to(msg, mp, route[TCA_ROUTE4_TO])) return(1); #if HAVE_DECL_TCA_RSVP_UNSPEC if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(route[TCA_ROUTE4_POLICE]) if(parse_tca_act_options_police(msg, *mp, route[TCA_RSVP_POLICE])) return(1); if(route[TCA_ROUTE4_ACT]) if(parse_tca_acts(msg, *mp, route[TCA_RSVP_ACT])) return(1); #endif return(0); } /* * parse attribute TCA_ROUTE4_FROM */ int parse_tca_route4_from(char *msg, char **mp, struct rtattr *route) { if(RTA_PAYLOAD(route) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "from(realm)=%u ", *(unsigned *)RTA_DATA(route)); return(0); } /* * parse attribute TCA_ROUTE4_IIF */ int parse_tca_route4_iif(char *msg, char **mp, struct rtattr *route) { int ifindex; char ifname[IFNAMSIZ]; if(RTA_PAYLOAD(route) < sizeof(ifindex)) { rec_log("error: %s: payload too short", __func__); return(1); } ifindex = *(int *)RTA_DATA(route); if_indextoname_from_lists(ifindex, ifname); *mp = add_log(msg, *mp, "from(interface)=%s ", ifname); return(0); } /* * parse attribute TCA_ROUTE4_TO */ int parse_tca_route4_to(char *msg, char **mp, struct rtattr *route) { if(RTA_PAYLOAD(route) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "to(realm)=%u ", *(unsigned *)RTA_DATA(route)); return(0); } /* * debug route options */ void debug_tca_options_route(int lev, struct rtattr *tca, const char *name) { struct rtattr *route[__TCA_ROUTE4_MAX]; rec_dbg(lev, "%s(hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(route, TCA_ROUTE4_MAX, tca); if(route[TCA_ROUTE4_CLASSID]) debug_tca_classid(lev+1, route[TCA_ROUTE4_CLASSID], "TCA_ROUTE4_CLASSID"); if(route[TCA_ROUTE4_TO]) debug_rta_u32(lev+1, route[TCA_ROUTE4_TO], "TCA_ROUTE4_TO", NULL); if(route[TCA_ROUTE4_FROM]) debug_rta_u32(lev+1, route[TCA_ROUTE4_FROM], "TCA_ROUTE4_FROM", NULL); if(route[TCA_ROUTE4_IIF]) debug_rta_ifindex(lev+1, route[TCA_ROUTE4_IIF], "TCA_ROUTE4_IIF"); if(route[TCA_ROUTE4_POLICE]) debug_tca_act_options_police(lev+1, route[TCA_ROUTE4_POLICE], "TCA_ROUTE4_POLICE"); if(route[TCA_ROUTE4_ACT]) debug_tca_acts(lev+1, route[TCA_ROUTE4_ACT], "TCA_ROUTE4_ACT"); } nield-0.6.2/src/tcmsg_filter_rsvp.c000066400000000000000000000142601470100110300172670ustar00rootroot00000000000000/* * tcmsg_filter_rsvp.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_RSVP_UNSPEC /* * parse rsvp options */ int parse_tca_options_rsvp(char *msg, char **mp, struct tcmsg *tcm, struct rtattr *tca) { struct rtattr *rsvp[__TCA_RSVP_MAX]; char *mp_tmp = *mp; parse_nested_rtattr(rsvp, TCA_RSVP_MAX, tca); if(rsvp[TCA_RSVP_CLASSID]) if(parse_tca_classid(msg, mp, rsvp[TCA_RSVP_CLASSID])) return(1); if(rsvp[TCA_RSVP_DST]) if(parse_tca_rsvp_dst(msg, mp, tcm, rsvp[TCA_RSVP_DST])) return(1); if(rsvp[TCA_RSVP_SRC]) if(parse_tca_rsvp_src(msg, mp, tcm, rsvp[TCA_RSVP_SRC])) return(1); if(rsvp[TCA_RSVP_PINFO]) if(parse_tca_rsvp_pinfo(msg, mp, rsvp[TCA_RSVP_PINFO])) return(1); if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(rsvp[TCA_RSVP_POLICE]) if(parse_tca_act_options_police(msg, *mp, rsvp[TCA_RSVP_POLICE])) return(1); if(rsvp[TCA_RSVP_ACT]) if(parse_tca_acts(msg, *mp, rsvp[TCA_RSVP_ACT])) return(1); return(0); } /* * parse attribute TCA_RSVP_DST */ int parse_tca_rsvp_dst(char *msg, char **mp, struct tcmsg *tcm, struct rtattr *rsvp) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = inet_ntop_tc_addr(tcm, rsvp, addr, sizeof(addr)); if(res) { rec_log("error: %s: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } *mp = add_log(msg, *mp, "destination=%s ", addr); return(0); } /* * parse attribute TCA_RSVP_SRC */ int parse_tca_rsvp_src(char *msg, char **mp, struct tcmsg *tcm, struct rtattr *rsvp) { char addr[INET6_ADDRSTRLEN+1] = ""; int res; res = inet_ntop_tc_addr(tcm, rsvp, addr, sizeof(addr)); if(res) { rec_log("error: %s: %s", __func__, (res == 1) ? strerror(errno) : "payload too short"); return(1); } *mp = add_log(msg, *mp, "source=%s ", addr); return(0); } /* * parse attribute TCA_RSVP_PINFO */ int parse_tca_rsvp_pinfo(char *msg, char **mp, struct rtattr *rsvp) { struct tc_rsvp_pinfo *pinfo; struct tc_rsvp_gpi *dpi, *spi; struct protoent *proto; if(RTA_PAYLOAD(rsvp) < sizeof(*pinfo)) { rec_log("error: %s: -- payload too short --", __func__); return(1); } pinfo = (struct tc_rsvp_pinfo *)RTA_DATA(rsvp); dpi = &(pinfo->dpi); spi = &(pinfo->spi); proto = getprotobynumber(pinfo->protocol); *mp = add_log(msg, *mp, "dpi(key/mask/offset)=0x%08x/0x%08x/%d ", htonl(dpi->key), htonl(dpi->mask), dpi->offset); *mp = add_log(msg, *mp, "spi(key/mask/offset)=0x%08x/0x%08x/%d ", htonl(spi->key), htonl(spi->mask), spi->offset); *mp = add_log(msg, *mp, "tunnel(protocol/id/hdr)=%d(%s)/%d/%d ", pinfo->protocol, proto ? proto->p_name : "unknown", pinfo->tunnelid, pinfo->tunnelhdr); return(0); } /* * debug rsvp options */ void debug_tca_options_rsvp(int lev, struct tcmsg *tcm, struct rtattr *tca, const char *name) { struct rtattr *rsvp[__TCA_RSVP_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(rsvp, TCA_RSVP_MAX, tca); if(rsvp[TCA_RSVP_CLASSID]) debug_tca_classid(lev+1, rsvp[TCA_RSVP_CLASSID], "TCA_RSVP_CLASSID"); if(rsvp[TCA_RSVP_DST]) debug_rta_tc_addr(lev+1, tcm, rsvp[TCA_RSVP_DST], "TCA_RSVP_DST"); if(rsvp[TCA_RSVP_SRC]) debug_rta_tc_addr(lev+1, tcm, rsvp[TCA_RSVP_SRC], "TCA_RSVP_SRC"); if(rsvp[TCA_RSVP_PINFO]) debug_tca_rsvp_pinfo(lev+1, rsvp[TCA_RSVP_PINFO], "TCA_RSVP_PINFO"); if(rsvp[TCA_RSVP_POLICE]) debug_tca_act_options_police(lev+1, rsvp[TCA_RSVP_POLICE], "TCA_RSVP_POLICE"); if(rsvp[TCA_RSVP_ACT]) debug_tca_acts(lev+1, rsvp[TCA_RSVP_ACT], "TCA_RSVP_ACT"); } /* * debug attribute TCA_RSVP_PINFO */ void debug_tca_rsvp_pinfo(int lev, struct rtattr *rsvp, const char *name) { struct tc_rsvp_pinfo *pinfo; struct tc_rsvp_gpi *dpi, *spi; if(debug_rta_len_chk(lev, rsvp, name, sizeof(*pinfo))) return; pinfo = (struct tc_rsvp_pinfo *)RTA_DATA(rsvp); dpi = &(pinfo->dpi); spi = &(pinfo->spi); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(rsvp->rta_len)); rec_dbg(lev, " [ tc_rsvp_pinfo(%d) ]", sizeof(*pinfo)); rec_dbg(lev, " [ tc_rsvp_gpi dpi(%d) ]", sizeof(*dpi)); rec_dbg(lev, " key(%d): 0x%08x", sizeof(dpi->key), dpi->key); rec_dbg(lev, " mask(%d): 0x%08x", sizeof(dpi->mask), dpi->mask); rec_dbg(lev, " offset(%d): %d", sizeof(dpi->offset), dpi->offset); rec_dbg(lev, " [ tc_rsvp_gpi spi(%d) ]", sizeof(*spi)); rec_dbg(lev, " key(%d): 0x%08x", sizeof(spi->key), spi->key); rec_dbg(lev, " mask(%d): 0x%08x", sizeof(spi->mask), spi->mask); rec_dbg(lev, " offset(%d): %d", sizeof(spi->offset), spi->offset); rec_dbg(lev, " protocol(%d): %d", sizeof(pinfo->protocol), pinfo->protocol); rec_dbg(lev, " tunnelid(%d): %d", sizeof(pinfo->tunnelid), pinfo->tunnelid); rec_dbg(lev, " tunnelhdr(%d): %d", sizeof(pinfo->tunnelhdr), pinfo->tunnelhdr); rec_dbg(lev, " pad(%d): %d", sizeof(pinfo->pad), pinfo->pad); } #endif nield-0.6.2/src/tcmsg_filter_tcindex.c000066400000000000000000000115151470100110300177330ustar00rootroot00000000000000/* * tcmsg_filter_tcindex.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_TCINDEX_UNSPEC /* * parse tcindex options */ int parse_tca_options_tcindex(char *msg, char **mp, struct rtattr *tca) { struct rtattr *tcindex[__TCA_TCINDEX_MAX]; char *mp_tmp = *mp; parse_nested_rtattr(tcindex, TCA_TCINDEX_MAX, tca); if(tcindex[TCA_TCINDEX_CLASSID]) if(parse_tca_classid(msg, mp, tcindex[TCA_TCINDEX_CLASSID])) return(1); if(tcindex[TCA_TCINDEX_HASH]) if(parse_tca_tcindex_hash(msg, mp, tcindex[TCA_TCINDEX_HASH])) return(1); if(tcindex[TCA_TCINDEX_MASK]) if(parse_tca_tcindex_mask(msg, mp, tcindex[TCA_TCINDEX_MASK])) return(1); if(tcindex[TCA_TCINDEX_SHIFT]) if(parse_tca_tcindex_shift(msg, mp, tcindex[TCA_TCINDEX_SHIFT])) return(1); if(tcindex[TCA_TCINDEX_FALL_THROUGH]) if(parse_tca_tcindex_fall_through(msg, mp, tcindex[TCA_TCINDEX_FALL_THROUGH])) return(1); if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(tcindex[TCA_TCINDEX_POLICE]) if(parse_tca_act_options_police(msg, *mp, tcindex[TCA_TCINDEX_POLICE])) return(1); if(tcindex[TCA_TCINDEX_ACT]) if(parse_tca_acts(msg, *mp, tcindex[TCA_TCINDEX_ACT])) return(1); return(0); } /* * parse attribute TCA_TCINDEX_HASH */ int parse_tca_tcindex_hash(char *msg, char **mp, struct rtattr *tcindex) { if(RTA_PAYLOAD(tcindex) < sizeof(unsigned short)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "hash=%hu ", *(unsigned short *)RTA_DATA(tcindex)); return(0); } /* * parse attribute TCA_TCINDEX_MASK */ int parse_tca_tcindex_mask(char *msg, char **mp, struct rtattr *tcindex) { if(RTA_PAYLOAD(tcindex) < sizeof(unsigned short)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "mask=0x%04x ", *(unsigned short *)RTA_DATA(tcindex)); return(0); } /* * parse attribute TCA_TCINDEX_SHIFT */ int parse_tca_tcindex_shift(char *msg, char **mp, struct rtattr *tcindex) { if(RTA_PAYLOAD(tcindex) < sizeof(int)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "shift=%d ", *(int *)RTA_DATA(tcindex)); return(0); } /* * parse attribute TCA_TCINDEX_FALL_THROUGH */ int parse_tca_tcindex_fall_through(char *msg, char **mp, struct rtattr *tcindex) { if(RTA_PAYLOAD(tcindex) < sizeof(int)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "flag=%s ", *(int *)RTA_DATA(tcindex) ? "fall_through" : "pass_on"); return(0); } /* * debug tcindex options */ void debug_tca_options_tcindex(int lev, struct rtattr *tca, const char *name) { struct rtattr *tcindex[__TCA_TCINDEX_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(tcindex, TCA_TCINDEX_MAX, tca); if(tcindex[TCA_TCINDEX_HASH]) debug_rta_u16(lev+1, tcindex[TCA_TCINDEX_HASH], "TCA_TCINDEX_HASH", NULL); if(tcindex[TCA_TCINDEX_MASK]) debug_rta_u16x(lev+1, tcindex[TCA_TCINDEX_MASK], "TCA_TCINDEX_MASK", NULL); if(tcindex[TCA_TCINDEX_SHIFT]) debug_rta_s32(lev+1, tcindex[TCA_TCINDEX_SHIFT], "TCA_TCINDEX_SHIFT", NULL); if(tcindex[TCA_TCINDEX_FALL_THROUGH]) debug_rta_s32x(lev+1, tcindex[TCA_TCINDEX_FALL_THROUGH], "TCA_TCINDEX_FALL_THROUGH", NULL); if(tcindex[TCA_TCINDEX_CLASSID]) debug_tca_classid(lev+1, tcindex[TCA_TCINDEX_CLASSID], "TCA_TCINDEX_CLASSID"); if(tcindex[TCA_TCINDEX_POLICE]) debug_tca_act_options_police(lev+1, tcindex[TCA_TCINDEX_POLICE], "TCA_TCINDEX_POLICE"); if(tcindex[TCA_TCINDEX_ACT]) debug_tca_acts(lev+1, tcindex[TCA_TCINDEX_ACT], "TCA_TCINDEX_ACT"); } #endif nield-0.6.2/src/tcmsg_filter_u32.c000066400000000000000000000254201470100110300167060ustar00rootroot00000000000000/* * tcmsg_filter_u32.c - traffic control filter message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse u32 options */ int parse_tca_options_u32(char *msg, char **mp, struct rtattr *tca) { struct rtattr *u32[__TCA_U32_MAX]; char *mp_tmp = *mp; parse_nested_rtattr(u32, TCA_U32_MAX, tca); if(u32[TCA_U32_CLASSID]) if(parse_tca_classid(msg, mp, u32[TCA_U32_CLASSID])) return(1); if(u32[TCA_U32_HASH]) if(parse_tca_u32_hash(msg, mp, u32[TCA_U32_HASH])) return(1); if(u32[TCA_U32_LINK]) if(parse_tca_u32_link(msg, mp, u32[TCA_U32_LINK])) return(1); if(u32[TCA_U32_DIVISOR]) if(parse_tca_u32_divisor(msg, mp, u32[TCA_U32_DIVISOR])) return(1); if(u32[TCA_U32_INDEV]) if(parse_tca_indev(msg, mp, u32[TCA_U32_INDEV])) return(1); if(u32[TCA_U32_MARK]) if(parse_tca_u32_mark(msg, mp, u32[TCA_U32_MARK])) return(1); if(*mp != mp_tmp) rec_log("%s", msg); /* rollback pointer */ *mp = mp_tmp; /* logging for each attribute below */ if(u32[TCA_U32_SEL]) if(parse_tca_u32_sel(msg, *mp, u32[TCA_U32_SEL])) return(1); if(u32[TCA_U32_POLICE]) if(parse_tca_act_options_police(msg, *mp, u32[TCA_U32_POLICE])) return(1); if(u32[TCA_U32_ACT]) if(parse_tca_acts(msg, *mp, u32[TCA_U32_ACT])) return(1); return(0); } /* * parse attribute TCA_U32_HASH */ int parse_tca_u32_hash(char *msg, char **mp, struct rtattr *u32) { unsigned htid; if(RTA_PAYLOAD(u32) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } htid = *(unsigned *)RTA_DATA(u32); *mp = add_log(msg, *mp, "hash(table/bucket)=0x%x/0x%x ", TC_U32_USERHTID(htid), TC_U32_HASH(htid)); return(0); } /* * parse attribute TCA_U32_LINK */ int parse_tca_u32_link(char *msg, char **mp, struct rtattr *u32) { char handle[MAX_STR_SIZE] = ""; if(RTA_PAYLOAD(u32) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } parse_u32_handle(handle, sizeof(handle), *(unsigned *)RTA_DATA(u32)); *mp = add_log(msg, *mp, "link=%s ", handle); return(0); } /* * parse attribute TCA_U32_DIVISOR */ int parse_tca_u32_divisor(char *msg, char **mp, struct rtattr *u32) { if(RTA_PAYLOAD(u32) < sizeof(unsigned)) { rec_log("error: %s: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "divisor=%d ", *(unsigned *)RTA_DATA(u32)); return(0); } /* * parse attribute TCA_U32_MARK */ int parse_tca_u32_mark(char *msg, char **mp, struct rtattr *u32) { struct tc_u32_mark *mark; if(RTA_PAYLOAD(u32) < sizeof(*mark)) { rec_log("error: %s: payload too short", __func__); return(1); } mark = (struct tc_u32_mark *)RTA_DATA(u32); *mp = add_log(msg, *mp, "mark(value/mask)=0x%04x/0x%04x ", mark->val, mark->mask); return(0); } /* * parse attribute TCA_U32_SEL */ int parse_tca_u32_sel(char *msg, char *mp, struct rtattr *u32) { struct tc_u32_sel *sel; char flags_list[MAX_STR_SIZE] = ""; char *mp_tmp = mp; if(RTA_PAYLOAD(u32) < sizeof(*sel)) { rec_log("error: %s: payload too short", __func__); return(1); } sel = (struct tc_u32_sel *)RTA_DATA(u32); conv_tc_u32_flags(sel->flags, flags_list, sizeof(flags_list), 0), add_log(msg, mp, "flags=%s offshift=%d nkeys=%d offmask=0x%04x " "off=%hu offoff=%hd hoff=%hd hmask=0x%08x ", flags_list, sel->offshift, sel->nkeys, ntohs(sel->offmask), sel->off, sel->offoff, sel->hoff, ntohl(sel->hmask)); rec_log("%s", msg); /* rollback pointer */ mp = mp_tmp; int i, len; struct tc_u32_key *keys = sel->keys; len = sizeof(*sel) + (sizeof(*keys) * sel->nkeys); if(RTA_PAYLOAD(u32) < len) { rec_log("error: %s: payload too short", __func__); return(1); } for(i = 0; i < sel->nkeys; i++, keys++) { add_log(msg, mp, "key=%d value=0x%08x mask=0x%08x offset=%d offmask=0x%08x ", i + 1, ntohl(keys->val), ntohl(keys->mask), keys->off, ntohl(keys->offmask)); rec_log("%s", msg); } return(0); } /* * debug u32 options */ void debug_tca_options_u32(int lev, struct rtattr *tca, const char *name) { struct rtattr *u32[__TCA_U32_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(u32, TCA_U32_MAX, tca); if(u32[TCA_U32_CLASSID]) debug_tca_classid(lev+1, u32[TCA_U32_CLASSID], "TCA_U32_CLASSID"); if(u32[TCA_U32_HASH]) debug_rta_u32x(lev+1, u32[TCA_U32_HASH], "TCA_U32_HASH", conv_tca_u32_hash); if(u32[TCA_U32_LINK]) debug_tca_u32_link(lev+1, u32[TCA_U32_LINK], "TCA_U32_LINK"); if(u32[TCA_U32_DIVISOR]) debug_rta_u32(lev+1, u32[TCA_U32_DIVISOR], "TCA_U32_DIVISOR", NULL); if(u32[TCA_U32_SEL]) debug_tca_u32_sel(lev+1, u32[TCA_U32_SEL], "TCA_U32_SEL"); if(u32[TCA_U32_POLICE]) debug_tca_act_options_police(lev+1, u32[TCA_U32_POLICE], "TCA_U32_POLICE"); if(u32[TCA_U32_ACT]) debug_tca_acts(lev+1, u32[TCA_U32_ACT], "TCA_U32_ACT"); if(u32[TCA_U32_INDEV]) debug_rta_str(lev+1, u32[TCA_U32_INDEV], "TCA_U32_INDEV", NULL, IFNAMSIZ); if(u32[TCA_U32_PCNT]) debug_tca_u32_pcnt(lev+1, u32, "TCA_U32_PCNT"); if(u32[TCA_U32_MARK]) debug_tca_u32_mark(lev+1, u32[TCA_U32_MARK], "TCA_U32_MARK"); } /* * debug attribute TCA_U32_LINK */ void debug_tca_u32_link(int lev, struct rtattr *u32, const char *name) { unsigned n_handle; char s_handle[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, u32, name, sizeof(n_handle))) return; n_handle = *(unsigned *)RTA_DATA(u32); parse_u32_handle(s_handle, sizeof(s_handle), n_handle); rec_dbg(lev, "%s(%hu): 0x%08x(%s)", name, RTA_ALIGN(u32->rta_len), n_handle, s_handle); } /* * debug attribute TCA_U32_SEL */ void debug_tca_u32_sel(int lev, struct rtattr *u32, const char *name) { struct tc_u32_sel *sel; struct tc_u32_key *keys; char flags_list[MAX_STR_SIZE] = ""; int i, len; if(debug_rta_len_chk(lev, u32, name, sizeof(*sel))) return; sel = (struct tc_u32_sel *)RTA_DATA(u32); conv_tc_u32_flags(sel->flags, flags_list, sizeof(flags_list), 1); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(u32->rta_len)); rec_dbg(lev, " [ tc_u32_sel(%d) ]", sizeof(*sel)); rec_dbg(lev, " flags(%d): %d(%s)", sizeof(sel->flags), sel->flags, flags_list); rec_dbg(lev, " offshift(%d): %d", sizeof(sel->offshift), sel->offshift); rec_dbg(lev, " nkeys(%d): %d", sizeof(sel->nkeys), sel->nkeys); rec_dbg(lev, " offmask(%d): 0x%04x", sizeof(sel->offmask), sel->offmask); rec_dbg(lev, " off(%d): %hu", sizeof(sel->off), sel->off); rec_dbg(lev, " offoff(%d): %hd", sizeof(sel->offoff), sel->offoff); rec_dbg(lev, " hoff(%d): %hd", sizeof(sel->hoff), sel->hoff); rec_dbg(lev, " hmask(%d): 0x%08x", sizeof(sel->hmask), sel->hmask); len = sizeof(*sel) + (sizeof(*keys) * sel->nkeys); if(RTA_PAYLOAD(u32) < len) { rec_dbg(lev, " keys[0](%d): -- payload too short --", RTA_PAYLOAD(u32) - sizeof(*sel)); return; } keys = sel->keys; for(i = 0; i < sel->nkeys; i++, keys++) { rec_dbg(lev+2, "[ tc_u32_key keys[%d](%d) ]", i, sizeof(*keys)); rec_dbg(lev+2, " mask(%d): 0x%08x", sizeof(keys->mask), keys->mask); /* AND */ rec_dbg(lev+2, " val(%d): 0x%08x", sizeof(keys->val), keys->val); /* XOR */ rec_dbg(lev+2, " off(%d): %d", sizeof(keys->off), keys->off); /* Offset */ rec_dbg(lev+2, " offmask(%d): 0x%08x", sizeof(keys->offmask), keys->offmask); } } /* * debug attribute TCA_U32_PCNT */ void debug_tca_u32_pcnt(int lev, struct rtattr *u32[], const char *name) { struct tc_u32_pcnt *pcnt; struct tc_u32_sel *sel; unsigned long *kcnts; int i, len; if(debug_rta_len_chk(lev, u32[TCA_U32_PCNT], name, sizeof(*pcnt))) return; pcnt = (struct tc_u32_pcnt *)RTA_DATA(u32[TCA_U32_PCNT]); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(u32[TCA_U32_PCNT]->rta_len)); rec_dbg(lev, " [ tc_u32_pcnt(%d) ]", sizeof(*pcnt)); rec_dbg(lev, " rcnt(%d): %lu", sizeof(pcnt->rcnt), pcnt->rcnt); rec_dbg(lev, " rhit(%d): %lu", sizeof(pcnt->rhit), pcnt->rhit); if(RTA_PAYLOAD(u32[TCA_U32_SEL]) < sizeof(*sel)) return; sel = RTA_DATA(u32[TCA_U32_SEL]); len = sizeof(*pcnt) + (sel->nkeys * sizeof(unsigned long)); if(RTA_PAYLOAD(u32[TCA_U32_PCNT]) < len) { rec_dbg(lev, " kcnts[0](%d): -- payload too short --", RTA_PAYLOAD(u32[TCA_U32_PCNT]) - sizeof(*pcnt)); return; } kcnts = (unsigned long *)pcnt->kcnts; for(i = 0; i < sel->nkeys; i++, kcnts++) rec_dbg(lev, " kcnts[%d](%d): %lu", i, sizeof(*kcnts), *kcnts); } /* * debug attribute TCA_U32_MARK */ void debug_tca_u32_mark(int lev, struct rtattr *u32, const char *name) { struct tc_u32_mark *mark; if(debug_rta_len_chk(lev, u32, name, sizeof(*mark))) return; mark = (struct tc_u32_mark *)RTA_DATA(u32); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(u32->rta_len)); rec_dbg(lev, " [ tc_u32_mark(%d) ]", sizeof(*mark)); rec_dbg(lev, " val(%d): 0x%08x", sizeof(mark->val), mark->val); rec_dbg(lev, " mask(%d): 0x%08x", sizeof(mark->mask), mark->mask); rec_dbg(lev, " success(%d): 0x%08x", sizeof(mark->success), mark->success); } /* * convert TCA_U32_HASH from number to string */ const char *conv_tca_u32_hash(unsigned num, unsigned char debug) { static char str[MAX_STR_SIZE]; strncpy(str, "", sizeof(str)); snprintf(str, sizeof(str), "0x%x/0x%x", TC_U32_USERHTID(num), TC_U32_HASH(num)); return((const char *)str); } nield-0.6.2/src/tcmsg_qdisc.c000066400000000000000000000605601470100110300160370ustar00rootroot00000000000000/* * tcmsg_qdisc.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #define TIME_UNITS_PER_SEC 1000000 static double us2tick = 1; static double clock_factor = 1; /* * parse traffic control qdisc messages */ int parse_tcmsg_qdisc(struct nlmsghdr *nlh) { struct tcmsg *tcm; int tcm_len; struct rtattr *tca[__TCA_MAX]; char msg[MAX_MSG_SIZE] = ""; char *mp = msg; char ifname[IFNAMSIZ]; char parent[MAX_STR_SIZE] = ""; char handle[MAX_STR_SIZE] = ""; char kind[IFNAMSIZ] = "(unknown)"; int log_opts = get_log_opts(); /* debug nlmsghdr */ if(log_opts & L_DEBUG) debug_nlmsg(0, nlh); /* get tcmsg */ tcm_len = NLMSG_PAYLOAD(nlh, 0); if(tcm_len < sizeof(*tcm)) { rec_log("error: %s: tcmsg: length too short", __func__); return(1); } tcm = (struct tcmsg *)NLMSG_DATA(nlh); /* parse traffic control message attributes */ parse_tc(tca, nlh); /* debug tcmsg */ if(log_opts & L_DEBUG) debug_tcmsg(0, nlh, tcm, tca, tcm_len); /* kind of message */ switch(nlh->nlmsg_type) { case RTM_NEWQDISC: mp = add_log(msg, mp, "tc qdisc added: "); break; case RTM_DELQDISC: mp = add_log(msg, mp, "tc qdisc deleted: "); break; case RTM_NEWTCLASS: mp = add_log(msg, mp, "tc class added: "); break; case RTM_DELTCLASS: mp = add_log(msg, mp, "tc class deleted: "); break; default: rec_log("error: %s: nlmsg_type: unknown message", __func__); return(1); } /* get interface name */ if_indextoname_from_lists(tcm->tcm_ifindex, ifname); mp = add_log(msg, mp, "interface=%s ", ifname); /* get parent qdisc handle */ parse_tc_handle(parent, sizeof(parent), tcm->tcm_parent); mp = add_log(msg, mp, "parent=%s ", parent); /* get qdisc handle */ parse_tc_handle(handle, sizeof(handle), tcm->tcm_handle); mp = add_log(msg, mp, "classid=%s ", handle); /* get qdisc kind */ if(tca[TCA_KIND]) strncpy(kind, (char *)RTA_DATA(tca[TCA_KIND]), sizeof(kind)); mp = add_log(msg, mp, "qdisc=%s ", kind); /* get qdisc options */ if(tca[TCA_OPTIONS]) { if(!strncmp(kind, "pfifo_fast", sizeof(kind))) { if(parse_tca_options_prio(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "pfifo", sizeof(kind))) { if(parse_tca_options_pfifo(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "bfifo", sizeof(kind))) { if(parse_tca_options_bfifo(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "prio", sizeof(kind))) { if(parse_tca_options_prio(msg, &mp, tca[TCA_OPTIONS])) return(1); #ifdef HAVE_STRUCT_TC_MULTIQ_QOPT_BANDS } else if(!strncmp(kind, "multiq", sizeof(kind))) { if(parse_tca_options_multiq(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif #ifdef HAVE_STRUCT_TC_PLUG_QOPT_ACTION } else if(!strncmp(kind, "plug", sizeof(kind))) { if(parse_tca_options_plug(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif } else if(!strncmp(kind, "sfq", sizeof(kind))) { if(parse_tca_options_sfq(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "tbf", sizeof(kind))) { if(parse_tca_options_tbf(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "red", sizeof(kind))) { if(parse_tca_options_red(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "gred", sizeof(kind))) { if(parse_tca_options_gred(msg, &mp, tca[TCA_OPTIONS])) return(1); return(0); #if HAVE_DECL_TCA_CHOKE_UNSPEC } else if(!strncmp(kind, "choke", sizeof(kind))) { if(parse_tca_options_choke(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif } else if(!strncmp(kind, "htb", sizeof(kind))) { if(parse_tca_options_htb(msg, &mp, tca[TCA_OPTIONS])) return(1); } else if(!strncmp(kind, "hfsc", sizeof(kind))) { if(parse_tca_options_hfsc(msg, &mp, tca[TCA_OPTIONS])) return(1); #if HAVE_DECL_TCA_CBQ_UNSPEC } else if(!strncmp(kind, "cbq", sizeof(kind))) { if(parse_tca_options_cbq(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif #if HAVE_DECL_TCA_DSMARK_UNSPEC } else if(!strncmp(kind, "dsmark", sizeof(kind))) { if(parse_tca_options_dsmark(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif } else if(!strncmp(kind, "netem", sizeof(kind))) { if(parse_tca_options_netem(msg, &mp, tca[TCA_OPTIONS])) return(1); #if HAVE_DECL_TCA_DRR_UNSPEC } else if(!strncmp(kind, "drr", sizeof(kind))) { if(parse_tca_options_drr(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif #if HAVE_DECL_TCA_SFB_UNSPEC } else if(!strncmp(kind, "sfb", sizeof(kind))) { if(parse_tca_options_sfb(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif #if HAVE_DECL_TCA_QFQ_UNSPEC } else if(!strncmp(kind, "qfq", sizeof(kind))) { if(parse_tca_options_qfq(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif #if HAVE_DECL_TCA_CODEL_UNSPEC } else if(!strncmp(kind, "codel", sizeof(kind))) { if(parse_tca_options_codel(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif #if HAVE_DECL_TCA_FQ_CODEL_UNSPEC } else if(!strncmp(kind, "fq_codel", sizeof(kind))) { if(parse_tca_options_fq_codel(msg, &mp, tca[TCA_OPTIONS])) return(1); #endif } } /* write log */ rec_log("%s", msg); return(0); } /* * convert unit data rate */ void conv_unit_rate(char *str, int len, double num) { num *= 8.0; if(num >= 1000.0 * 1000.0 * 1000.0) snprintf(str, len, "%.3f(Gbit/s)", num / (1000.0 * 1000.0 * 1000.0)); else if(num >= 1000.0 * 1000.0) snprintf(str, len, "%.3f(Mbit/s)", num / (1000.0 * 1000.0)); else if(num >= 1000.0) snprintf(str, len, "%.3f(kbit/s)", num / 1000.0); else snprintf(str, len, "%.3f(bit/s)", num); } /* * convert unit data size */ void conv_unit_size(char *str, int len, double num) { if(num >= 1024.0 * 1024.0 * 1024.0) snprintf(str, len, "%.3f(Gbyte)", num / (1024.0 * 1024.0 * 1024.0)); else if(num >= 1024.0 * 1024.0) snprintf(str, len, "%.3f(Mbyte)", num / (1024.0 * 1024.0)); else if(num >= 1024.0) snprintf(str, len, "%.3f(Kbyte)", num / 1024.0); else snprintf(str, len, "%.3f(byte)", num); } /* * convert unit of time */ void conv_unit_usec(char *str, int len, double usec) { if(usec >= 1000.0 * 1000.0) snprintf(str, len, "%.3f(s)", usec / (1000.0 * 1000.0)); else if(usec >= 1000.0) snprintf(str, len, "%.3f(ms)", usec / 1000.0); else if(usec < 0) snprintf(str, len, "%.3f(us)", 0.0); else snprintf(str, len, "%.3f(us)", usec); } /* * get ticks per usec */ int get_us2tick(void) { FILE *fp; __u32 clock_res; __u32 us2ns; __u32 tick2ns; fp = fopen("/proc/net/psched", "r"); if(fp == NULL) return -1; if(fscanf(fp, "%08x%08x%08x", &us2ns, &tick2ns, &clock_res) != 3) { fclose(fp); return(-1); } fclose(fp); if(clock_res == 1000000000) us2ns = tick2ns; clock_factor = (double)clock_res / TIME_UNITS_PER_SEC; us2tick = (double)us2ns / tick2ns * clock_factor; return(0); } /* * get burst size * * (rate(byte/sec) * (buffer(tick) / us2tick(tick/usec))) / TIME_UNITS_PER_SEC(usec/sec) */ double get_burst_size(unsigned rate, unsigned buffer) { return((double)rate * (buffer / us2tick)) / TIME_UNITS_PER_SEC; } /* * get latency */ double get_latency(unsigned rate, unsigned buffer, unsigned limit) { return(TIME_UNITS_PER_SEC * (limit / (double)rate) - (buffer / us2tick)); } /* * debug traffic control message */ void debug_tcmsg(int lev, struct nlmsghdr *nlh, struct tcmsg *tcm, struct rtattr *tca[], int tcm_len) { /* debug tcmsg */ char ifname[IFNAMSIZ] = ""; char handle[MAX_STR_SIZE] = ""; char parent[MAX_STR_SIZE] = ""; char kind[IFNAMSIZ] = ""; if_indextoname_from_lists(tcm->tcm_ifindex, ifname); switch(nlh->nlmsg_type) { case RTM_NEWQDISC: case RTM_DELQDISC: case RTM_NEWTCLASS: case RTM_DELTCLASS: parse_tc_handle(handle, sizeof(handle), tcm->tcm_handle); break; case RTM_NEWTFILTER: case RTM_DELTFILTER: parse_u32_handle(handle, sizeof(handle), tcm->tcm_handle); break; } parse_tc_handle(parent, sizeof(parent), tcm->tcm_parent); rec_dbg(lev, "*********************************************************************"); rec_dbg(lev, "[ tcmsg(%d) ]", NLMSG_ALIGN(sizeof(*tcm))); rec_dbg(lev, " tcm_family(%d): %d(%s)", sizeof(tcm->tcm_family), tcm->tcm_family, conv_af_type(tcm->tcm_family, 1)); rec_dbg(lev, " tcm__pad1(%d): %d", sizeof(tcm->tcm__pad1), tcm->tcm__pad1); rec_dbg(lev, " tcm__pad2(%d): %d", sizeof(tcm->tcm__pad2), tcm->tcm__pad2); rec_dbg(lev, " tcm_ifindex(%d): %d(%s)", sizeof(tcm->tcm_ifindex), tcm->tcm_ifindex, ifname); rec_dbg(lev, " tcm_handle(%d): 0x%08x(%s)", sizeof(tcm->tcm_handle), tcm->tcm_handle, handle); rec_dbg(lev, " tcm_parent(%d): 0x%08x(%s)", sizeof(tcm->tcm_parent), tcm->tcm_parent, parent); rec_dbg(lev, " tcm_info(%d): 0x%08x(%u, %s)", sizeof(tcm->tcm_info), tcm->tcm_info, TC_H_MAJ(tcm->tcm_info)>>16, conv_eth_p(ntohs(TC_H_MIN(tcm->tcm_info)), 1)); /* debug traffic control attributes */ rec_dbg(lev,"*********************************************************************"); rec_dbg(lev, "[ tcmsg attributes(%d) ]", NLMSG_ALIGN(tcm_len - NLMSG_ALIGN(sizeof(*tcm)))); if(tca[TCA_KIND]) debug_rta_str(lev+1, tca[TCA_KIND], "TCA_KIND", kind, sizeof(kind)); if(tca[TCA_OPTIONS]) debug_tca_options(lev+1, tcm, tca[TCA_OPTIONS], "TCA_OPTIONS", kind, sizeof(kind)); if(tca[TCA_STATS]) debug_tca_stats(lev+1, tca[TCA_STATS], "TCA_STATS"); if(tca[TCA_XSTATS]) debug_tca_xstats(lev+1, tca[TCA_XSTATS], "TCA_XSTATS", kind, sizeof(kind)); if(tca[TCA_RATE]) debug_tca_rate(lev+1, tca[TCA_RATE], "TCA_RATE"); if(tca[TCA_FCNT]) debug_rta_u32x(lev+1, tca[TCA_FCNT], "TCA_FCNT", NULL); if(tca[TCA_STATS2]) debug_tca_stats2(lev+1, tca[TCA_STATS2], "TCA_STATS2"); #if HAVE_DECL_TCA_STAB_UNSPEC if(tca[TCA_STAB]) debug_tca_stab(lev+1, tca[TCA_STAB], "TCA_STAB"); #endif rec_dbg(lev, ""); } /* * debug attribute TCA_OPTIONS */ void debug_tca_options(int lev, struct tcmsg *tcm, struct rtattr *tca, const char *name, char *kind, int len) { /* kinds of qdisc */ if(!strncmp(kind, "pfifo_fast", len)) debug_tca_options_prio(lev, tca, name); else if(!strncmp(kind, "pfifo", len)) debug_tca_options_fifo(lev, tca, name); else if(!strncmp(kind, "bfifo", len)) debug_tca_options_fifo(lev, tca, name); else if(!strncmp(kind, "prio", len)) debug_tca_options_prio(lev, tca, name); #ifdef HAVE_STRUCT_TC_MULTIQ_QOPT_BANDS else if(!strncmp(kind, "multiq", len)) debug_tca_options_multiq(lev, tca, name); #endif #ifdef HAVE_STRUCT_TC_PLUG_QOPT_ACTION else if(!strncmp(kind, "plug", len)) debug_tca_options_plug(lev, tca, name); #endif else if(!strncmp(kind, "sfq", len)) debug_tca_options_sfq(lev, tca, name); else if(!strncmp(kind, "tbf", len)) debug_tca_options_tbf(lev, tca, name); else if(!strncmp(kind, "red", len)) debug_tca_options_red(lev, tca, name); else if(!strncmp(kind, "gred", len)) debug_tca_options_gred(lev, tca, name); #if HAVE_DECL_TCA_CHOKE_UNSPEC else if(!strncmp(kind, "choke", len)) debug_tca_options_choke(lev, tca, name); #endif else if(!strncmp(kind, "htb", len)) debug_tca_options_htb(lev, tca, name); else if(!strncmp(kind, "hfsc", len)) debug_tca_options_hfsc(lev, tca, name); #if HAVE_DECL_TCA_CBQ_UNSPEC else if(!strncmp(kind, "cbq", len)) debug_tca_options_cbq(lev, tca, name); #endif #if HAVE_DECL_TCA_DSMARK_UNSPEC else if(!strncmp(kind, "dsmark", len)) debug_tca_options_dsmark(lev, tca, name); #endif else if(!strncmp(kind, "netem", len)) debug_tca_options_netem(lev, tca, name); #if HAVE_DECL_TCA_DRR_UNSPEC else if(!strncmp(kind, "drr", len)) debug_tca_options_drr(lev, tca, name); #endif #if HAVE_DECL_TCA_SFB_UNSPEC else if(!strncmp(kind, "sfb", len)) debug_tca_options_sfb(lev, tca, name); #endif #if HAVE_DECL_TCA_QFQ_UNSPEC else if(!strncmp(kind, "qfq", len)) debug_tca_options_qfq(lev, tca, name); #endif #if HAVE_DECL_TCA_CODEL_UNSPEC else if(!strncmp(kind, "codel", len)) debug_tca_options_codel(lev, tca, name); #endif #if HAVE_DECL_TCA_FQ_CODEL_UNSPEC else if(!strncmp(kind, "fq_codel", len)) debug_tca_options_fq_codel(lev, tca, name); #endif else if(!strncmp(kind, "ingress", len)) return; /* kinds of filter */ else if(!strncmp(kind, "u32", len)) debug_tca_options_u32(lev, tca, name); #if HAVE_DECL_TCA_RSVP_UNSPEC else if(!strncmp(kind, "rsvp", len)) debug_tca_options_rsvp(lev, tcm, tca, name); #endif else if(!strncmp(kind, "route", len)) debug_tca_options_route(lev, tca, name); else if(!strncmp(kind, "fw", len)) debug_tca_options_fw(lev, tca, name); #if HAVE_DECL_TCA_TCINDEX_UNSPEC else if(!strncmp(kind, "tcindex", len)) debug_tca_options_tcindex(lev, tca, name); #endif #if HAVE_DECL_TCA_FLOW_UNSPEC else if(!strncmp(kind, "flow", len)) debug_tca_options_flow(lev, tca, name); #endif else if(!strncmp(kind, "basic", len)) debug_tca_options_basic(lev, tca, name); #if HAVE_DECL_TCA_CGROUP_UNSPEC else if(!strncmp(kind, "cgroup", len)) debug_tca_options_cgroup(lev, tca, name); #endif else rec_dbg(lev, "%s(%hu): -- unknown option %s --", name, RTA_ALIGN(tca->rta_len), kind); } /* * debug attribute TCA_STATS */ void debug_tca_stats(int lev, struct rtattr *tca, const char *name) { struct tc_stats *stats; if(debug_rta_len_chk(lev, tca, name, sizeof(*stats))) return; stats = (struct tc_stats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_stats(%d) ]", sizeof(*stats)); rec_dbg(lev, " bytes(%d): %lu", sizeof(stats->bytes), stats->bytes); rec_dbg(lev, " packets(%d): %u", sizeof(stats->packets), stats->packets); rec_dbg(lev, " drops(%d): %u", sizeof(stats->drops), stats->drops); rec_dbg(lev, " overlimits(%d): %u", sizeof(stats->overlimits), stats->overlimits); rec_dbg(lev, " bps(%d): %u", sizeof(stats->bps), stats->bps); rec_dbg(lev, " pps(%d): %u", sizeof(stats->pps), stats->pps); rec_dbg(lev, " qlen(%d): %u", sizeof(stats->qlen), stats->qlen); rec_dbg(lev, " backlog(%d): %u", sizeof(stats->backlog), stats->backlog); } /* * debug attribute TCA_XSTATS */ void debug_tca_xstats(int lev, struct rtattr *tca, const char *name, char *kind, int len) { /* if(0) is dummy */ if(0) return; #ifdef HAVE_STRUCT_TC_SFQ_XSTATS_ALLOT else if(!strncmp(kind, "sfq", len)) debug_tc_sfq_xstats(lev, tca, name); #endif else if(!strncmp(kind, "red", len)) debug_tc_red_xstats(lev, tca, name); #if HAVE_DECL_TCA_CHOKE_UNSPEC else if(!strncmp(kind, "choke", len)) debug_tc_choke_xstats(lev, tca, name); #endif else if(!strncmp(kind, "htb", len)) debug_tc_htb_xstats(lev, tca, name); #if HAVE_DECL_TCA_CBQ_UNSPEC else if(!strncmp(kind, "cbq", len)) debug_tc_cbq_xstats(lev, tca, name); #endif #if HAVE_DECL_TCA_DRR_UNSPEC else if(!strncmp(kind, "drr", len)) debug_tc_drr_xstats(lev, tca, name); #endif #if HAVE_DECL_TCA_SFB_UNSPEC else if(!strncmp(kind, "sfb", len)) debug_tc_sfb_xstats(lev, tca, name); #endif #if HAVE_DECL_TCA_QFQ_UNSPEC else if(!strncmp(kind, "qfq", len)) debug_tc_qfq_xstats(lev, tca, name); #endif #if HAVE_DECL_TCA_CODEL_UNSPEC else if(!strncmp(kind, "codel", len)) debug_tc_codel_xstats(lev, tca, name); #endif #if HAVE_DECL_TCA_FQ_CODEL_UNSPEC else if(!strncmp(kind, "fq_codel", len)) debug_tc_fq_codel_xstats(lev, tca, name); #endif else if(!strncmp(kind, "ingress", len)) return; else rec_dbg(lev, "%s(%hu): -- unknown kind %s --", name, RTA_ALIGN(tca->rta_len), kind); } /* * debug attribute TCA_RATE */ void debug_tca_rate(int lev, struct rtattr *tca, const char *name) { struct tc_estimator *rate; if(debug_rta_len_chk(lev, tca, name, sizeof(*rate))) return; rate = (struct tc_estimator *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_estimator(%d) ]", sizeof(*rate)); rec_dbg(lev, " interval(%d): %d", sizeof(rate->interval), rate->interval); rec_dbg(lev, " ewma_log(%d): %d", sizeof(rate->ewma_log), rate->ewma_log); } /* * debug attribute TCA_STATS2 */ void debug_tca_stats2(int lev, struct rtattr *tca, const char *name) { rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); debug_tca_stats2_attr(lev, tca); } /* * debug attributes TCA_STATS_* */ void debug_tca_stats2_attr(int lev, struct rtattr *tca) { struct rtattr *stats2[__TCA_STATS_MAX]; parse_nested_rtattr(stats2, TCA_STATS_MAX, tca); if(stats2[TCA_STATS_BASIC]) debug_tca_stats_basic(lev+1, stats2[TCA_STATS_BASIC], "TCA_STATS_BASIC"); if(stats2[TCA_STATS_RATE_EST]) debug_tca_stats_rate_est(lev+1, stats2[TCA_STATS_RATE_EST], "TCA_STATS_RATE_EST"); if(stats2[TCA_STATS_QUEUE]) debug_tca_stats_queue(lev+1, stats2[TCA_STATS_QUEUE], "TCA_STATS_QUEUE"); if(stats2[TCA_STATS_APP]) debug_tca_stats_app(lev, stats2[TCA_STATS_APP], "TCA_STATS_APP"); } /* * debug attribute TCA_STATS_BASIC */ void debug_tca_stats_basic(int lev, struct rtattr *stats2, const char *name) { struct gnet_stats_basic *basic; if(debug_rta_len_chk(lev, stats2, name, sizeof(*basic))) return; basic = (struct gnet_stats_basic *)RTA_DATA(stats2); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(stats2->rta_len)); rec_dbg(lev, " [ gnet_stats_basic(%d) ]", sizeof(*basic)); rec_dbg(lev, " bytes(%d): %lu", sizeof(basic->bytes), basic->bytes); rec_dbg(lev, " packets(%d): %u", sizeof(basic->packets), basic->packets); } /* * debug attribute TCA_STATS_RATE_EST */ void debug_tca_stats_rate_est(int lev, struct rtattr *stats2, const char *name) { struct gnet_stats_rate_est *rate; if(debug_rta_len_chk(lev, stats2, name, sizeof(*rate))) return; rate = (struct gnet_stats_rate_est *)RTA_DATA(stats2); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(stats2->rta_len)); rec_dbg(lev, " [ gnet_stats_rate_est(%d) ]", sizeof(*rate)); rec_dbg(lev, " bps(%d): %u", sizeof(rate->bps), rate->bps); rec_dbg(lev, " pps(%d): %u", sizeof(rate->pps), rate->pps); } /* * debug attribute TCA_STATS_QUEUE */ void debug_tca_stats_queue(int lev, struct rtattr *stats2, const char *name) { struct gnet_stats_queue *queue; if(debug_rta_len_chk(lev, stats2, name, sizeof(*queue))) return; queue = (struct gnet_stats_queue *)RTA_DATA(stats2); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(stats2->rta_len)); rec_dbg(lev, " [ gnet_stats_queue(%d) ]", sizeof(*queue)); rec_dbg(lev, " qlen(%d): %u", sizeof(queue->qlen), queue->qlen); rec_dbg(lev, " backlog(%d): %u", sizeof(queue->backlog), queue->backlog); rec_dbg(lev, " drops(%d): %u", sizeof(queue->drops), queue->drops); rec_dbg(lev, " requeue(%d): %u", sizeof(queue->requeues), queue->requeues); rec_dbg(lev, " overlimits(%d): %u", sizeof(queue->overlimits), queue->overlimits); } /* * debug attribute TCA_STATS_APP */ void debug_tca_stats_app(int lev, struct rtattr *stats2, const char *name) { struct gnet_estimator *est; if(debug_rta_len_chk(lev, stats2, name, sizeof(*est))) return; est = (struct gnet_estimator *)RTA_DATA(stats2); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(stats2->rta_len)); rec_dbg(lev, " [ gnet_estimator(%d) ]", sizeof(*est)); rec_dbg(lev, " interval(%d): %d", sizeof(est->interval), est->interval); rec_dbg(lev, " ewma_log(%d): %d", sizeof(est->ewma_log), est->ewma_log); } #if HAVE_DECL_TCA_STAB_UNSPEC /* * debug attribute TCA_STAB */ void debug_tca_stab(int lev, struct rtattr *tca, const char *name) { struct rtattr *stab[__TCA_STAB_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(stab, TCA_STAB_MAX, tca); if(stab[TCA_STAB_BASE]) debug_tca_stab_base(lev+1, stab[TCA_STAB_BASE], "TCA_STAB_BASE"); if(stab[TCA_STAB_DATA]) debug_rta_ignore(lev+1, stab[TCA_STAB_DATA], "TCA_STAB_DATA"); } /* * debug attribute TCA_STAB_BASE */ void debug_tca_stab_base(int lev, struct rtattr *stab, const char *name) { struct tc_sizespec *base; if(debug_rta_len_chk(lev, stab, name, sizeof(*base))) return; base = (struct tc_sizespec *)RTA_DATA(stab); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(stab->rta_len)); rec_dbg(lev, " [ tc_sizespec(%d) ]", sizeof(*base)); rec_dbg(lev, " cell_log(%d): %d", sizeof(base->cell_log), base->cell_log); rec_dbg(lev, " size_log(%d): %d", sizeof(base->size_log), base->size_log); rec_dbg(lev, " cell_align(%d): %hd", sizeof(base->cell_align), base->cell_align); rec_dbg(lev, " overhead(%d): %d", sizeof(base->overhead), base->overhead); rec_dbg(lev, " linklayer(%d): %u", sizeof(base->linklayer), base->linklayer); rec_dbg(lev, " mpu(%d): %u", sizeof(base->mpu), base->mpu); rec_dbg(lev, " mtu(%d): %u", sizeof(base->mtu), base->mtu); rec_dbg(lev, " tsize(%d): %u", sizeof(base->tsize), base->tsize); } #endif /* * debug struct tc_ratespec */ void debug_tc_ratespec(int lev, struct tc_ratespec *rate, char *name) { rec_dbg(lev, "[ tc_ratespec %s(%d) ]", name, sizeof(*rate)); rec_dbg(lev, " cell_log(%d): %d", sizeof(rate->cell_log), rate->cell_log); #ifdef HAVE_STRUCT_TC_RATESPEC___RESERVED rec_dbg(lev, " __reserved(%d): %d", sizeof(rate->__reserved), rate->__reserved); #endif #ifdef HAVE_STRUCT_TC_RATESPEC_LINKLAYER rec_dbg(lev, " linklayer(%d): %d", sizeof(rate->linklayer), rate->linklayer); #endif #ifdef HAVE_STRUCT_TC_RATESPEC_FEATURE rec_dbg(lev, " feature(%d): %hu", sizeof(rate->feature), rate->feature); #endif #ifdef HAVE_STRUCT_TC_RATESPEC_OVERHEAD rec_dbg(lev, " overhead(%d): %hu", sizeof(rate->overhead), rate->overhead); #endif #ifdef HAVE_STRUCT_TC_RATESPEC_ADDEND rec_dbg(lev, " addend(%d): %hd", sizeof(rate->addend), rate->addend); #endif #ifdef HAVE_STRUCT_TC_RATESPEC_CELL_ALIGN rec_dbg(lev, " cell_align(%d): %hd", sizeof(rate->cell_align), rate->cell_align); #endif rec_dbg(lev, " mpu(%d): %hu", sizeof(rate->mpu), rate->mpu); rec_dbg(lev, " rate(%d): %u", sizeof(rate->rate), rate->rate); } nield-0.6.2/src/tcmsg_qdisc_cbq.c000066400000000000000000000304241470100110300166600ustar00rootroot00000000000000/* * tcmsg_qdisc_cbq.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_CBQ_UNSPEC static double us2tick = 1; /* * parse cbq options */ int parse_tca_options_cbq(char *msg, char **mp, struct rtattr *tca) { struct rtattr *cbq[__TCA_CBQ_MAX]; struct tc_ratespec *rspec = NULL; struct tc_cbq_lssopt *lss = NULL; struct tc_cbq_wrropt *wrr = NULL; struct tc_cbq_fopt *fopt = NULL; struct tc_cbq_ovl *ovl = NULL; parse_nested_rtattr(cbq, TCA_CBQ_MAX, tca); if(cbq[TCA_CBQ_LSSOPT]) { if(RTA_PAYLOAD(cbq[TCA_CBQ_LSSOPT]) < sizeof(*lss)) { rec_log("error: %s: TCA_CBQ_LSSOPT: payload too short", __func__); return(1); } lss = (struct tc_cbq_lssopt *)RTA_DATA(cbq[TCA_CBQ_LSSOPT]); } if(cbq[TCA_CBQ_WRROPT]) { if(RTA_PAYLOAD(cbq[TCA_CBQ_WRROPT]) < sizeof(*wrr)) { rec_log("error: %s: TCA_CBQ_WRROPT: payload too short", __func__); return(1); } wrr = (struct tc_cbq_wrropt *)RTA_DATA(cbq[TCA_CBQ_WRROPT]); } if(cbq[TCA_CBQ_FOPT]) { if(RTA_PAYLOAD(cbq[TCA_CBQ_FOPT]) < sizeof(*fopt)) { rec_log("error: %s: TCA_CBQ_FOPT: payload too short", __func__); return(1); } fopt = (struct tc_cbq_fopt *)RTA_DATA(cbq[TCA_CBQ_FOPT]); } if(cbq[TCA_CBQ_OVL_STRATEGY]) { if(RTA_PAYLOAD(cbq[TCA_CBQ_OVL_STRATEGY]) < sizeof(*ovl)) { rec_log("error: %s: TCA_CBQ_OVL_STRATEGY: payload too short", __func__); return(1); } ovl = (struct tc_cbq_ovl *)RTA_DATA(cbq[TCA_CBQ_OVL_STRATEGY]); } if(cbq[TCA_CBQ_RATE]) { if(RTA_PAYLOAD(cbq[TCA_CBQ_RATE]) < sizeof(*rspec)) { rec_log("error: %s: TCA_CBQ_RATE: payload too short", __func__); return(1); } rspec = (struct tc_ratespec *)RTA_DATA(cbq[TCA_CBQ_RATE]); } if(rspec) { char rate[MAX_STR_SIZE]; conv_unit_rate(rate, sizeof(rate), rspec->rate); *mp = add_log(msg, *mp, "rate=%s ", rate); } if(lss) { char maxidle[MAX_STR_SIZE]; char minidle[MAX_STR_SIZE]; get_us2tick(); conv_unit_usec(maxidle, sizeof(maxidle), (lss->maxidle >> lss->ewma_log) / us2tick); *mp = add_log(msg, *mp, "maxidle=%s ", maxidle); if(lss->minidle != 0x7fffffff) { conv_unit_usec(minidle, sizeof(minidle), (lss->minidle >> lss->ewma_log) / us2tick); *mp = add_log(msg, *mp, "minidle=%s ", minidle); } *mp = add_log(msg, *mp, "level=%u avpkt=%u(byte) ", lss->level, lss->avpkt); } if(wrr) { if(wrr->priority != TC_CBQ_MAXPRIO) *mp = add_log(msg, *mp, "prio=%u ", wrr->priority); else *mp = add_log(msg, *mp, "prio=%u(no-transmit) ", wrr->priority); } return(0); } /* * debug cbq options */ void debug_tca_options_cbq(int lev, struct rtattr *tca, const char *name) { struct rtattr *cbq[__TCA_CBQ_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(cbq, TCA_CBQ_MAX, tca); if(cbq[TCA_CBQ_LSSOPT]) debug_tca_cbq_lssopt(lev+1, cbq[TCA_CBQ_LSSOPT], "TCA_CBQ_LSSOPT"); if(cbq[TCA_CBQ_WRROPT]) debug_tca_cbq_wrropt(lev+1, cbq[TCA_CBQ_WRROPT], "TCA_CBQ_WRROPT"); if(cbq[TCA_CBQ_FOPT]) debug_tca_cbq_fopt(lev+1, cbq[TCA_CBQ_FOPT], "TCA_CBQ_FOPT"); if(cbq[TCA_CBQ_OVL_STRATEGY]) debug_tca_cbq_ovl_strategy(lev+1, cbq[TCA_CBQ_OVL_STRATEGY], "TCA_CBQ_OVL_STRATEGY"); if(cbq[TCA_CBQ_RATE]) debug_tca_cbq_rate(lev+1, cbq[TCA_CBQ_RATE], "TCA_CBQ_RATE"); if(cbq[TCA_CBQ_RTAB]) debug_rta_ignore(lev+1, cbq[TCA_CBQ_RTAB], "TCA_CBQ_RTAB"); if(cbq[TCA_CBQ_POLICE]) debug_tca_cbq_police(lev+1, cbq[TCA_CBQ_POLICE], "TCA_CBQ_POLICE"); } /* * debug attribute TCA_CBQ_LSSOPT */ void debug_tca_cbq_lssopt(int lev, struct rtattr *cbq, const char *name) { struct tc_cbq_lssopt *lss; char flags_list[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, cbq, name, sizeof(*lss))) return; lss = (struct tc_cbq_lssopt *)RTA_DATA(cbq); conv_tcf_cbq_lss_flags(lss->flags, flags_list, sizeof(flags_list)); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(cbq->rta_len)); rec_dbg(lev, " [ tc_cbq_lssopt(%d) ]", sizeof(*lss)); rec_dbg(lev, " change(%d): %d", sizeof(lss->change), lss->change); rec_dbg(lev, " flags(%d): %d(%s)", sizeof(lss->flags), lss->flags, flags_list); rec_dbg(lev, " ewma_log(%d): %d", sizeof(lss->ewma_log), lss->ewma_log); rec_dbg(lev, " level(%d): %d", sizeof(lss->level), lss->level); rec_dbg(lev, " maxidle(%d): %u", sizeof(lss->maxidle), lss->maxidle); rec_dbg(lev, " minidle(%d): %u", sizeof(lss->minidle), lss->minidle); rec_dbg(lev, " offtime(%d): %u", sizeof(lss->offtime), lss->offtime); rec_dbg(lev, " avpkt(%d): %u", sizeof(lss->avpkt), lss->avpkt); } /* * debug attribute TCA_CBQ_WRROPT */ void debug_tca_cbq_wrropt(int lev, struct rtattr *cbq, const char *name) { struct tc_cbq_wrropt *wrr; if(debug_rta_len_chk(lev, cbq, name, sizeof(*wrr))) return; wrr = (struct tc_cbq_wrropt *)RTA_DATA(cbq); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(cbq->rta_len)); rec_dbg(lev, " [ tc_cbq_wrropt(%d) ]", sizeof(*wrr)); rec_dbg(lev, " flags(%d): %d", sizeof(wrr->flags), wrr->flags); rec_dbg(lev, " priority(%d): %d", sizeof(wrr->priority), wrr->priority); rec_dbg(lev, " cpriority(%d): %d", sizeof(wrr->cpriority), wrr->cpriority); rec_dbg(lev, " __reserved(%d): %d", sizeof(wrr->__reserved), wrr->__reserved); rec_dbg(lev, " allot(%d): %u", sizeof(wrr->allot), wrr->allot); rec_dbg(lev, " weight(%d): %u", sizeof(wrr->weight), wrr->weight); } /* * debug attribute TCA_CBQ_FOPT */ void debug_tca_cbq_fopt(int lev, struct rtattr *cbq, const char *name) { struct tc_cbq_fopt *fopt; char split[MAX_STR_SIZE]; if(debug_rta_len_chk(lev, cbq, name, sizeof(*fopt))) return; fopt = (struct tc_cbq_fopt *)RTA_DATA(cbq); parse_tc_handle(split, sizeof(split), fopt->split); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(cbq->rta_len)); rec_dbg(lev, " [ tc_cbq_fopt(%d) ]", sizeof(*fopt)); rec_dbg(lev, " split(%d): %x:%x(%s)", sizeof(fopt->split), TC_H_MAJ(fopt->split)>>16, TC_H_MIN(fopt->split), split); rec_dbg(lev, " defmap(%d): 0x%x", sizeof(fopt->defmap), fopt->defmap); rec_dbg(lev, " defchange(%d): 0x%x", sizeof(fopt->defchange), fopt->defchange); } /* * debug attribute TCA_CBQ_OVL_STRATEGY */ void debug_tca_cbq_ovl_strategy(int lev, struct rtattr *cbq, const char *name) { struct tc_cbq_ovl *ovl; char strategy_list[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, cbq, name, sizeof(*ovl))) return; ovl = (struct tc_cbq_ovl *)RTA_DATA(cbq); conv_tc_cbq_ovl_strategy(ovl->strategy, strategy_list, sizeof(strategy_list)); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(cbq->rta_len)); rec_dbg(lev, " [ tc_cbq_ovl(%d) ]", sizeof(*ovl)); rec_dbg(lev, " strategy(%d): %d(%s)", sizeof(ovl->strategy), ovl->strategy, strategy_list); rec_dbg(lev, " priority2(%d): %d", sizeof(ovl->priority2), ovl->priority2); rec_dbg(lev, " pad(%d): %d", sizeof(ovl->pad), ovl->pad); rec_dbg(lev, " penalty(%d): %u", sizeof(ovl->penalty), ovl->penalty); } /* * debug attribute TCA_CBQ_RATE */ void debug_tca_cbq_rate(int lev, struct rtattr *cbq, const char *name) { struct tc_ratespec *spec; if(debug_rta_len_chk(lev, cbq, name, sizeof(*spec))) return; spec = (struct tc_ratespec *)RTA_DATA(cbq); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(cbq->rta_len)); debug_tc_ratespec(lev+1, spec, ""); } /* * debug attribute TCA_CBQ_POLICE */ void debug_tca_cbq_police(int lev, struct rtattr *cbq, const char *name) { struct tc_cbq_police *qopt; if(debug_rta_len_chk(lev, cbq, name, sizeof(*qopt))) return; qopt = (struct tc_cbq_police *)RTA_DATA(cbq); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(cbq->rta_len)); rec_dbg(lev, " [ tc_cbq_police(%d) ]", sizeof(*qopt)); rec_dbg(lev, " police(%d): %d", sizeof(qopt->police), qopt->police); rec_dbg(lev, " __res1(%d): %d", sizeof(qopt->__res1), qopt->__res1); rec_dbg(lev, " __res2(%d): %d", sizeof(qopt->__res2), qopt->__res2); } /* * debug tc_cbq_xstats */ void debug_tc_cbq_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_cbq_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_cbq_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_cbq_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " borrows(%d): %u", sizeof(xstats->borrows), xstats->borrows); rec_dbg(lev, " overactions(%d): %u", sizeof(xstats->overactions), xstats->overactions); rec_dbg(lev, " avgidle(%d): %d", sizeof(xstats->avgidle), xstats->avgidle); rec_dbg(lev, " undertime(%d): %d", sizeof(xstats->undertime), xstats->undertime); } /* * convert TCF_CBQ_LSS change from number to string */ void conv_tcf_cbq_lss_change(int change, char *change_list, int len) { if(!change) { strncpy(change_list, "NONE", len); return; } #define _TCF_CBQ_LSS_LEVEL(s) \ if((change & TCF_CBQ_LSS_##s) && (len - strlen(change_list) - 1 > 0)) \ (change &= ~TCF_CBQ_LSS_##s) ? \ strncat(change_list, #s ",", len - strlen(change_list) -1) : \ strncat(change_list, #s, len - strlen(change_list) - 1); _TCF_CBQ_LSS_LEVEL(FLAGS); _TCF_CBQ_LSS_LEVEL(EWMA); _TCF_CBQ_LSS_LEVEL(MAXIDLE); _TCF_CBQ_LSS_LEVEL(MINIDLE); _TCF_CBQ_LSS_LEVEL(OFFTIME); _TCF_CBQ_LSS_LEVEL(AVPKT); #undef _TCF_CBQ_LSS_LEVEL if(!strlen(change_list)) strncpy(change_list, "UNKNOWN", len); } /* * convert TCF_CBQ_LSS flags from number to string */ void conv_tcf_cbq_lss_flags(int flags, char *flags_list, int len) { if(!flags) { strncpy(flags_list, "NONE", len); return; } #define _TCF_CBQ_LSS_FLAGS(s) \ if((flags & TCF_CBQ_LSS_##s) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~TCF_CBQ_LSS_##s) ? \ strncat(flags_list, #s ",", len - strlen(flags_list) - 1) : \ strncat(flags_list, #s, len - strlen(flags_list) - 1); _TCF_CBQ_LSS_FLAGS(BOUNDED); _TCF_CBQ_LSS_FLAGS(ISOLATED); #undef _TCF_CBQ_LSS_FLAGS if(!strlen(flags_list)) strncpy(flags_list, "UNKNOWN", len); } /* * convert TCF_CBQ_OVL strategy from number to string */ void conv_tc_cbq_ovl_strategy(int strategy, char *strategy_list, int len) { if(!strategy) { strncpy(strategy_list, "NONE", len); return; } #define _TC_CBQ_OVL_STRATEGY(s) \ if((strategy & TC_CBQ_OVL_##s) && (len - strlen(strategy_list) - 1 > 0)) \ (strategy &= ~TC_CBQ_OVL_##s) ? \ strncat(strategy_list, #s ",", len - strlen(strategy_list) - 1) : \ strncat(strategy_list, #s, len - strlen(strategy_list) - 1); _TC_CBQ_OVL_STRATEGY(CLASSIC); _TC_CBQ_OVL_STRATEGY(DELAY); _TC_CBQ_OVL_STRATEGY(LOWPRIO); _TC_CBQ_OVL_STRATEGY(DROP); _TC_CBQ_OVL_STRATEGY(RCLASSIC); #undef _TC_CBQ_OVL_STRATEGY if(!strlen(strategy_list)) strncpy(strategy_list, "UNKNOWN", len); } #endif nield-0.6.2/src/tcmsg_qdisc_choke.c000066400000000000000000000112411470100110300172000ustar00rootroot00000000000000/* * tcmsg_qdisc_choke.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_CHOKE_UNSPEC /* * parse choke options */ int parse_tca_options_choke(char *msg, char **mp, struct rtattr *tca) { struct rtattr *choke[__TCA_CHOKE_MAX]; parse_nested_rtattr(choke, TCA_CHOKE_MAX, tca); if(choke[TCA_CHOKE_PARMS]) { struct tc_choke_qopt *qopt; char list[MAX_STR_SIZE] = ""; if(RTA_PAYLOAD(choke[TCA_CHOKE_PARMS]) < sizeof(*qopt)) { rec_log("error: %s: TCA_CHOKE_PARMS: payload too short", __func__); return(1); } qopt = (struct tc_choke_qopt *)RTA_DATA(choke[TCA_CHOKE_PARMS]); *mp = add_log(msg, *mp, "limit=%u(packet) min=%u(packet) max=%u(packet) ", qopt->limit, qopt->qth_min, qopt->qth_max); if(qopt->flags) { conv_tc_red_flags(qopt->flags, list, sizeof(list), 0); *mp = add_log(msg, *mp, "flag=%s ", list); } } #if HAVE_DECL_TCA_CHOKE_MAX_P if(choke[TCA_CHOKE_MAX_P]) { if(RTA_PAYLOAD(choke[TCA_CHOKE_MAX_P]) < sizeof(unsigned)) { rec_log("error: %s: TCA_CHOKE_MAX_P: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "probability=%g(%%) ", *(unsigned *)RTA_DATA(choke[TCA_CHOKE_MAX_P]) / pow(2, 32) * 100); } #endif return(0); } /* * debug choke options */ void debug_tca_options_choke(int lev, struct rtattr *tca, const char *name) { struct rtattr *choke[__TCA_CHOKE_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(choke, TCA_CHOKE_MAX, tca); if(choke[TCA_CHOKE_PARMS]) debug_tca_choke_parms(lev+1, choke[TCA_CHOKE_PARMS], "TCA_CHOKE_PARMS"); if(choke[TCA_CHOKE_STAB]) debug_rta_ignore(lev+1, choke[TCA_CHOKE_STAB], "TCA_CHOKE_STAB"); #if HAVE_DECL_TCA_GRED_MAX_P if(choke[TCA_CHOKE_MAX_P]) debug_rta_u32(lev+1, choke[TCA_CHOKE_MAX_P], "TCA_CHOKE_MAX_P", NULL); #endif } /* * debug attribute TCA_CHOKE_PARMS */ void debug_tca_choke_parms(int lev, struct rtattr *choke, const char *name) { struct tc_choke_qopt *qopt; char list[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, choke, name, sizeof(*qopt))) return; qopt = (struct tc_choke_qopt *)RTA_DATA(choke); conv_tc_red_flags(qopt->flags, list, sizeof(list), 1); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(choke->rta_len)); rec_dbg(lev, " [ tc_choke_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " limit(%d): %d", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " qth_min(%d): %u", sizeof(qopt->qth_min), qopt->qth_min); rec_dbg(lev, " qth_max(%d): %u", sizeof(qopt->qth_max), qopt->qth_max); rec_dbg(lev, " Wlog(%d): %d", sizeof(qopt->Wlog), qopt->Wlog); rec_dbg(lev, " Plog(%d): %d", sizeof(qopt->Plog), qopt->Plog); rec_dbg(lev, " Scell_log(%d): %d", sizeof(qopt->Scell_log), qopt->Scell_log); rec_dbg(lev, " flags(%d): %d(%s)", sizeof(qopt->flags), qopt->flags, list); } /* * debug tc_choke_xstats */ void debug_tc_choke_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_choke_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_choke_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_choke_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " early(%d): %u", sizeof(xstats->early), xstats->early); rec_dbg(lev, " pdrop(%d): %u", sizeof(xstats->pdrop), xstats->pdrop); rec_dbg(lev, " other(%d): %u", sizeof(xstats->other), xstats->other); rec_dbg(lev, " marked(%d): %u", sizeof(xstats->marked), xstats->marked); rec_dbg(lev, " matched(%d): %u", sizeof(xstats->matched), xstats->matched); } #endif nield-0.6.2/src/tcmsg_qdisc_codel.c000066400000000000000000000107711470100110300172040ustar00rootroot00000000000000/* * tcmsg_qdisc_codel.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_CODEL_UNSPEC /* * parse codel options */ int parse_tca_options_codel(char *msg, char **mp, struct rtattr *tca) { struct rtattr *codel[__TCA_CODEL_MAX]; parse_nested_rtattr(codel, TCA_CODEL_MAX, tca); if(codel[TCA_CODEL_LIMIT]) { if(RTA_PAYLOAD(codel[TCA_CODEL_LIMIT]) < sizeof(unsigned)) { rec_log("error: %s: TCA_CODEL_LIMIT: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "limit=%u(packet) ", *(unsigned *)RTA_DATA(codel[TCA_CODEL_LIMIT])); } if(codel[TCA_CODEL_TARGET]) { char target[MAX_STR_SIZE]; if(RTA_PAYLOAD(codel[TCA_CODEL_TARGET]) < sizeof(unsigned)) { rec_log("error: %s: TCA_CODEL_TARGET: payload too short", __func__); return(1); } conv_unit_usec(target, sizeof(target), (double)*(unsigned *)RTA_DATA(codel[TCA_CODEL_TARGET])); *mp = add_log(msg, *mp, "target=%s ", target); } if(codel[TCA_CODEL_INTERVAL]) { char interval[MAX_STR_SIZE]; if(RTA_PAYLOAD(codel[TCA_CODEL_INTERVAL]) < sizeof(unsigned)) { rec_log("error: %s: TCA_CODEL_INTERVAL: payload too short", __func__); return(1); } conv_unit_usec(interval, sizeof(interval), (double)*(unsigned *)RTA_DATA(codel[TCA_CODEL_INTERVAL])); *mp = add_log(msg, *mp, "interval=%s ", interval); } if(codel[TCA_CODEL_ECN]) { if(RTA_PAYLOAD(codel[TCA_CODEL_ECN]) < sizeof(unsigned)) { rec_log("error: %s: TCA_CODEL_ECN: payload too short", __func__); return(1); } if(*(unsigned *)RTA_DATA(codel[TCA_CODEL_ECN])) *mp = add_log(msg, *mp, "ecn=on "); } return(0); } /* * debug codel options */ void debug_tca_options_codel(int lev, struct rtattr *tca, const char *name) { struct rtattr *codel[__TCA_CODEL_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(codel, TCA_CODEL_MAX, tca); if(codel[TCA_CODEL_TARGET]) debug_rta_u32(lev+1, codel[TCA_CODEL_TARGET], "TCA_CODEL_TARGET", NULL); if(codel[TCA_CODEL_LIMIT]) debug_rta_u32(lev+1, codel[TCA_CODEL_LIMIT], "TCA_CODEL_LIMIT", NULL); if(codel[TCA_CODEL_INTERVAL]) debug_rta_u32(lev+1, codel[TCA_CODEL_INTERVAL], "TCA_CODEL_INTERVAL", NULL); if(codel[TCA_CODEL_ECN]) debug_rta_u32(lev+1, codel[TCA_CODEL_ECN], "TCA_CODEL_ECN", NULL); } /* * debug tc_codel_xstats */ void debug_tc_codel_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_codel_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_codel_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_codel_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " maxpacket(%d): %u", sizeof(xstats->maxpacket), xstats->maxpacket); rec_dbg(lev, " count(%d): %u", sizeof(xstats->count), xstats->count); rec_dbg(lev, " lastcount(%d): %u", sizeof(xstats->lastcount), xstats->lastcount); rec_dbg(lev, " ldelay(%d): %u", sizeof(xstats->ldelay), xstats->ldelay); rec_dbg(lev, " drop_next(%d): %d", sizeof(xstats->drop_next), xstats->drop_next); rec_dbg(lev, " drop_overlimit(%d): %u", sizeof(xstats->drop_overlimit), xstats->drop_overlimit); rec_dbg(lev, " ecn_mark(%d): %u", sizeof(xstats->ecn_mark), xstats->ecn_mark); rec_dbg(lev, " dropping(%d): %u", sizeof(xstats->dropping), xstats->dropping); } #endif nield-0.6.2/src/tcmsg_qdisc_drr.c000066400000000000000000000045521470100110300167050ustar00rootroot00000000000000/* * tcmsg_qdisc_drr.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_DRR_UNSPEC /* * parse drr options */ int parse_tca_options_drr(char *msg, char **mp, struct rtattr *tca) { struct rtattr *drr[__TCA_NETEM_MAX]; char quantum[MAX_STR_SIZE]; parse_nested_rtattr(drr, TCA_DRR_MAX, tca); if(drr[TCA_DRR_QUANTUM]) { if(RTA_PAYLOAD(drr[TCA_DRR_QUANTUM]) < sizeof(unsigned)) { rec_log("error: %s: TCA_DRR_QUANTUM: payload too short", __func__); return(1); } conv_unit_size(quantum, sizeof(quantum), (double)*(unsigned *)RTA_DATA(drr[TCA_DRR_QUANTUM])); *mp = add_log(msg, *mp, "quantum=%s ", quantum); } return(0); } /* * debug drr options */ void debug_tca_options_drr(int lev, struct rtattr *tca, const char *name) { struct rtattr *drr[__TCA_DRR_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(drr, TCA_DRR_MAX, tca); if(drr[TCA_DRR_QUANTUM]) debug_rta_u32(lev+1, drr[TCA_DRR_QUANTUM], "TCA_DRR_QUANTUM", NULL); } /* * debug tc_drr_xstats */ void debug_tc_drr_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_drr_stats *stats; if(debug_rta_len_chk(lev, tca, name, sizeof(*stats))) return; stats = (struct tc_drr_stats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_drr_stats(%d) ]", sizeof(*stats)); rec_dbg(lev, " deficit(%d): %u", sizeof(stats->deficit), stats->deficit); } #endif nield-0.6.2/src/tcmsg_qdisc_dsmark.c000066400000000000000000000071061470100110300173750ustar00rootroot00000000000000/* * tcmsg_qdisc_dsmark.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_DSMARK_UNSPEC /* * parse dsmark options */ int parse_tca_options_dsmark(char *msg, char **mp, struct rtattr *tca) { struct rtattr *dsmark[__TCA_DSMARK_MAX]; parse_nested_rtattr(dsmark, TCA_DSMARK_MAX, tca); if(dsmark[TCA_DSMARK_INDICES]) { if(RTA_PAYLOAD(dsmark[TCA_DSMARK_INDICES]) < sizeof(unsigned short)) { rec_log("error: %s: TCA_DSMARK_INDICES: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "indices=0x%04x ", *(unsigned short *)RTA_DATA(dsmark[TCA_DSMARK_INDICES])); } if(dsmark[TCA_DSMARK_DEFAULT_INDEX]) { if(RTA_PAYLOAD(dsmark[TCA_DSMARK_DEFAULT_INDEX]) < sizeof(unsigned short)) { rec_log("error: %s: TCA_DSMARK_DEFAULT_INDEX: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "default_index=0x%04x ", *(unsigned short *)RTA_DATA(dsmark[TCA_DSMARK_DEFAULT_INDEX])); } if(dsmark[TCA_DSMARK_SET_TC_INDEX]) *mp = add_log(msg, *mp, "set_tc_index=on "); if(dsmark[TCA_DSMARK_VALUE]) { if(RTA_PAYLOAD(dsmark[TCA_DSMARK_VALUE]) < sizeof(unsigned char)) { rec_log("error: %s: TCA_DSMARK_VALUE: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "value=0x%02x ", *(unsigned char *)RTA_DATA(dsmark[TCA_DSMARK_VALUE])); } if(dsmark[TCA_DSMARK_MASK]) { if(RTA_PAYLOAD(dsmark[TCA_DSMARK_MASK]) < sizeof(unsigned char)) { rec_log("error: %s: TCA_DSMARK_MASK: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "mask=0x%02x ", *(unsigned char *)RTA_DATA(dsmark[TCA_DSMARK_MASK])); } return(0); } /* * debug dsmark options */ void debug_tca_options_dsmark(int lev, struct rtattr *tca, const char *name) { struct rtattr *dsmark[__TCA_DSMARK_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(dsmark, TCA_DSMARK_MAX, tca); if(dsmark[TCA_DSMARK_INDICES]) debug_rta_u16x(lev+1, dsmark[TCA_DSMARK_INDICES], "TCA_DSMARK_INDICES", NULL); if(dsmark[TCA_DSMARK_DEFAULT_INDEX]) debug_rta_u16x(lev+1, dsmark[TCA_DSMARK_DEFAULT_INDEX], "TCA_DSMARK_DEFAULT_INDEX", NULL); if(dsmark[TCA_DSMARK_SET_TC_INDEX]) debug_rta_none(lev+1, dsmark[TCA_DSMARK_SET_TC_INDEX], "TCA_DSMARK_SET_TC_INDEX"); if(dsmark[TCA_DSMARK_MASK]) debug_rta_u8x(lev+1, dsmark[TCA_DSMARK_MASK], "TCA_DSMARK_MASK", NULL); if(dsmark[TCA_DSMARK_VALUE]) debug_rta_u8x(lev+1, dsmark[TCA_DSMARK_VALUE], "TCA_DSMARK_VALUE", NULL); } #endif nield-0.6.2/src/tcmsg_qdisc_fifo.c000066400000000000000000000043041470100110300170340ustar00rootroot00000000000000/* * tcmsg_qdisc_fifo.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse pfifo options */ int parse_tca_options_pfifo(char *msg, char **mp, struct rtattr *tca) { struct tc_fifo_qopt *qopt; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payload too short", __func__); return(1); } qopt = (struct tc_fifo_qopt *)RTA_DATA(tca); *mp = add_log(msg, *mp, "limit=%d(packet) ", qopt->limit); return(0); } /* * parse bfifo options */ int parse_tca_options_bfifo(char *msg, char **mp, struct rtattr *tca) { struct tc_fifo_qopt *qopt; char limit[MAX_STR_SIZE]; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payload too short", __func__); return(1); } qopt = (struct tc_fifo_qopt *)RTA_DATA(tca); conv_unit_size(limit, sizeof(limit), qopt->limit); *mp = add_log(msg, *mp, "limit=%s", limit); return(0); } /* * debug fifo options */ void debug_tca_options_fifo(int lev, struct rtattr *tca, const char *name) { struct tc_fifo_qopt *qopt; if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt))) return; qopt = (struct tc_fifo_qopt *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_fifo_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " limit(%d): %d", sizeof(qopt->limit), qopt->limit); } nield-0.6.2/src/tcmsg_qdisc_fq_codel.c000066400000000000000000000155711470100110300176750ustar00rootroot00000000000000/* * tcmsg_qdisc_fq_codel.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_FQ_CODEL_UNSPEC /* * parse fq_codel options */ int parse_tca_options_fq_codel(char *msg, char **mp, struct rtattr *tca) { struct rtattr *fq_codel[__TCA_FQ_CODEL_MAX]; parse_nested_rtattr(fq_codel, TCA_FQ_CODEL_MAX, tca); if(fq_codel[TCA_FQ_CODEL_LIMIT]) { if(RTA_PAYLOAD(fq_codel[TCA_FQ_CODEL_LIMIT]) < sizeof(unsigned)) { rec_log("error: %s: TCA_FQ_CODEL_LIMIT: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "limit=%u(packet) ", *(unsigned *)RTA_DATA(fq_codel[TCA_FQ_CODEL_LIMIT])); } if(fq_codel[TCA_FQ_CODEL_FLOWS]) { if(RTA_PAYLOAD(fq_codel[TCA_FQ_CODEL_FLOWS]) < sizeof(unsigned)) { rec_log("error: %s: TCA_FQ_CODEL_FLOWS: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "flows=%u ", *(unsigned *)RTA_DATA(fq_codel[TCA_FQ_CODEL_FLOWS])); } if(fq_codel[TCA_FQ_CODEL_QUANTUM]) { if(RTA_PAYLOAD(fq_codel[TCA_FQ_CODEL_QUANTUM]) < sizeof(unsigned)) { rec_log("error: %s: TCA_FQ_CODEL_QUANTUM: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "quantum=%u(byte) ", *(unsigned *)RTA_DATA(fq_codel[TCA_FQ_CODEL_QUANTUM])); } if(fq_codel[TCA_FQ_CODEL_TARGET]) { char target[MAX_STR_SIZE]; if(RTA_PAYLOAD(fq_codel[TCA_FQ_CODEL_TARGET]) < sizeof(unsigned)) { rec_log("error: %s: TCA_FQ_CODEL_TARGET: payload too short", __func__); return(1); } conv_unit_usec(target, sizeof(target), (double)*(unsigned *)RTA_DATA(fq_codel[TCA_FQ_CODEL_TARGET])); *mp = add_log(msg, *mp, "target=%s ", target); } if(fq_codel[TCA_FQ_CODEL_INTERVAL]) { char interval[MAX_STR_SIZE]; if(RTA_PAYLOAD(fq_codel[TCA_FQ_CODEL_INTERVAL]) < sizeof(unsigned)) { rec_log("error: %s: TCA_FQ_CODEL_INTERVAL: payload too short", __func__); return(1); } conv_unit_usec(interval, sizeof(interval), (double)*(unsigned *)RTA_DATA(fq_codel[TCA_FQ_CODEL_INTERVAL])); *mp = add_log(msg, *mp, "interval=%s ", interval); } if(fq_codel[TCA_FQ_CODEL_ECN]) { if(RTA_PAYLOAD(fq_codel[TCA_FQ_CODEL_ECN]) < sizeof(unsigned)) { rec_log("error: %s: TCA_FQ_CODEL_ECN: payload too short", __func__); return(1); } if(*(unsigned *)RTA_DATA(fq_codel[TCA_FQ_CODEL_ECN])) *mp = add_log(msg, *mp, "ecn=on "); } return(0); } /* * debug fq_codel options */ void debug_tca_options_fq_codel(int lev, struct rtattr *tca, const char *name) { struct rtattr *fq_codel[__TCA_FQ_CODEL_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(fq_codel, TCA_FQ_CODEL_MAX, tca); if(fq_codel[TCA_FQ_CODEL_TARGET]) debug_rta_u32(lev+1, fq_codel[TCA_FQ_CODEL_TARGET], "TCA_FQ_CODEL_TARGET", NULL); if(fq_codel[TCA_FQ_CODEL_LIMIT]) debug_rta_u32(lev+1, fq_codel[TCA_FQ_CODEL_LIMIT], "TCA_FQ_CODEL_LIMIT", NULL); if(fq_codel[TCA_FQ_CODEL_INTERVAL]) debug_rta_u32(lev+1, fq_codel[TCA_FQ_CODEL_INTERVAL], "TCA_FQ_CODEL_INTERVAL", NULL); if(fq_codel[TCA_FQ_CODEL_ECN]) debug_rta_u32(lev+1, fq_codel[TCA_FQ_CODEL_ECN], "TCA_FQ_CODEL_ECN", NULL); if(fq_codel[TCA_FQ_CODEL_FLOWS]) debug_rta_u32(lev+1, fq_codel[TCA_FQ_CODEL_FLOWS], "TCA_FQ_CODEL_FLOWS", NULL); if(fq_codel[TCA_FQ_CODEL_QUANTUM]) debug_rta_u32(lev+1, fq_codel[TCA_FQ_CODEL_QUANTUM], "TCA_FQ_CODEL_QUANTUM", NULL); } /* * debug tc_fq_codel_xstats */ void debug_tc_fq_codel_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_fq_codel_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_fq_codel_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_fq_codel_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " type(%d): %u", sizeof(xstats->type), xstats->type); if(xstats->type == TCA_FQ_CODEL_XSTATS_QDISC) { struct tc_fq_codel_qd_stats *qd_stats = &(xstats->qdisc_stats); rec_dbg(lev, " [ tc_fq_codel_qd_stats qdisc_stats(%d) ]", sizeof(*qd_stats)); rec_dbg(lev, " maxpacket(%d): %u", sizeof(qd_stats->maxpacket), qd_stats->maxpacket); rec_dbg(lev, " drop_overlimit(%d): %u", sizeof(qd_stats->drop_overlimit), qd_stats->drop_overlimit); rec_dbg(lev, " ecn_mark(%d): %u", sizeof(qd_stats->ecn_mark), qd_stats->ecn_mark); rec_dbg(lev, " new_flow_count(%d): %u", sizeof(qd_stats->new_flow_count), qd_stats->new_flow_count); rec_dbg(lev, " new_flows_len(%d): %u", sizeof(qd_stats->new_flows_len), qd_stats->new_flows_len); rec_dbg(lev, " old_flows_len(%d): %u", sizeof(qd_stats->old_flows_len), qd_stats->old_flows_len); } else if(xstats->type == TCA_FQ_CODEL_XSTATS_QDISC) { struct tc_fq_codel_cl_stats *cl_stats = &(xstats->class_stats); rec_dbg(lev, " [ tc_fq_codel_cl_stats class_stats(%d) ]", sizeof(*cl_stats)); rec_dbg(lev, " deficit(%d): %d", sizeof(cl_stats->deficit), cl_stats->deficit); rec_dbg(lev, " ldelay(%d): %u", sizeof(cl_stats->ldelay), cl_stats->ldelay); rec_dbg(lev, " count(%d): %u", sizeof(cl_stats->count), cl_stats->count); rec_dbg(lev, " lastcount(%d): %u", sizeof(cl_stats->lastcount), cl_stats->lastcount); rec_dbg(lev, " dropping(%d): %u", sizeof(cl_stats->dropping), cl_stats->dropping); rec_dbg(lev, " drop_next(%d): %d", sizeof(cl_stats->drop_next), cl_stats->drop_next); } } #endif nield-0.6.2/src/tcmsg_qdisc_gred.c000066400000000000000000000153141470100110300170350ustar00rootroot00000000000000/* * tcmsg_qdisc_gred.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse gred options */ int parse_tca_options_gred(char *msg, char **mp, struct rtattr *tca) { struct rtattr *gred[__TCA_GRED_MAX]; struct tc_gred_sopt *sopt = NULL; struct tc_gred_qopt *qopt = NULL; unsigned *max_p = NULL; int i, flag = 0; char *mp_tmp = *mp; char limit[MAX_STR_SIZE] = ""; char min[MAX_STR_SIZE] = ""; char max[MAX_STR_SIZE] = ""; parse_nested_rtattr(gred, TCA_GRED_MAX, tca); if(gred[TCA_GRED_PARMS]) { if(RTA_PAYLOAD(gred[TCA_GRED_PARMS]) < sizeof(*qopt)) { rec_log("error: %s: TCA_GRED_PARMS: payload too short", __func__); return(1); } qopt = (struct tc_gred_qopt *)RTA_DATA(gred[TCA_GRED_PARMS]); } if(gred[TCA_GRED_DPS]) { if(RTA_PAYLOAD(gred[TCA_GRED_DPS]) < sizeof(*sopt)) { rec_log("error: %s: TCA_GRED_DPS: payload too short", __func__); return(1); } sopt = (struct tc_gred_sopt *)RTA_DATA(gred[TCA_GRED_DPS]); } if(!sopt || !qopt) { rec_log("%s", msg); return(0); } #if HAVE_DECL_TCA_GRED_MAX_P if(gred[TCA_GRED_MAX_P]) { if(RTA_PAYLOAD(gred[TCA_GRED_MAX_P]) < sizeof(*max_p)) { rec_log("error: %s: TCA_GRED_MAX_P: payload too short", __func__); return(1); } max_p = (unsigned *)RTA_DATA(gred[TCA_GRED_MAX_P]); } #endif for(i = 0; i < sopt->DPs; i++, qopt++) { if(qopt->DP >= sopt->DPs) continue; conv_unit_size(limit, sizeof(limit), qopt->limit); conv_unit_size(min, sizeof(min), qopt->qth_min); conv_unit_size(max, sizeof(max), qopt->qth_max); *mp = add_log(msg, *mp, "DP=%u limit=%s min=%s max=%s prio=%d ", qopt->DP, limit, min, max, qopt->prio); if(max_p) *mp = add_log(msg, *mp, "probability=%g(%%) ", max_p[i] / pow(2, 32) * 100); rec_log("%s", msg); *mp = mp_tmp; flag = 1; } if(!flag || strstr(msg, "qdisc deleted")) { *mp = add_log(msg, *mp, "DPs=%u default-DP=%u ", sopt->DPs, sopt->def_DP); rec_log("%s", msg); } return(0); } /* * debug gred options */ void debug_tca_options_gred(int lev, struct rtattr *tca, const char *name) { struct rtattr *gred[__TCA_GRED_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(gred, TCA_GRED_MAX, tca); if(gred[TCA_GRED_PARMS]) debug_tca_gred_parms(lev+1, gred[TCA_GRED_PARMS], "TCA_GRED_PARMS"); if(gred[TCA_GRED_STAB]) debug_rta_ignore(lev+1, gred[TCA_GRED_STAB], "TCA_GRED_STAB"); if(gred[TCA_GRED_DPS]) debug_tca_gred_dps(lev+1, gred[TCA_GRED_DPS], "TCA_GRED_DPS"); #if HAVE_DECL_TCA_GRED_MAX_P if(gred[TCA_GRED_MAX_P]) debug_tca_gred_max_p(lev+1, gred[TCA_GRED_MAX_P], "TCA_GRED_MAX_P"); #endif } /* * debug attribute TCA_GRED_PARMS */ void debug_tca_gred_parms(int lev, struct rtattr *gred, const char *name) { struct tc_gred_qopt *qopt; int i; if(debug_rta_len_chk(lev, gred, name, sizeof(*qopt) * MAX_DPs)) return; qopt = (struct tc_gred_qopt *)RTA_DATA(gred); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(gred->rta_len)); for(i = 0; i < MAX_DPs; i++, qopt++) { rec_dbg(lev, " [ tc_gred_qopt(%hu) ]", sizeof(*qopt)); rec_dbg(lev, " limit(%d): %u", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " qth_min(%d): %u", sizeof(qopt->qth_min), qopt->qth_min); rec_dbg(lev, " qth_max(%d): %u", sizeof(qopt->qth_max), qopt->qth_max); rec_dbg(lev, " DP(%d): %u", sizeof(qopt->DP), qopt->DP); rec_dbg(lev, " backlog(%d): %u", sizeof(qopt->backlog), qopt->backlog); rec_dbg(lev, " qave(%d): %u", sizeof(qopt->qave), qopt->qave); rec_dbg(lev, " forced(%d): %u", sizeof(qopt->forced), qopt->forced); rec_dbg(lev, " early(%d): %u", sizeof(qopt->early), qopt->early); rec_dbg(lev, " other(%d): %u", sizeof(qopt->other), qopt->other); rec_dbg(lev, " pdrop(%d): %u", sizeof(qopt->pdrop), qopt->pdrop); rec_dbg(lev, " Wlog(%d): %d", sizeof(qopt->Wlog), qopt->Wlog); rec_dbg(lev, " Plog(%d): %d", sizeof(qopt->Plog), qopt->Plog); rec_dbg(lev, " Scell_log(%d): %d", sizeof(qopt->Scell_log), qopt->Scell_log); rec_dbg(lev, " prio(%d): %d", sizeof(qopt->prio), qopt->prio); rec_dbg(lev, " packets(%d): %u", sizeof(qopt->packets), qopt->packets); rec_dbg(lev, " bytesin(%d): %u", sizeof(qopt->bytesin), qopt->bytesin); } } /* * debug attribute TCA_GRED_DPS */ void debug_tca_gred_dps(int lev, struct rtattr *gred, const char *name) { struct tc_gred_sopt *sopt; if(debug_rta_len_chk(lev, gred, name, sizeof(*sopt))) return; sopt = (struct tc_gred_sopt *)RTA_DATA(gred); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(gred->rta_len)); rec_dbg(lev, " [ tc_gred_sopt(%d) ]", sizeof(*sopt)); rec_dbg(lev, " DPs(%hu): %u", sizeof(sopt->DPs), sopt->DPs); rec_dbg(lev, " def_DP(%hu): %u", sizeof(sopt->def_DP), sopt->def_DP); rec_dbg(lev, " grio(%hu): %d", sizeof(sopt->grio), sopt->grio); rec_dbg(lev, " flags(%hu): %d", sizeof(sopt->flags), sopt->flags); rec_dbg(lev, " pad1(%hu): %d", sizeof(sopt->pad1), sopt->pad1); } #if HAVE_DECL_TCA_GRED_MAX_P /* * debug attribute TCA_GRED_MAX_P */ void debug_tca_gred_max_p(int lev, struct rtattr *gred, const char *name) { unsigned *max_p = (unsigned *)RTA_DATA(gred); int i; if(debug_rta_len_chk(lev, gred, name, sizeof(__u32) * MAX_DPs)) return; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(gred->rta_len)); for(i = 0; i < MAX_DPs; i++) rec_dbg(lev+1, "%d(%hu): %u", i, sizeof(max_p[i]), max_p[i]); } #endif nield-0.6.2/src/tcmsg_qdisc_hfsc.c000066400000000000000000000107531470100110300170410ustar00rootroot00000000000000/* * tcmsg_qdisc_hfsc.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse hfsc options * * rt : realtime service curve * ls : linkshare service curve * sc : rt+ls service curve * ul : upperlimit service curve * */ int parse_tca_options_hfsc(char *msg, char **mp, struct rtattr *tca) { struct rtattr *hfsc[__TCA_HFSC_MAX]; struct tc_hfsc_qopt *qopt; struct tc_service_curve *rsc = NULL, *fsc = NULL, *usc = NULL; if(RTA_PAYLOAD(tca) == sizeof(*qopt)) { qopt = (struct tc_hfsc_qopt *)RTA_DATA(tca); *mp = add_log(msg, *mp, "default-class=0x%x ", qopt->defcls); return(0); } parse_nested_rtattr(hfsc, TCA_HFSC_MAX, tca); if(hfsc[TCA_HFSC_RSC]) { if(RTA_PAYLOAD(hfsc[TCA_HFSC_RSC]) < sizeof(*rsc)) { rec_log("error: %s: TCA_HFSC_RSC: payload too short", __func__); return(1); } rsc = (struct tc_service_curve *)RTA_DATA(hfsc[TCA_HFSC_RSC]); } if(hfsc[TCA_HFSC_FSC]) { if(RTA_PAYLOAD(hfsc[TCA_HFSC_FSC]) < sizeof(*fsc)) { rec_log("error: %s: TCA_HFSC_FSC: payload too short", __func__); return(1); } fsc = (struct tc_service_curve *)RTA_DATA(hfsc[TCA_HFSC_FSC]); } if(hfsc[TCA_HFSC_USC]) { if(RTA_PAYLOAD(hfsc[TCA_HFSC_USC]) < sizeof(*usc)) { rec_log("error: %s: TCA_HFSC_USC: payload too short", __func__); return(1); } usc = (struct tc_service_curve *)RTA_DATA(hfsc[TCA_HFSC_USC]); } if(rsc && fsc && memcmp(rsc, fsc, sizeof(*rsc)) == 0) print_hfsc_sc(msg, mp, "realtime+linkshare", rsc); else { if(rsc) print_hfsc_sc(msg, mp, "realtime", rsc); if(fsc) print_hfsc_sc(msg, mp, "linkshare", fsc); } if(usc) print_hfsc_sc(msg, mp, "upperlimit", usc); return(0); } /* * parse hfsc survice curve */ int print_hfsc_sc(char *msg, char **mp, char *name, struct tc_service_curve *sc) { char m1[MAX_STR_SIZE], m2[MAX_STR_SIZE], d[MAX_STR_SIZE]; conv_unit_rate(m1, sizeof(m1), sc->m1); conv_unit_rate(m2, sizeof(m2), sc->m2); conv_unit_usec(d, sizeof(d), sc->d); *mp = add_log(msg, *mp, "%s(m1/d/m2)=%s/%s/%s ", name, m1, d, m2); return(0); } /* * debug hfsc options */ void debug_tca_options_hfsc(int lev, struct rtattr *tca, const char *name) { struct tc_hfsc_qopt *qopt; struct rtattr *hfsc[__TCA_HFSC_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); if(RTA_PAYLOAD(tca) == sizeof(*qopt)) { qopt = (struct tc_hfsc_qopt *)RTA_DATA(tca); rec_dbg(lev, " [ tc_hfsc_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " defcls(%d): 0x%x", sizeof(qopt->defcls), qopt->defcls); return; } parse_nested_rtattr(hfsc, TCA_HFSC_MAX, tca); if(hfsc[TCA_HFSC_RSC]) debug_tca_hfsc_sc(lev+1, hfsc[TCA_HFSC_RSC], "TCA_HFSC_RSC"); if(hfsc[TCA_HFSC_FSC]) debug_tca_hfsc_sc(lev+1, hfsc[TCA_HFSC_FSC], "TCA_HFSC_FSC"); if(hfsc[TCA_HFSC_USC]) debug_tca_hfsc_sc(lev+1, hfsc[TCA_HFSC_USC], "TCA_HFSC_USC"); } /* * debug attribute TCA_HFSC_*SC */ void debug_tca_hfsc_sc(int lev, struct rtattr *hfsc, const char *name) { struct tc_service_curve *sc; if(debug_rta_len_chk(lev, hfsc, name, sizeof(*sc))) return; sc = (struct tc_service_curve *)RTA_DATA(hfsc); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(hfsc->rta_len)); rec_dbg(lev, " [ tc_service_curve(%d) ]", sizeof(*sc)); rec_dbg(lev, " m1(%d): %u", sizeof(sc->m1), sc->m1); rec_dbg(lev, " d(%d): %u", sizeof(sc->d), sc->d); rec_dbg(lev, " m2(%d): %u", sizeof(sc->m2), sc->m2); } nield-0.6.2/src/tcmsg_qdisc_htb.c000066400000000000000000000132261470100110300166710ustar00rootroot00000000000000/* * tcmsg_qdisc_htb.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse htb options */ int parse_tca_options_htb(char *msg, char **mp, struct rtattr *tca) { struct rtattr *htb[__TCA_HTB_MAX]; parse_nested_rtattr(htb, TCA_HTB_MAX, tca); if(htb[TCA_HTB_INIT]) { struct tc_htb_glob *glob; if(RTA_PAYLOAD(htb[TCA_HTB_INIT]) < sizeof(*glob)) { rec_log("error: %s: TCA_HTB_INIT: payload too short", __func__); return(1); } glob = (struct tc_htb_glob *)RTA_DATA(htb[TCA_HTB_INIT]); *mp = add_log(msg, *mp, "rate2quantum=%u ", glob->rate2quantum); *mp = add_log(msg, *mp, "default-class=0x%x ", glob->defcls); } if(htb[TCA_HTB_PARMS]) { struct tc_htb_opt *opt; char rate[MAX_STR_SIZE]; char ceil[MAX_STR_SIZE]; char burst[MAX_STR_SIZE]; char cburst[MAX_STR_SIZE]; if(RTA_PAYLOAD(htb[TCA_HTB_PARMS]) < sizeof(*opt)) { rec_log("error: %s: TCA_HTB_PARMS: payload too short", __func__); return(1); } opt = (struct tc_htb_opt *)RTA_DATA(htb[TCA_HTB_PARMS]); get_us2tick(); conv_unit_rate(rate, sizeof(rate), opt->rate.rate); conv_unit_size(burst, sizeof(burst), get_burst_size(opt->rate.rate, opt->buffer)); conv_unit_rate(ceil, sizeof(ceil), opt->ceil.rate); conv_unit_size(cburst, sizeof(cburst), get_burst_size(opt->ceil.rate, opt->cbuffer)); *mp = add_log(msg, *mp, "rate=%s burst=%s ceil=%s cburst=%s level=%u prio=%u ", rate, burst, ceil, cburst, opt->level, opt->prio); } return(0); } /* * debug htb options */ void debug_tca_options_htb(int lev, struct rtattr *tca, const char *name) { struct rtattr *htb[__TCA_HTB_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(htb, TCA_HTB_MAX, tca); if(htb[TCA_HTB_PARMS]) debug_tca_htb_parms(lev+1, htb[TCA_HTB_PARMS], "TCA_HTB_PARMS"); if(htb[TCA_HTB_INIT]) debug_tca_htb_init(lev+1, htb[TCA_HTB_INIT], "TCA_HTB_INIT"); if(htb[TCA_HTB_CTAB]) debug_rta_ignore(lev+1, htb[TCA_HTB_CTAB], "TCA_HTB_CTAB"); if(htb[TCA_HTB_RTAB]) debug_rta_ignore(lev+1, htb[TCA_HTB_RTAB], "TCA_HTB_RTAB"); } /* * debug attribute TCA_HTB_PARMS */ void debug_tca_htb_parms(int lev, struct rtattr *htb, const char *name) { struct tc_htb_opt *opt; struct tc_ratespec *rate, *ceil; if(debug_rta_len_chk(lev, htb, name, sizeof(*opt))) return; opt = (struct tc_htb_opt *)RTA_DATA(htb); rate = &(opt->rate); ceil = &(opt->ceil); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(htb->rta_len)); rec_dbg(lev, " [ tc_htb_opt(%d) ]", sizeof(*opt)); debug_tc_ratespec(lev+2, rate, "rate"); debug_tc_ratespec(lev+2, ceil, "ceil"); rec_dbg(lev, " buffer(%d): %u", sizeof(opt->buffer), opt->buffer); rec_dbg(lev, " cbuffer(%d): %u", sizeof(opt->cbuffer), opt->cbuffer); rec_dbg(lev, " quantum(%d): %u", sizeof(opt->quantum), opt->quantum); rec_dbg(lev, " level(%d): %u", sizeof(opt->level), opt->level); rec_dbg(lev, " prio(%d): %u", sizeof(opt->prio), opt->prio); } /* * debug attribute TCA_HTB_INIT */ void debug_tca_htb_init(int lev, struct rtattr *htb, const char *name) { struct tc_htb_glob *glob; if(debug_rta_len_chk(lev, htb, name, sizeof(*glob))) return; glob = (struct tc_htb_glob *)RTA_DATA(htb); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(htb->rta_len)); rec_dbg(lev, " [ tc_htb_glob(%d) ]", sizeof(*glob)); rec_dbg(lev, " version(%d): %u", sizeof(glob->version), glob->version); rec_dbg(lev, " rate2quantum(%d): %u", sizeof(glob->rate2quantum), glob->rate2quantum); rec_dbg(lev, " defcls(%d): 0x%x", sizeof(glob->defcls), glob->defcls); rec_dbg(lev, " debug(%d): %u", sizeof(glob->debug), glob->debug); rec_dbg(lev, " direct_pkts(%d): %u", sizeof(glob->direct_pkts), glob->direct_pkts); } /* * debug tc_htb_xstats */ void debug_tc_htb_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_htb_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_htb_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_htb_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " lends(%d): %u", sizeof(xstats->lends), xstats->lends); rec_dbg(lev, " borrows(%d): %u", sizeof(xstats->borrows), xstats->borrows); rec_dbg(lev, " giants(%d): %u", sizeof(xstats->giants), xstats->giants); rec_dbg(lev, " tokens(%d): %u", sizeof(xstats->tokens), xstats->tokens); rec_dbg(lev, " ctokens(%d): %u", sizeof(xstats->ctokens), xstats->ctokens); } nield-0.6.2/src/tcmsg_qdisc_multiq.c000066400000000000000000000036171470100110300174320ustar00rootroot00000000000000/* * tcmsg_qdisc_multiq.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #ifdef HAVE_STRUCT_TC_MULTIQ_QOPT_BANDS /* * parse multiq options */ int parse_tca_options_multiq(char *msg, char **mp, struct rtattr *tca) { struct tc_multiq_qopt *qopt; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payload too short", __func__); return(1); } qopt = (struct tc_multiq_qopt *)RTA_DATA(tca); *mp = add_log(msg, *mp, "bands=%d max=%d ", qopt->bands, qopt->max_bands); return(0); } /* * debug multiq options */ void debug_tca_options_multiq(int lev, struct rtattr *tca, const char *name) { struct tc_multiq_qopt *qopt; if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt))) return; qopt = (struct tc_multiq_qopt *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_multiq_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " bands(%d): %d", sizeof(qopt->bands), qopt->bands); rec_dbg(lev, " max_bands(%d): %d", sizeof(qopt->max_bands), qopt->max_bands); } #endif nield-0.6.2/src/tcmsg_qdisc_netem.c000066400000000000000000000340361470100110300172260ustar00rootroot00000000000000/* * tcmsg_qdisc_netem.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" static double us2tick = 1; /* * parse netem options */ int parse_tca_options_netem(char *msg, char **mp, struct rtattr *tca) { struct rtattr *netem[__TCA_NETEM_MAX]; struct tc_netem_qopt *qopt; struct tc_netem_corr *corr = NULL; struct tc_netem_reorder *reorder = NULL; struct tc_netem_corrupt *corrupt = NULL; const double max_percent_value = 0xffffffff; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payload too short", __func__); return(1); } qopt = (struct tc_netem_qopt *)RTA_DATA(tca); parse_rtattr(netem, TCA_NETEM_MAX, RTA_DATA(tca) + sizeof(struct tc_netem_qopt), RTA_PAYLOAD(tca) - sizeof(struct tc_netem_qopt)); if(netem[TCA_NETEM_CORR]) { if(RTA_PAYLOAD(netem[TCA_NETEM_CORR]) < sizeof(*corr)) { rec_log("error: %s: TCA_NETEM_CORR: payload too short", __func__); return(1); } corr = (struct tc_netem_corr *)RTA_DATA(netem[TCA_NETEM_CORR]); } if(netem[TCA_NETEM_REORDER]) { if(RTA_PAYLOAD(netem[TCA_NETEM_REORDER]) < sizeof(*reorder)) { rec_log("error: %s: TCA_NETEM_REORDER: payload too short", __func__); return(1); } reorder = (struct tc_netem_reorder *)RTA_DATA(netem[TCA_NETEM_REORDER]); } if(netem[TCA_NETEM_CORRUPT]) { if(RTA_PAYLOAD(netem[TCA_NETEM_REORDER]) < sizeof(*corrupt)) { rec_log("error: %s: TCA_NETEM_REORDER: payload too short", __func__); return(1); } corrupt = (struct tc_netem_corrupt *)RTA_DATA(netem[TCA_NETEM_CORRUPT]); } #if HAVE_DECL_TCA_NETEM_LOSS struct rtattr *loss[__NETEM_LOSS_MAX]; struct tc_netem_gimodel *gimodel = NULL; struct tc_netem_gemodel *gemodel = NULL; if(netem[TCA_NETEM_LOSS]) { parse_nested_rtattr(loss, NETEM_LOSS_MAX, netem[TCA_NETEM_LOSS]); if(loss[NETEM_LOSS_GI]) { if(RTA_PAYLOAD(loss[NETEM_LOSS_GI]) < sizeof(*gimodel)) { rec_log("error: %s: NETEM_LOSS_GI: payload too short", __func__); return(1); } gimodel = (struct tc_netem_gimodel *)RTA_DATA(loss[NETEM_LOSS_GI]); } if(loss[NETEM_LOSS_GE]) { if(RTA_PAYLOAD(loss[NETEM_LOSS_GE]) < sizeof(*gemodel)) { rec_log("error: %s: NETEM_LOSS_GE: payload too short", __func__); return(1); } gemodel = (struct tc_netem_gemodel *)RTA_DATA(loss[NETEM_LOSS_GE]); } } #endif #if HAVE_DECL_TCA_NETEM_RATE struct tc_netem_rate *rate = NULL; if(netem[TCA_NETEM_RATE]) { if(RTA_PAYLOAD(netem[TCA_NETEM_RATE]) < sizeof(*rate)) { rec_log("error: %s: TCA_NETEM_RATE: payload too short", __func__); return(1); } rate = (struct tc_netem_rate *)RTA_DATA(netem[TCA_NETEM_RATE]); } #endif if(qopt->limit) *mp = add_log(msg, *mp, "limit=%u(packet) ", qopt->limit); if(qopt->latency) { char latency[MAX_STR_SIZE]; get_us2tick(); conv_unit_usec(latency, sizeof(latency), qopt->latency / us2tick); *mp = add_log(msg, *mp, "delay=%s ", latency); if(corr && corr->delay_corr) *mp = add_log(msg, *mp, "delay-correlation=%g(%%) ", (double)corr->delay_corr / max_percent_value * 100.); } if(qopt->jitter) { char jitter[MAX_STR_SIZE]; get_us2tick(); conv_unit_usec(jitter, sizeof(jitter), qopt->jitter / us2tick); *mp = add_log(msg, *mp, "jitter=%s ", jitter); } if(qopt->loss) { *mp = add_log(msg, *mp, "loss=%g(%%) ", (double)qopt->loss / max_percent_value * 100.); if(corr && corr->loss_corr) *mp = add_log(msg, *mp, "loss-correlation=%g(%%) ", (double)corr->loss_corr / max_percent_value * 100.); } #if HAVE_DECL_TCA_NETEM_LOSS if(gimodel) *mp = add_log(msg, *mp, "loss-state(p13/p31/p32/p23/p14)=" "%g(%%)/%g(%%)/%g(%%)/%g(%%)/%g(%%) ", (double)gimodel->p13 / max_percent_value * 100., (double)gimodel->p31 / max_percent_value * 100., (double)gimodel->p32 / max_percent_value * 100., (double)gimodel->p23 / max_percent_value * 100., (double)gimodel->p14 / max_percent_value * 100.); if(gemodel) *mp = add_log(msg, *mp, "loss-gemodel(p/r/1-h/1-k)=" "%g(%%)/%g(%%)/%g(%%)/%g(%%) ", (double)gemodel->p / max_percent_value * 100., (double)gemodel->r / max_percent_value * 100., (double)gemodel->h / max_percent_value * 100., (double)gemodel->k1 / max_percent_value * 100.); #endif if(qopt->duplicate) { *mp = add_log(msg, *mp, "duplicate=%g(%%) ", (double)qopt->duplicate / max_percent_value * 100.); if(corr && corr->dup_corr) *mp = add_log(msg, *mp, "duplicate-correlation=%g(%%) ", (double)corr->dup_corr / max_percent_value * 100.); } if(reorder && reorder->probability) { *mp = add_log(msg, *mp, "reorder=%g(%%) ", (double)reorder->probability / max_percent_value * 100.); if(reorder->correlation) *mp = add_log(msg, *mp, "reorder-correlation=%g(%%) ", (double)reorder->correlation / max_percent_value * 100.); } if(corrupt && corrupt->probability) { *mp = add_log(msg, *mp, "corrupt=%g(%%) ", (double)corrupt->probability / max_percent_value * 100.); if(corrupt->correlation) *mp = add_log(msg, *mp, "corrupt-correlation=%g(%%) ", (double)corrupt->correlation / max_percent_value * 100.); } #if HAVE_DECL_TCA_NETEM_RATE if(rate && rate->rate) { char netem_rate[MAX_STR_SIZE]; conv_unit_rate(netem_rate, sizeof(netem_rate), rate->rate); *mp = add_log(msg, *mp, "rate=%s ", netem_rate); if(rate->packet_overhead) *mp = add_log(msg, *mp, "packet-overhead=%u(byte) ", rate->packet_overhead); if(rate->cell_size) *mp = add_log(msg, *mp, "cell-size=%u(byte) ", rate->cell_size); if(rate->cell_overhead) *mp = add_log(msg, *mp, "cell-overhead=%u(byte) ", rate->cell_overhead); } #endif if(qopt->gap) *mp = add_log(msg, *mp, "gap=%u(packet) ", qopt->gap); #if HAVE_DECL_TCA_NETEM_ECN if(netem[TCA_NETEM_ECN] && *(unsigned *)RTA_DATA(netem[TCA_NETEM_ECN])) *mp = add_log(msg, *mp, "ecn=on "); #endif return(0); } /* * debug netem options */ void debug_tca_options_netem(int lev, struct rtattr *tca, const char *name) { struct rtattr *netem[__TCA_NETEM_MAX]; struct tc_netem_qopt *qopt; if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt))) return; qopt = (struct tc_netem_qopt *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_netem_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " latency(%d): %u", sizeof(qopt->latency), qopt->latency); rec_dbg(lev, " limit(%d): %u", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " loss(%d): %u", sizeof(qopt->loss), qopt->loss); rec_dbg(lev, " gap(%d): %u", sizeof(qopt->gap), qopt->gap); rec_dbg(lev, " duplicate(%d): %u", sizeof(qopt->duplicate), qopt->duplicate); rec_dbg(lev, " jitter(%d): %u", sizeof(qopt->jitter), qopt->jitter); parse_rtattr(netem, TCA_NETEM_MAX, RTA_DATA(tca) + sizeof(struct tc_netem_qopt), RTA_PAYLOAD(tca) - sizeof(struct tc_netem_qopt)); if(netem[TCA_NETEM_CORR]) debug_tca_netem_corr(lev+1, netem[TCA_NETEM_CORR], "TCA_NETEM_CORR"); if(netem[TCA_NETEM_DELAY_DIST]) debug_rta_ignore(lev+1, netem[TCA_NETEM_DELAY_DIST], "TCA_NETEM_DELAY_DIST"); if(netem[TCA_NETEM_REORDER]) debug_tca_netem_reorder(lev+1, netem[TCA_NETEM_REORDER], "TCA_NETEM_REORDER"); if(netem[TCA_NETEM_CORRUPT]) debug_tca_netem_corrupt(lev+1, netem[TCA_NETEM_CORRUPT], "TCA_NETEM_CORRUPT"); #if HAVE_DECL_TCA_NETEM_LOSS if(netem[TCA_NETEM_LOSS]) debug_tca_netem_loss(lev+1, netem[TCA_NETEM_LOSS], "TCA_NETEM_LOSS"); #endif #if HAVE_DECL_TCA_NETEM_RATE if(netem[TCA_NETEM_RATE]) debug_tca_netem_rate(lev+1, netem[TCA_NETEM_RATE], "TCA_NETEM_RATE"); #endif #if HAVE_DECL_TCA_NETEM_ECN if(netem[TCA_NETEM_ECN]) debug_rta_u32(lev+1, netem[TCA_NETEM_ECN], "TCA_NETEM_ECN", NULL); #endif } /* * debug attribute TCA_NETEM_CORR */ void debug_tca_netem_corr(int lev, struct rtattr *netem, const char *name) { struct tc_netem_corr *corr; if(debug_rta_len_chk(lev, netem, name, sizeof(*corr))) return; corr = (struct tc_netem_corr *)RTA_DATA(netem); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(netem->rta_len)); rec_dbg(lev, " [ tc_netem_corr(%d) ]", sizeof(*corr)); rec_dbg(lev, " delay_corr(%d): %u", sizeof(corr->delay_corr), corr->delay_corr); rec_dbg(lev, " loss_corr(%d): %u", sizeof(corr->loss_corr), corr->loss_corr); rec_dbg(lev, " dup_corr(%d): %u", sizeof(corr->dup_corr), corr->dup_corr); } /* * debug attribute TCA_NETEM_REORDER */ void debug_tca_netem_reorder(int lev, struct rtattr *netem, const char *name) { struct tc_netem_reorder *reorder; if(debug_rta_len_chk(lev, netem, name, sizeof(*reorder))) return; reorder = (struct tc_netem_reorder *)RTA_DATA(netem); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(netem->rta_len)); rec_dbg(lev, " [ tc_netem_reorder(%d) ]", sizeof(*reorder)); rec_dbg(lev, " probability(%d): %u", sizeof(reorder->probability), reorder->probability); rec_dbg(lev, " correlation(%d): %u", sizeof(reorder->correlation), reorder->correlation); } /* * debug attribute TCA_NETEM_CORRUPT */ void debug_tca_netem_corrupt(int lev, struct rtattr *netem, const char *name) { struct tc_netem_corrupt *corrupt; if(debug_rta_len_chk(lev, netem, name, sizeof(*corrupt))) return; corrupt = (struct tc_netem_corrupt *)RTA_DATA(netem); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(netem->rta_len)); rec_dbg(lev, " [ tc_netem_corrupt(%d) ]", sizeof(*corrupt)); rec_dbg(lev, " probability(%d): %u", sizeof(corrupt->probability), corrupt->probability); rec_dbg(lev, " correlation(%d): %u", sizeof(corrupt->correlation), corrupt->correlation); } #if HAVE_DECL_TCA_NETEM_LOSS /* * debug attribute TCA_NETEM_LOSS */ void debug_tca_netem_loss(int lev, struct rtattr *netem, const char *name) { struct rtattr *loss[__NETEM_LOSS_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(netem->rta_len)); parse_nested_rtattr(loss, NETEM_LOSS_MAX, netem); if(loss[NETEM_LOSS_GI]) debug_netem_loss_gi(lev+1, loss[NETEM_LOSS_GI], "NETEM_LOSS_GI"); if(loss[NETEM_LOSS_GE]) debug_netem_loss_ge(lev+1, loss[NETEM_LOSS_GE], "NETEM_LOSS_GE"); } /* * debug attribute NETEM_LOSS_GI */ void debug_netem_loss_gi(int lev, struct rtattr *loss, const char *name) { struct tc_netem_gimodel *gi; if(debug_rta_len_chk(lev, loss, name, sizeof(*gi))) return; gi = (struct tc_netem_gimodel *)RTA_DATA(loss); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(loss->rta_len)); rec_dbg(lev, " [ tc_netem_gimodel(%d) ]", sizeof(*gi)); rec_dbg(lev, " p13(%d): %u", sizeof(gi->p13), gi->p13); rec_dbg(lev, " p31(%d): %u", sizeof(gi->p31), gi->p31); rec_dbg(lev, " p32(%d): %u", sizeof(gi->p32), gi->p32); rec_dbg(lev, " p14(%d): %u", sizeof(gi->p14), gi->p14); rec_dbg(lev, " p23(%d): %u", sizeof(gi->p23), gi->p23); } /* * debug attribute NETEM_LOSS_GE */ void debug_netem_loss_ge(int lev, struct rtattr *loss, const char *name) { struct tc_netem_gemodel *ge; if(debug_rta_len_chk(lev, loss, name, sizeof(*ge))) return; ge = (struct tc_netem_gemodel *)RTA_DATA(loss); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(loss->rta_len)); rec_dbg(lev, " [ tc_netem_gemodel(%d) ]", sizeof(*ge)); rec_dbg(lev, " p(%d): %u", sizeof(ge->p), ge->p); rec_dbg(lev, " r(%d): %u", sizeof(ge->r), ge->r); rec_dbg(lev, " h(%d): %u", sizeof(ge->h), ge->h); rec_dbg(lev, " k1(%d): %u", sizeof(ge->k1), ge->k1); } #endif #if HAVE_DECL_TCA_NETEM_RATE /* * debug attribute TCA_NETEM_RATE */ void debug_tca_netem_rate(int lev, struct rtattr *netem, const char *name) { struct tc_netem_rate *rate; if(debug_rta_len_chk(lev, netem, name, sizeof(*rate))) return; rate = (struct tc_netem_rate *)RTA_DATA(netem); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(netem->rta_len)); rec_dbg(lev, " [ tc_netem_rate(%d) ]", sizeof(*rate)); rec_dbg(lev, " rate(%d): %u", sizeof(rate->rate), rate->rate); rec_dbg(lev, " packet_overhead(%d): %u", sizeof(rate->packet_overhead), rate->packet_overhead); rec_dbg(lev, " cell_size(%d): %u", sizeof(rate->cell_size), rate->cell_size); rec_dbg(lev, " cell_overhead(%d): %u", sizeof(rate->cell_overhead), rate->cell_overhead); } #endif nield-0.6.2/src/tcmsg_qdisc_plug.c000066400000000000000000000050771470100110300170700ustar00rootroot00000000000000/* * tcmsg_qdisc_plug.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #ifdef HAVE_STRUCT_TC_PLUG_QOPT_ACTION /* * parse plug options */ int parse_tca_options_plug(char *msg, char **mp, struct rtattr *tca) { struct tc_plug_qopt *qopt; char action[MAX_STR_SIZE] = ""; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payload too short", __func__); return(1); } qopt = (struct tc_plug_qopt *)RTA_DATA(tca); if(qopt->action == TCQ_PLUG_BUFFER) strncpy(action, "buffer", sizeof(action)); else if(qopt->action == TCQ_PLUG_RELEASE_ONE) strncpy(action, "release_one", sizeof(action)); else if(qopt->action == TCQ_PLUG_RELEASE_INDEFINITE) strncpy(action, "release_indefinite", sizeof(action)); *mp = add_log(msg, *mp, "action=%s limit=%u ", action, qopt->limit); return(0); } /* * debug plug options */ void debug_tca_options_plug(int lev, struct rtattr *tca, const char *name) { struct tc_plug_qopt *qopt; if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt))) return; qopt = (struct tc_plug_qopt *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_plug_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " action(%d): %d(%s)", sizeof(qopt->action), qopt->action, conv_tcq_plug_action(qopt->action)); rec_dbg(lev, " limit(%d): %u", qopt->limit); } /* * convert TCQ_PLUG flags from number to string */ const char *conv_tcq_plug_action(int action) { #define _TCQ_PLUG_ACTION(s) \ if(action == TCQ_PLUG_##s) \ return(#s); _TCQ_PLUG_ACTION(BUFFER); _TCQ_PLUG_ACTION(RELEASE_ONE); _TCQ_PLUG_ACTION(RELEASE_INDEFINITE); #undef _TCQ_PLUG_ACTION return("UNKNOWN"); } #endif nield-0.6.2/src/tcmsg_qdisc_prio.c000066400000000000000000000047371470100110300170740ustar00rootroot00000000000000/* * tcmsg_qdisc_prio.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse prio options */ int parse_tca_options_prio(char *msg, char **mp, struct rtattr *tca) { struct tc_prio_qopt *qopt; int i; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payload too short", __func__); return(1); } qopt = (struct tc_prio_qopt *)RTA_DATA(tca); *mp = add_log(msg, *mp, "bands=%d priomap=", qopt->bands); for(i = 0; i < TC_PRIO_MAX + 1; i++) if(i == TC_PRIO_MAX) *mp = add_log(msg, *mp, "%d ", qopt->priomap[i]); else *mp = add_log(msg, *mp, "%d-", qopt->priomap[i]); return(0); } /* * debug prio options */ void debug_tca_options_prio(int lev, struct rtattr *tca, const char *name) { struct tc_prio_qopt *qopt; char prio[MAX_STR_SIZE] = ""; char *p = prio; int i, len = sizeof(prio); if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt))) return; qopt = (struct tc_prio_qopt *)RTA_DATA(tca); for(i = 0; i < TC_PRIO_MAX + 1; i++) { if(i == TC_PRIO_MAX) APPEND_SNPRINTF(rc, p, len, "%d ", qopt->priomap[i]); else APPEND_SNPRINTF(rc, p, len, "%d-", qopt->priomap[i]); } if (p - prio == sizeof(prio)) { rec_dbg(lev, "%s(%hu): -- priomap too long --", name, RTA_ALIGN(tca->rta_len)); return; } rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_prio_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " bands(%d): %d", sizeof(qopt->bands), qopt->bands); rec_dbg(lev, " priomap(%d): %s", sizeof(qopt->priomap), prio); } nield-0.6.2/src/tcmsg_qdisc_qfq.c000066400000000000000000000053601470100110300167030ustar00rootroot00000000000000/* * tcmsg_qdisc_qfq.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_QFQ_UNSPEC /* * parse qfq options */ int parse_tca_options_qfq(char *msg, char **mp, struct rtattr *tca) { struct rtattr *qfq[__TCA_QFQ_MAX]; parse_nested_rtattr(qfq, TCA_QFQ_MAX, tca); if(qfq[TCA_QFQ_WEIGHT]) { if(RTA_PAYLOAD(qfq[TCA_QFQ_WEIGHT]) < sizeof(unsigned)) { rec_log("error: %s: TCA_QFQ_WEIGHT: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "weight=%u ", *(unsigned *)RTA_DATA(qfq[TCA_QFQ_WEIGHT])); } if(qfq[TCA_QFQ_LMAX]) { if(RTA_PAYLOAD(qfq[TCA_QFQ_MAX]) < sizeof(unsigned)) { rec_log("error: %s: TCA_QFQ_WEIGHT: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "maxpkt=%u(byte) ", *(unsigned *)RTA_DATA(qfq[TCA_QFQ_LMAX])); } return(0); } /* * debug qfq options */ void debug_tca_options_qfq(int lev, struct rtattr *tca, const char *name) { struct rtattr *qfq[__TCA_QFQ_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(qfq, TCA_QFQ_MAX, tca); if(qfq[TCA_QFQ_WEIGHT]) debug_rta_u32(lev+1, qfq[TCA_QFQ_WEIGHT], "TCA_QFQ_WEIGHT", NULL); if(qfq[TCA_QFQ_LMAX]) debug_rta_u32(lev+1, qfq[TCA_QFQ_LMAX], "TCA_QFQ_LMAX", NULL); } /* * debug tc_qfq_xstats */ void debug_tc_qfq_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_qfq_stats *stats; if(debug_rta_len_chk(lev, tca, name, sizeof(*stats))) return; stats = (struct tc_qfq_stats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_qfq_stats(%d) ]", sizeof(*stats)); rec_dbg(lev, " weight(%d): %u", sizeof(stats->weight), stats->weight); rec_dbg(lev, " lmax(%d): %u", sizeof(stats->lmax), stats->lmax); } #endif nield-0.6.2/src/tcmsg_qdisc_red.c000066400000000000000000000127231470100110300166670ustar00rootroot00000000000000/* * tcmsg_qdisc_red.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse red options */ int parse_tca_options_red(char *msg, char **mp, struct rtattr *tca) { struct rtattr *red[__TCA_RED_MAX]; parse_nested_rtattr(red, TCA_RED_MAX, tca); if(red[TCA_RED_PARMS]) { struct tc_red_qopt *qopt; char limit[MAX_STR_SIZE] = ""; char min[MAX_STR_SIZE] = ""; char max[MAX_STR_SIZE] = ""; char list[MAX_STR_SIZE] = ""; if(RTA_PAYLOAD(red[TCA_RED_PARMS]) < sizeof(*qopt)) { rec_log("error: %s: TCA_RED_PARMS: payload too short", __func__); return(1); } qopt = (struct tc_red_qopt *)RTA_DATA(red[TCA_RED_PARMS]); conv_unit_size(limit, sizeof(limit), qopt->limit); conv_unit_size(min, sizeof(min), qopt->qth_min); conv_unit_size(max, sizeof(max), qopt->qth_max); *mp = add_log(msg, *mp, "limit=%s min=%s max=%s ", limit, min, max); if(qopt->flags) { conv_tc_red_flags(qopt->flags, list, sizeof(list), 0); *mp = add_log(msg, *mp, "flag=%s ", list); } } #if HAVE_DECL_TCA_RED_MAX_P if(red[TCA_RED_MAX_P]) { if(RTA_PAYLOAD(red[TCA_RED_MAX_P]) < sizeof(unsigned)) { rec_log("error: %s: TCA_RED_MAX_P: payload too short", __func__); return(1); } *mp = add_log(msg, *mp, "probability=%g(%%) ", *(unsigned *)RTA_DATA(red[TCA_RED_MAX_P]) / pow(2, 32) * 100); } #endif return(0); } /* * debug red options */ void debug_tca_options_red(int lev, struct rtattr *tca, const char *name) { struct rtattr *red[__TCA_RED_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(red, TCA_RED_MAX, tca); if(red[TCA_RED_PARMS]) debug_tca_red_parms(lev+1, red[TCA_RED_PARMS], "TCA_RED_PARMS"); if(red[TCA_RED_STAB]) debug_rta_ignore(lev+1, red[TCA_RED_STAB], "TCA_RED_STAB"); #if HAVE_DECL_TCA_RED_MAX_P if(red[TCA_RED_MAX_P]) debug_rta_u32(lev+1, red[TCA_RED_MAX_P], "TCA_RED_MAX_P", NULL); #endif } /* * debug attribute TCA_RED_PARMS */ void debug_tca_red_parms(int lev, struct rtattr *red, const char *name) { struct tc_red_qopt *qopt; char list[MAX_STR_SIZE] = ""; if(debug_rta_len_chk(lev, red, name, sizeof(*qopt))) return; qopt = (struct tc_red_qopt *)RTA_DATA(red); conv_tc_red_flags(qopt->flags, list, sizeof(list), 1); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(red->rta_len)); rec_dbg(lev, " [ tc_red_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " limit(%d): %d", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " qth_min(%d): %u", sizeof(qopt->qth_min), qopt->qth_min); rec_dbg(lev, " qth_max(%d): %u", sizeof(qopt->qth_max), qopt->qth_max); rec_dbg(lev, " Wlog(%d): %d", sizeof(qopt->Wlog), qopt->Wlog); rec_dbg(lev, " Plog(%d): %d", sizeof(qopt->Plog), qopt->Plog); rec_dbg(lev, " Scell_log(%d): %d", sizeof(qopt->Scell_log), qopt->Scell_log); rec_dbg(lev, " flags(%d): %d(%s)", sizeof(qopt->flags), qopt->flags, list); } /* * debug tc_red_xstats */ void debug_tc_red_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_red_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_red_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_red_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " early(%d): %u", sizeof(xstats->early), xstats->early); rec_dbg(lev, " pdrop(%d): %u", sizeof(xstats->pdrop), xstats->pdrop); rec_dbg(lev, " other(%d): %u", sizeof(xstats->other), xstats->other); rec_dbg(lev, " marked(%d): %u", sizeof(xstats->marked), xstats->marked); } /* * convert red flags from number to string */ void conv_tc_red_flags(int flags, char *flags_list, int len, unsigned char debug) { if(!flags) { strncpy(flags_list, debug ? "NONE" : "none", len); return; } #define _TC_RED_FLAGS(s1, s2) \ if((flags & TC_RED_##s1) && (len - strlen(flags_list) - 1 > 0)) \ (flags &= ~TC_RED_##s1) ? \ strncat(flags_list, debug ? #s1 "," : #s2 ",", \ len - strlen(flags_list) - 1) : \ strncat(flags_list, debug ? #s1 : #s2, \ len - strlen(flags_list) - 1); _TC_RED_FLAGS(ECN, ecn) _TC_RED_FLAGS(HARDDROP, harddrop) #ifdef TC_RED_ADAPTATIVE _TC_RED_FLAGS(ADAPTATIVE, adaptative) #endif #undef _TC_RED_FLAGS if(!strlen(flags_list)) strncpy(flags_list, debug ? "UNKNOWN" : "unknown", len); } nield-0.6.2/src/tcmsg_qdisc_sfb.c000066400000000000000000000115411470100110300166640ustar00rootroot00000000000000/* * tcmsg_qdisc_sfb.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" #if HAVE_DECL_TCA_SFB_UNSPEC /* * parse sfb options */ int parse_tca_options_sfb(char *msg, char **mp, struct rtattr *tca) { struct rtattr *sfb[__TCA_NETEM_MAX]; parse_nested_rtattr(sfb, TCA_SFB_MAX, tca); if(sfb[TCA_SFB_PARMS]) { struct tc_sfb_qopt *qopt; char rehash[MAX_STR_SIZE]; char warmup[MAX_STR_SIZE]; if(RTA_PAYLOAD(sfb[TCA_SFB_PARMS]) < sizeof(*qopt)) { rec_log("error: %s: TCA_SFB_PARMS: payload too short", __func__); return(1); } qopt = (struct tc_sfb_qopt *)RTA_DATA(sfb[TCA_SFB_PARMS]); conv_unit_usec(rehash, sizeof(rehash), qopt->rehash_interval * 1000); conv_unit_usec(warmup, sizeof(warmup), qopt->warmup_time * 1000); *mp = add_log(msg, *mp, "limit=%u(packet) max=%u(packet) " "target=%u(packet) increment=%.5f decrement=%.5f " "penalty-rate=%u(packet/s) penalty-burst=%u(packet) " "rehash=%s warmup=%s ", qopt->limit, qopt->max, qopt->bin_size, (double)qopt->increment / SFB_MAX_PROB, (double)qopt->decrement / SFB_MAX_PROB, qopt->penalty_rate, qopt->penalty_burst, rehash, warmup); } return(0); } /* * debug sfb options */ void debug_tca_options_sfb(int lev, struct rtattr *tca, const char *name) { struct rtattr *sfb[__TCA_SFB_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(sfb, TCA_SFB_MAX, tca); if(sfb[TCA_SFB_PARMS]) debug_tca_sfb_parms(lev+1, sfb[TCA_SFB_PARMS], "TCA_SFB_PARMS"); } /* * debug attribute TCA_SFB_PARMS */ void debug_tca_sfb_parms(int lev, struct rtattr *sfb, const char *name) { struct tc_sfb_qopt *qopt; if(debug_rta_len_chk(lev, sfb, name, sizeof(*qopt))) return; qopt = (struct tc_sfb_qopt *)RTA_DATA(sfb); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(sfb->rta_len)); rec_dbg(lev, " [ tc_stats(%d) ]", sizeof(*qopt)); rec_dbg(lev, " rehash_interval(%d): %u", sizeof(qopt->rehash_interval), qopt->rehash_interval); rec_dbg(lev, " warmup_time(%d): %u", sizeof(qopt->warmup_time), qopt->warmup_time); rec_dbg(lev, " max(%d): %u", sizeof(qopt->max), qopt->max); rec_dbg(lev, " bin_size(%d): %u", sizeof(qopt->bin_size), qopt->bin_size); rec_dbg(lev, " increment(%d): %u", sizeof(qopt->increment), qopt->increment); rec_dbg(lev, " decrement(%d): %u", sizeof(qopt->decrement), qopt->decrement); rec_dbg(lev, " limit(%d): %u", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " penalty_rate(%d): %u", sizeof(qopt->penalty_rate), qopt->penalty_rate); rec_dbg(lev, " penalty_burst(%d): %u", sizeof(qopt->penalty_burst), qopt->penalty_burst); } /* * debug tc_sfb_xstats */ void debug_tc_sfb_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_sfb_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_sfb_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_sfb_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " earlydrop(%d): %u", sizeof(xstats->earlydrop), xstats->earlydrop); rec_dbg(lev, " penaltydrop(%d): %u", sizeof(xstats->penaltydrop), xstats->penaltydrop); rec_dbg(lev, " bucketdrop(%d): %u", sizeof(xstats->bucketdrop), xstats->bucketdrop); rec_dbg(lev, " queuedrop(%d): %u", sizeof(xstats->queuedrop), xstats->queuedrop); rec_dbg(lev, " childdrop(%d): %u", sizeof(xstats->childdrop), xstats->childdrop); rec_dbg(lev, " marked(%d): %u", sizeof(xstats->marked), xstats->marked); rec_dbg(lev, " maxqlen(%d): %u", sizeof(xstats->maxqlen), xstats->maxqlen); rec_dbg(lev, " maxprob(%d): %u", sizeof(xstats->maxprob), xstats->maxprob); rec_dbg(lev, " avgprob(%d): %u", sizeof(xstats->avgprob), xstats->avgprob); } #endif nield-0.6.2/src/tcmsg_qdisc_sfq.c000066400000000000000000000144221470100110300167040ustar00rootroot00000000000000/* * tcmsg_qdisc_sfq.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse sfq options */ int parse_tca_options_sfq(char *msg, char **mp, struct rtattr *tca) { struct tc_sfq_qopt *qopt; if(RTA_PAYLOAD(tca) < sizeof(*qopt)) { rec_log("error: %s: TCA_OPTIONS: payaload too short", __func__); return(1); } qopt = (struct tc_sfq_qopt *)RTA_DATA(tca); *mp = add_log(msg, *mp, "quantum=%u(byte) perturb=%d(second) limit=%u(packet) divisor=%u flows=%u ", qopt->quantum, qopt->perturb_period, qopt->limit, qopt->divisor, qopt->flows); #ifdef HAVE_STRUCT_TC_SFQ_QOPT_V1_V0 struct tc_sfq_qopt_v1 *qopt_v1 = NULL; if(RTA_PAYLOAD(tca) >= sizeof(*qopt_v1)) qopt_v1 = (struct tc_sfq_qopt_v1 *)RTA_DATA(tca); if(qopt_v1) { char list[MAX_STR_SIZE] = ""; char min[MAX_STR_SIZE] = ""; char max[MAX_STR_SIZE] = ""; conv_unit_size(min, sizeof(min), qopt_v1->qth_min); conv_unit_size(max, sizeof(max), qopt_v1->qth_max); *mp = add_log(msg, *mp, "depth=%u(packet) headdrop=%s min=%s max=%s ", qopt_v1->depth, qopt_v1->headdrop ? "on" : "off", min, max); if(qopt_v1->flags) { conv_tc_red_flags(qopt_v1->flags, list, sizeof(list), 0); *mp = add_log(msg, *mp, "flag=%s ", list); } *mp = add_log(msg, *mp, "probability=%g(%%) ", qopt_v1->max_P / pow(2, 32) * 100); } #endif return(0); } /* * debug sfq options */ void debug_tca_options_sfq(int lev, struct rtattr *tca, const char *name) { struct tc_sfq_qopt *qopt; struct tc_sfqred_stats *stats = NULL; if(debug_rta_len_chk(lev, tca, name, sizeof(*qopt))) return; qopt = (struct tc_sfq_qopt *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); #ifdef HAVE_STRUCT_TC_SFQ_QOPT_V1_V0 struct tc_sfq_qopt_v1 *qopt_v1 = NULL; if(RTA_PAYLOAD(tca) >= sizeof(*qopt_v1)) { qopt_v1 = (struct tc_sfq_qopt_v1 *)RTA_DATA(tca); stats = &(qopt_v1->stats); } if(qopt_v1) { char list[MAX_STR_SIZE] = ""; conv_tc_red_flags(qopt_v1->flags, list, sizeof(list), 1); rec_dbg(lev, " [ tc_sfq_qopt_v1(%d) ]", sizeof(*qopt_v1)); rec_dbg(lev, " [ tc_sfq_qopt v0(%d) ]", sizeof(qopt_v1->v0)); rec_dbg(lev, " quantum(%d): %u", sizeof(qopt->quantum), qopt->quantum); rec_dbg(lev, " perturb_period(%d): %d", sizeof(qopt->perturb_period), qopt->perturb_period); rec_dbg(lev, " limit(%d): %u", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " divisor(%d): %u", sizeof(qopt->divisor), qopt->divisor); rec_dbg(lev, " flows(%d): %u", sizeof(qopt->flows), qopt->flows); rec_dbg(lev, " depth(%d): %u", sizeof(qopt_v1->depth), qopt_v1->depth); rec_dbg(lev, " headdrop(%d): %u", sizeof(qopt_v1->headdrop), qopt_v1->headdrop); rec_dbg(lev, " limit(%d): %u", sizeof(qopt_v1->limit), qopt_v1->limit); rec_dbg(lev, " qth_min(%d): %u", sizeof(qopt_v1->qth_min), qopt_v1->qth_min); rec_dbg(lev, " qth_max(%d): %u", sizeof(qopt_v1->qth_max), qopt_v1->qth_max); rec_dbg(lev, " Wlog(%d): %d", sizeof(qopt_v1->Wlog), qopt_v1->Wlog); rec_dbg(lev, " Plog(%d): %d", sizeof(qopt_v1->Plog), qopt_v1->Plog); rec_dbg(lev, " Scell_log(%d): %d", sizeof(qopt_v1->Scell_log), qopt_v1->Scell_log); rec_dbg(lev, " flags(%d): %d(%s)", sizeof(qopt_v1->flags), qopt_v1->flags, list); rec_dbg(lev, " max_P(%d): %u", sizeof(qopt_v1->max_P), qopt_v1->max_P); rec_dbg(lev, " [ tc_sfqred_stats stats(%d) ]", sizeof(qopt_v1->stats)); rec_dbg(lev, " prob_drop(%d): %u", sizeof(stats->prob_drop), stats->prob_drop); rec_dbg(lev, " forced_drop(%d): %u", sizeof(stats->forced_drop), stats->forced_drop); rec_dbg(lev, " prob_mark(%d): %u", sizeof(stats->prob_mark), stats->prob_mark); rec_dbg(lev, " forced_mark(%d): %u", sizeof(stats->forced_mark), stats->forced_mark); rec_dbg(lev, " prob_mark_head(%d): %u", sizeof(stats->prob_mark_head), stats->prob_mark_head); rec_dbg(lev, " forced_mark_head(%d): %u", sizeof(stats->forced_mark_head), stats->forced_mark_head); return; } #endif rec_dbg(lev, " [ tc_sfq_qopt(%d) ]", sizeof(*qopt)); rec_dbg(lev, " quantum(%d): %u", sizeof(qopt->quantum), qopt->quantum); rec_dbg(lev, " perturb_period(%d): %d", sizeof(qopt->perturb_period), qopt->perturb_period); rec_dbg(lev, " limit(%d): %u", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " divisor(%d): %u", sizeof(qopt->divisor), qopt->divisor); rec_dbg(lev, " flows(%d): %u", sizeof(qopt->flows), qopt->flows); } #ifdef HAVE_STRUCT_TC_SFQ_XSTATS_ALLOT /* * debug tc_sfq_xstats */ void debug_tc_sfq_xstats(int lev, struct rtattr *tca, const char *name) { struct tc_sfq_xstats *xstats; if(debug_rta_len_chk(lev, tca, name, sizeof(*xstats))) return; xstats = (struct tc_sfq_xstats *)RTA_DATA(tca); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); rec_dbg(lev, " [ tc_xstats(%d) ]", sizeof(*xstats)); rec_dbg(lev, " allot(%d): %d", sizeof(xstats->allot), xstats->allot); } #endif nield-0.6.2/src/tcmsg_qdisc_tbf.c000066400000000000000000000077361470100110300167000ustar00rootroot00000000000000/* * tcmsg_qdisc_tbf.c - traffic control qdisc message parser * Copyright (C) 2011-2024 Tetsumune KISO * * This program 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 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nield.h" #include "rtnetlink.h" /* * parse tbf options */ int parse_tca_options_tbf(char *msg, char **mp, struct rtattr *tca) { struct rtattr *tbf[__TCA_TBF_MAX]; parse_nested_rtattr(tbf, TCA_TBF_MAX, tca); if(tbf[TCA_TBF_PARMS]) { struct tc_tbf_qopt *qopt; char rate[MAX_STR_SIZE]; char burst[MAX_STR_SIZE]; char peakrate[MAX_STR_SIZE]; char mtu[MAX_STR_SIZE]; double rate_latency = 0; double peakrate_latency = 0; char latency[MAX_STR_SIZE]; if(RTA_PAYLOAD(tbf[TCA_TBF_PARMS]) < sizeof(*qopt)) { rec_log("error: %s: TCA_TBF_PARMS: payload too short", __func__); return(1); } qopt = (struct tc_tbf_qopt *)RTA_DATA(tbf[TCA_TBF_PARMS]); get_us2tick(); conv_unit_rate(rate, sizeof(rate), qopt->rate.rate); conv_unit_size(burst, sizeof(burst), get_burst_size(qopt->rate.rate, qopt->buffer)); rate_latency = get_latency(qopt->rate.rate, qopt->buffer, qopt->limit); *mp = add_log(msg, *mp, "rate=%s burst=%s ", rate, burst); if(qopt->peakrate.rate) { conv_unit_rate(peakrate, sizeof(peakrate), qopt->peakrate.rate); conv_unit_size(mtu, sizeof(mtu), get_burst_size(qopt->peakrate.rate, qopt->mtu)); peakrate_latency = get_latency(qopt->peakrate.rate, qopt->mtu, qopt->limit); *mp = add_log(msg, *mp, "peakrate=%s minburst=%s ", peakrate, mtu); } if(rate_latency < peakrate_latency) conv_unit_usec(latency, sizeof(latency), peakrate_latency); else conv_unit_usec(latency, sizeof(latency), rate_latency); *mp = add_log(msg, *mp, "latency=%s ", latency); } return(0); } /* * debug tbf options */ void debug_tca_options_tbf(int lev, struct rtattr *tca, const char *name) { struct rtattr *tbf[__TCA_TBF_MAX]; rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tca->rta_len)); parse_nested_rtattr(tbf, TCA_TBF_MAX, tca); if(tbf[TCA_TBF_PARMS]) debug_tca_tbf_parms(lev+1, tbf[TCA_TBF_PARMS], "TCA_TBF_PARMS"); if(tbf[TCA_TBF_RTAB]) debug_rta_ignore(lev+1, tbf[TCA_TBF_RTAB], "TCA_TBF_RTAB"); if(tbf[TCA_TBF_PTAB]) debug_rta_ignore(lev+1, tbf[TCA_TBF_PTAB], "TCA_TBF_PTAB"); } /* * debug attribute TCA_TBF_PARMS */ void debug_tca_tbf_parms(int lev, struct rtattr *tbf, const char *name) { struct tc_tbf_qopt *qopt; struct tc_ratespec *rate; struct tc_ratespec *peak; if(debug_rta_len_chk(lev, tbf, name, sizeof(*qopt))) return; qopt = (struct tc_tbf_qopt *)RTA_DATA(tbf); rate = &(qopt->rate); peak = &(qopt->peakrate); rec_dbg(lev, "%s(%hu):", name, RTA_ALIGN(tbf->rta_len)); rec_dbg(lev, " [ tc_tbf_qopt(%d) ]", sizeof(*qopt)); debug_tc_ratespec(lev+2, rate, "rate"); debug_tc_ratespec(lev+2, peak, "peakrate"); rec_dbg(lev, " limit(%d): %u", sizeof(qopt->limit), qopt->limit); rec_dbg(lev, " buffer(%d): %u", sizeof(qopt->buffer), qopt->buffer); rec_dbg(lev, " mtu(%d): %u", sizeof(qopt->mtu), qopt->mtu); }