├── .gitignore ├── AUTHORS ├── COPYING ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── compat ├── Makefile.am ├── dummy.c ├── fdatasync.c ├── fixups.h ├── inet6_rth_add.c └── ppoll.c ├── configure.ac ├── doc ├── .gitignore ├── Makefile.am ├── addr2name.1 ├── dnssort.1 ├── ndisc6.8 ├── rdisc6.8 ├── rdnssd.8-in ├── rltraceroute6.8 └── tcpspray.1 ├── ezirad ├── Makefile ├── NOTES ├── config.h ├── ezirad.c ├── ezirad.h └── sys_netlink.c ├── gen-alias ├── include └── .gitignore ├── m4 ├── .gitignore ├── Makefile.am ├── getopt.m4 ├── hostname.m4 └── sockaddr.m4 ├── po ├── .gitignore ├── LINGUAS ├── Makevars ├── POTFILES.in ├── cs.po ├── de.po ├── en.po ├── en_GB.po ├── fr.po ├── ndisc6.pot └── sv.po ├── rdnss ├── .gitignore ├── Makefile.am ├── icmp.c ├── merge-hook.in ├── netlink.c ├── rdnssd.c └── rdnssd.h └── src ├── .gitignore ├── Makefile.am ├── addrinfo.c ├── dnssort.in ├── gettime.h ├── ndisc.c ├── tcpspray.c ├── tcptraceroute.c ├── trace-icmp.c ├── trace-tcp.c ├── trace-udp.c ├── traceroute.c └── traceroute.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.cache 3 | *.o 4 | .deps 5 | ABOUT-NLS 6 | aclocal.m4 7 | admin 8 | config.h 9 | config.h.in 10 | config.log 11 | config.status 12 | configure 13 | INSTALL 14 | Makefile 15 | Makefile.in 16 | stamp-* 17 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Rémi Denis-Courmont 2 | Pierre Ynard 3 | Yin, Kwong-Sang 4 | Fred L. Templim 5 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - master Makefile for ndisc6 2 | 3 | # Copyright © 2006 Rémi Denis-Courmont 4 | # This file is distributed under the same license as the ndisc6 package. 5 | 6 | ACLOCAL_AMFLAGS = -I m4 7 | AUTOMAKE_OPTIONS = \ 8 | 1.11 \ 9 | check-news \ 10 | dist-bzip2 \ 11 | no-dist-gzip \ 12 | no-exeext \ 13 | std-options \ 14 | subdir-objects \ 15 | -Wall 16 | 17 | EXTRA_DIST = 18 | DISTCLEANFILES = stamp-git 19 | CLEANFILES = 20 | MOSTLYCLEANFILES = 21 | 22 | AM_CPPFLAGS = -I$(top_srcdir)/include \ 23 | -DLOCALEDIR=\"$(localedir)\" \ 24 | -DSYSCONFDIR=\"$(sysconfdir)\" \ 25 | -DLOCALSTATEDIR=\"$(localstatedir)\" 26 | AM_LIBADD = libcompat.a 27 | 28 | noinst_HEADERS = include/gettext.h 29 | 30 | sed_verbose = $(sed_verbose_$(V)) 31 | sed_verbose_ = $(sed_verbose_$(AM_DEFAULT_VERBOSITY)) 32 | sed_verbose_0 = @echo " SED $@"; 33 | 34 | subst_script = sed \ 35 | -e 's,[@]LOCALSTATEDIR[@],$(localstatedir),g' \ 36 | -e 's,[@]SYSCONFDIR[@],$(sysconfdir),g' \ 37 | -e 's,[@]PERL[@],$(PERL),g' \ 38 | -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ 39 | -e 's,[@]VERSION[@],$(VERSION),g' 40 | 41 | include m4/Makefile.am 42 | include doc/Makefile.am 43 | include compat/Makefile.am 44 | include src/Makefile.am 45 | include rdnss/Makefile.am 46 | 47 | SUBDIRS = po 48 | 49 | distclean-local: 50 | test "$(top_srcdir)" = "$(top_builddir)" || rm -f ChangeLog 51 | 52 | dist-hook: stamp-git 53 | 54 | stamp-git: 55 | @LANG=C ; \ 56 | rev=$$(cd "$(scrdir)" && git describe || echo exported) ; \ 57 | oldrev=$$(cat stamp-git 2>/dev/null || true) ; \ 58 | if test "$$rev" != "$$oldrev"; then \ 59 | echo "New revision is: $$rev" ; \ 60 | if test "$$rev" != "exported"; then \ 61 | echo -n "Rebuilding ChangeLog... " ; \ 62 | (cd "$(srcdir)" && git log) > ChangeLog || exit $$? ; \ 63 | echo "OK" ; \ 64 | fi ; \ 65 | fi 66 | echo "$$rev" > stamp-git 67 | 68 | ChangeLog: 69 | $(MAKE) $(AM_MAKEFLAGS) stamp-git 70 | touch $@ 71 | 72 | .PHONY: stamp-git 73 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | RELEASE NOTES for NDisc6 2 | version 1.0.4 3 | ========================= 4 | 5 | There are no known issues at the moment. 6 | Please report any problem by email at address : 7 | remi (at) remlab (dot) net 8 | Thanks for your help. 9 | 10 | You can find major changes since version 0.1.5 below. For more general 11 | informations on this program, see README. For syntax details, read the 12 | provided manual pages. 13 | 14 | ============================================================================ 15 | STABLE RELEASE 1.0.4 : 16 | 17 | # Swedish localization (credits do Josef Andersson) 18 | # Fix dnssort with newer versions of Perl 5 interpreter. 19 | 20 | ============================================================================ 21 | STABLE RELEASE 1.0.3 : 22 | 23 | # Add --source option to force a source address. 24 | # Support for ICMPv6 RA domain name (RFC6106). 25 | # Support link-layer addresses on BSD. 26 | 27 | ============================================================================ 28 | STABLE RELEASE 1.0.2 : 29 | 30 | # rdisc6: print RA ND proxy bit. 31 | # rdisc6: print RA prefix flags. 32 | # rdnssd: check for errors while dropping privileges 33 | # Fix compilation on BSD. 34 | 35 | ============================================================================ 36 | STABLE RELEASE 1.0.1 : 37 | 38 | # Remove the deprecated ISATAP daemon from ndisc6. 39 | 40 | ============================================================================ 41 | STABLE RELEASE 1.0.0 : Minor feature enhancements 42 | 43 | # Add --config option to addr2name and name2addr. 44 | # German localization (credits to Chris Leck). 45 | # Fix memory alignment problems on ARM and SPARC systems. 46 | 47 | ============================================================================ 48 | STABLE RELEASE 0.9.9 : Minor feature enhancements 49 | 50 | # Linux isatap daemon for router list maintenance: 51 | Hosts should use this alongside the kernel-mode isatap tunnel driver. 52 | # Czech localization (credits to Petr Pisar). 53 | 54 | ============================================================================ 55 | STABLE RELEASE 0.9.8 : Major portability fixes 56 | 57 | # Fix compilation for BSD and OS X. 58 | # Fix rdisc6 support for ISATAP interfaces. 59 | 60 | ============================================================================ 61 | STABLE RELEASE 0.9.7 : Minor bugfixes 62 | 63 | # Don't remove DNS servers from resolv.conf at RDNSSD startup and exit. 64 | # Use relative links for manual pages. 65 | 66 | ============================================================================ 67 | STABLE RELEASE 0.9.6 : Minor bugfixes 68 | 69 | # Fix compilation against Linux kernel headers version 2.6.24. 70 | # Use the socket filter on Linux as an optimization for traceroute6. 71 | 72 | ============================================================================ 73 | STABLE RELEASE 0.9.5 : Minor bugfixes 74 | 75 | # Fix RDNSSD handling of GID. 76 | # Various cosmetic fixes. 77 | 78 | ============================================================================ 79 | TEST RELEASE 0.9.4 : Major feature enhancements 80 | 81 | # RDNSS client daemon for Linux. 82 | # Fix name2addr and addr2name inversion. 83 | 84 | ============================================================================ 85 | STABLE RELEASE 0.9.3 : Minor feature enhancements 86 | 87 | # rdisc6: supports RDNSS option. 88 | # Allow usage of GPLv3 in addition to GPLv2. 89 | # Update gettext to version 1.16.2. 90 | 91 | ============================================================================ 92 | STABLE RELEASE 0.9.2 : Minor portability fixes 93 | 94 | # traceroute6: fix compilation on glibc 2.3 95 | 96 | ============================================================================ 97 | STABLE RELEASE 0.9.1 : Minor bug fixes 98 | 99 | # traceroute6: fix progress report in case of timeouts. 100 | # traceroute6 supports UDP-Lite (with -L provisional option) 101 | # addrinfo becomes addr2name because of conflict with Sofia-SIP. 102 | # nameinfo becomes name2addr. 103 | # gettext support (English and partial French localization included). 104 | # gen-alias (build system): fix non-Debian builds 105 | 106 | ============================================================================ 107 | TEST RELEASE 0.9.0 : Major features enhancement, major bug fixes 108 | 109 | # rdisc6 supports RFC4191 (router preference and specific routes) 110 | # rdisc6 uses RFC2461 probe interval by default (4" instead of 1"). 111 | # traceroute6 parallelized in a safe manner. 112 | # traceroute6 handles Parameter Problem / Next Header errors better. 113 | # traceroute6 prints numerical IPv6 address when DNS fails. 114 | # traceroute6 includes IPv6 and extensions headers in packet size. 115 | # tcpspray: fix rare error handling deadlock. 116 | 117 | ============================================================================ 118 | STABLE RELEASE 0.7.4 : Minor feature enhancement 119 | 120 | # traceroute6 can send TCP probes of different sizes. 121 | 122 | ============================================================================ 123 | STABLE RELEASE 0.7.3 : Minor features enhancement, major bug fixes 124 | 125 | # traceroute6 won't stop at the first non-responsive hop anymore. 126 | # traceroute6 can print hop limit of received packet with option -l. 127 | # Support for resolving IDN (Internationalized Domain Names). 128 | 129 | ============================================================================ 130 | STABLE RELEASE 0.7.2 : Minor features enhancement 131 | 132 | # rdisc6, ndisc6 and traceroute6 now drop root privilege at the very 133 | beginning of execution to prevent all kind of would-be local root 134 | compromise (in case of bug in the command line parsing code). 135 | # FreeBSD build fixes. 136 | 137 | ============================================================================ 138 | STABLE RELEASE 0.7.1 : Minor portability fixes 139 | 140 | # Traffic class and routing header compatibility code for old libc 141 | (on Linux, FreeBSD and NetBSD). 142 | # Fix clock_nanosleep availability detection. 143 | 144 | ============================================================================ 145 | STABLE RELEASE 0.7.0 : Major feature enhancement 146 | 147 | # nameinfo and addrinfo DNS resolver for scripting added. 148 | # dnssort, simple sort script for DNS hostnames added. 149 | # IPv6 "Type 0" (loose source) routing support for traceroute6. 150 | # Outgoing interface selection with traceroute6 (even on non-Linux). 151 | # Minor fixes for LP64 architectures (incl. AMD64). 152 | # traceroute6 can skip IPv6 extension headers. 153 | 154 | ============================================================================ 155 | STABLE RELEASE 0.6.8 : Major bug fixes 156 | 157 | # Fix (very) incorrect duration and bandwidth result from tcpspray6. 158 | # Support for specifying IPv6 Traffic Class with traceroute6. 159 | 160 | ============================================================================ 161 | STABLE RELEASE 0.6.7 : Minor security fix 162 | 163 | # Check hop limit of incoming neighbor discovery packets (ndisc6, rdisc6). 164 | 165 | ============================================================================ 166 | STABLE RELEASE 0.6.6 : Minor portability fixes 167 | 168 | # FreeBSD compilation fix. 169 | 170 | ============================================================================= 171 | STABLE RELEASE 0.6.5 : Minor feature enhancement 172 | 173 | # Use POSIX monotonic clock instead of the real-time clock 174 | 175 | ============================================================================= 176 | STABLE RELEASE 0.6.4 : Minor bug fixes 177 | 178 | # Autoconf updates. 179 | # Fix non-ASCII characters within manual pages. 180 | # Debian packaging support. 181 | 182 | ============================================================================= 183 | STABLE RELEASE 0.6.3 : Minor bug fixes 184 | 185 | # tcptraceroute6 handles parameters with white spaces correctly. 186 | # Renamed traceroute6 to rltraceroute6 to avoid conflict with iputils. 187 | 188 | ============================================================================= 189 | STABLE RELEASE 0.6.2 : Major feature enhancement, minor security fixes 190 | 191 | # Support for ICMPv6 Echo requests traceroute6. 192 | # traceroute6 support for specifying UDP and ICMPv6 packets byte size 193 | (payload no longer has an empty payload by default). 194 | # Support for sending ECN-setup SYN packets with tcptraceroute6. 195 | # Support for selecting base UDP destination port with traceroute6. 196 | # Support for selecting source port number with tcptraceroute6. 197 | # Support for custom delay in-between each (tcp)traceroute6 probes. 198 | # Sanitize raw socket file descriptors number before use. 199 | # Fix symlink installation wrt DESTDIR (such as when packaging via RPM). 200 | 201 | ============================================================================= 202 | STABLE RELEASE 0.6.0 : Major feature enhancement, portability fixes 203 | 204 | # Switch to the bloated autotools. 205 | # rdisc6 and traceroute6 compile fixes for Solaris. 206 | # ndisc6 fixes for BSD and Solaris. 207 | # tcpspray6 Discard/Echo bandwidth metter added. 208 | 209 | ============================================================================= 210 | TEST RELEASE 0.5.3 : Minor bug fixes 211 | 212 | # Port (tcp)traceroute6 to BSD. 213 | # Fix UDP traceroute6 regression from version 0.5.2. 214 | # Handle ICMPv6 Parameter problem errors. 215 | 216 | ============================================================================= 217 | TEST RELEASE 0.5.2 : Minor bug fixes 218 | 219 | # Fix minor input buffer boundary check error. 220 | # Fix detection of invalid hop limits on the command line. 221 | 222 | ============================================================================= 223 | TEST RELEASE 0.5.1 : Minor feature enhancement 224 | 225 | # Add traditional UDP traceroute to traceroute6 (formerly tcptraceroute6). 226 | # tcptraceroute6 is now an alias for “traceroute6 -S”. 227 | # Source address specification option for (tcp)traceroute6. 228 | # TCP/ACK probes option for (tcp)traceroute6. 229 | # Use a rather high source TCP port, dependant on PID. 230 | 231 | ============================================================================= 232 | TEST RELEASE 0.5.0 : Major feature enhancement 233 | 234 | # tcptraceroute6 was added to the package. 235 | 236 | ============================================================================= 237 | STABLE RELEASE 0.4.1 : Minor bugfixes 238 | 239 | # rdisc6 can be compiled on FreeBSD. 240 | 241 | ============================================================================= 242 | STABLE RELEASE 0.4.0 : Minor features enhancement, major security fix 243 | 244 | # Print Source Link-Layer address in Router Advertisement if present. 245 | # Check Prefix information option length properly in Router Adverts. 246 | # Some spelling fixes. 247 | 248 | ============================================================================= 249 | BETA RELEASE 0.3.0 : Major features enhancement (release cancelled) 250 | 251 | # New --numeric option prevents DNS lookups. 252 | # Removed some useless system calls. 253 | # rdisc6 prints advertised link MTU. 254 | # Milliseconds and infinite lifetimes reported properly as such. 255 | # Don't print error messages multiple times. 256 | # New --single option only prints the first advertisement with rdisc6. 257 | # New --multiple option prints duplicate advertisements with ndisc6. 258 | 259 | ============================================================================= 260 | BETA RELEASE 0.1.5 : Minor features enhancement 261 | 262 | # Set appropriate ICMPv6 type filter (reduce CPU usage). 263 | 264 | ============================================================================= 265 | 266 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | NDisc6 : IPv6 diagnostic tools 2 | =============================== 3 | Copyright © 2005-2006 Rémi Denis-Courmont. 4 | 5 | This package gathers a few diagnostic tools for IPv6 networks: 6 | - ndisc6, which performs ICMPv6 Neighbor Discovery in userland, 7 | - rdisc6, which performs ICMPv6 Router Discovery in userland, 8 | - rltraceroute6, yet another IPv6 implementation of traceroute, 9 | - tcptraceroute6, a TCP/IPv6-based traceroute implementation, 10 | - tracert6, a ICMPv6 Echo Request based traceroute, 11 | - tcpspray6, a TCP/IP Discard/Echo bandwidth metter. 12 | 13 | For detailled usage instructions, you should refer to the Unix manual 14 | pages ndisc6(8), rdisc6(8), traceroute6(8) and tcpspray6(1) which 15 | should be provided with your copy of the program. 16 | For instructions on compilation and installation of the package, 17 | refer to the provided INSTALL file. 18 | 19 | This package is distributed under the terms of the General Public 20 | License (GPL) version 2 written by the Free Software Foundation, Inc. 21 | for full licensing details, please read COPYING. 22 | 23 | If you have further questions, you can contact me via email at: 24 | reim (at) remlab (dot) net 25 | 26 | All programs are known to run on Linux (with either glibc or µclibc). 27 | They should also work on any recent open-source BSD variant, and might 28 | work on Solaris or other BSD derivatives. 29 | 30 | -- 31 | Rémi Denis-Courmont 32 | http://www.remlab.net/ndisc6/ 33 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # VCS package rebuild script 3 | 4 | # ************************************************************************* 5 | # * Copyright © 2006 Rémi Denis-Courmont. * 6 | # * This program is free software: you can redistribute and/or modify * 7 | # * it under the terms of the GNU General Public License as published by * 8 | # * the Free Software Foundation, version 2 or 3. * 9 | # * * 10 | # * This program is distributed in the hope that it will be useful, * 11 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 | # * GNU General Public License for more details. * 14 | # * * 15 | # * You should have received a copy of the GNU General Public License * 16 | # * along with this program. If not, see . * 17 | # ************************************************************************* 18 | 19 | cd "$(dirname "$0")" || exit 1 20 | 21 | echo "Creating admin directory ..." 22 | test -d admin || mkdir admin || exit 1 23 | 24 | echo "Running autoreconf ..." 25 | autoreconf -sfi 26 | unlink po/Makevars.template 27 | 28 | for d in /usr /usr/local /opt/gettext /usr/pkg $HOME ; do 29 | if test -f $d/share/gettext/gettext.h ; then 30 | ln -sf $d/share/gettext/gettext.h include/gettext.h 31 | fi 32 | done 33 | 34 | test -f "include/gettext.h" || { 35 | echo "Error: can't find convenience C header." 36 | echo "Please put a link to it by hand as include/gettext.h" 37 | } 38 | 39 | echo "" 40 | echo "Type \`./configure' to configure the package for your system" 41 | echo "(type \`./configure -- help' for help)." 42 | echo "Then you can use the usual \`make', \`make install', etc." 43 | 44 | -------------------------------------------------------------------------------- /compat/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - compat/ directory Makefile for ndisc6 2 | # 3 | # *********************************************************************** 4 | # * Copyright © 2006-2008 Rémi Denis-Courmont. * 5 | # * This program is free software; you can redistribute and/or modify * 6 | # * it under the terms of the GNU General Public License as published * 7 | # * by the Free Software Foundation; version 2 of the license, or (at * 8 | # * your option) any later version. * 9 | # * * 10 | # * This program is distributed in the hope that it will be useful, * 11 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * 13 | # * See the GNU General Public License for more details. * 14 | # * * 15 | # * You should have received a copy of the GNU General Public License * 16 | # * along with this program; if not, you can get it from: * 17 | # * http://www.gnu.org/copyleft/gpl.html * 18 | # *********************************************************************** 19 | 20 | noinst_LIBRARIES = libcompat.a 21 | libcompat_a_SOURCES = compat/fixups.h compat/dummy.c 22 | libcompat_a_LIBADD = $(LIBOBJS) 23 | 24 | -------------------------------------------------------------------------------- /compat/dummy.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nomis/ndisc6/d60853a5319bac0c3ec9a082bcaf850a5ab8d1d5/compat/dummy.c -------------------------------------------------------------------------------- /compat/fdatasync.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fdatasync.c - fdatasync() replacement 3 | */ 4 | 5 | /*********************************************************************** 6 | * Copyright © 2006 Rémi Denis-Courmont. * 7 | * This program is free software; you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published * 9 | * by the Free Software Foundation; version 2 of the license, or (at * 10 | * your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * 15 | * See the GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, you can get it from: * 19 | * http://www.gnu.org/copyleft/gpl.html * 20 | ***********************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | # include 24 | #endif 25 | #include 26 | 27 | int fdatasync (int fd) 28 | { 29 | return fsync (fd); 30 | } 31 | -------------------------------------------------------------------------------- /compat/fixups.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Various fixes for obsolete, or plain broken, C libraries. 3 | */ 4 | 5 | /*********************************************************************** 6 | * Copyright © 2006 Rémi Denis-Courmont. * 7 | * This program is free software; you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published * 9 | * by the Free Software Foundation; version 2 of the license, or (at * 10 | * your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * 15 | * See the GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, you can get it from: * 19 | * http://www.gnu.org/copyleft/gpl.html * 20 | ***********************************************************************/ 21 | 22 | #ifdef NDISC6_COMPAT_FIXUPS_H 23 | # error How come you include this header twice?! 24 | #endif 25 | 26 | #ifndef HAVE_FDATASYNC 27 | int fdatasync (int fd); 28 | #endif 29 | 30 | #ifndef HAVE_INET6_RTH_ADD 31 | # include 32 | # include 33 | 34 | /* Price of the totally broken OS goes to MacOS X, which declares these 35 | * functions, but does not define them! Bug inherited from FreeBSD 4 and 36 | * still not fixed (as of early 2008). */ 37 | # include 38 | # define inet6_rth_space working_inet6_rth_space 39 | # define inet6_rth_init working_inet6_rth_init 40 | # define inet6_rth_add working_inet6_rth_add 41 | 42 | struct in6_addr; 43 | 44 | socklen_t inet6_rth_space (int type, int segments); 45 | void *inet6_rth_init (void *bp, socklen_t bp_len, int type, int segments); 46 | int inet6_rth_add (void *bp, const struct in6_addr *addr); 47 | #endif 48 | 49 | #ifndef IPV6_RTHDR_TYPE_0 50 | # define IPV6_RTHDR_TYPE_0 0 51 | #endif 52 | 53 | #ifndef HAVE_PPOLL 54 | # include 55 | struct pollfd; 56 | struct timespec; 57 | 58 | int ppoll (struct pollfd *restrict fds, int n, 59 | const struct timespec *restrict ts, 60 | const sigset_t *restrict sigmask); 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /compat/inet6_rth_add.c: -------------------------------------------------------------------------------- 1 | /* 2 | * inet6_rth_add.c - inet6_rth_* replacement for Routing Header type 0 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | socklen_t inet6_rth_space (int type, int segments) 30 | { 31 | if ((type != IPV6_RTHDR_TYPE_0) || (segments < 0) || (segments > 127)) 32 | return 0; 33 | 34 | return 8 + (segments * 16); 35 | } 36 | 37 | 38 | void *inet6_rth_init (void *bp, socklen_t bp_len, int type, int segments) 39 | { 40 | socklen_t needlen; 41 | 42 | needlen = inet6_rth_space (type, segments); 43 | if ((needlen == 0) || (bp_len < needlen)) 44 | return NULL; 45 | 46 | memset (bp, 0, needlen); 47 | ((uint8_t *)bp)[1] = segments * 2; /* type 0 specific */ 48 | ((uint8_t *)bp)[2] = type; 49 | return bp; 50 | } 51 | 52 | 53 | int inet6_rth_add (void *bp, const struct in6_addr *addr) 54 | { 55 | if (((uint8_t *)bp)[2] != IPV6_RTHDR_TYPE_0) 56 | return -1; 57 | 58 | memcpy (((uint8_t *)bp) + 8 + 16 * ((uint8_t *)bp)[3]++, addr, 16); 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /compat/ppoll.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ppoll.c - GNU extension ppoll() replacement 3 | */ 4 | 5 | /*********************************************************************** 6 | * Copyright © 2008 Rémi Denis-Courmont. * 7 | * This program is free software; you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published * 9 | * by the Free Software Foundation; version 2 of the license, or (at * 10 | * your option) any later version. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * 15 | * See the GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program; if not, you can get it from: * 19 | * http://www.gnu.org/copyleft/gpl.html * 20 | ***********************************************************************/ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | # include 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #if 0 32 | # include // sigprocmask is not thread-safe 33 | #endif 34 | 35 | int ppoll (struct pollfd *restrict fds, int n, 36 | const struct timespec *restrict ts, 37 | const sigset_t *restrict sigset) 38 | { 39 | sigset_t origset; 40 | int timeout; 41 | int val; 42 | 43 | if (ts != NULL) 44 | timeout = (ts->tv_sec * 1000) + (ts->tv_nsec / 1000000); 45 | else 46 | timeout = -1; 47 | 48 | /* NOTE: ppoll() was introduced to fix the race condition between 49 | * sigprocmask()/pthread_sigmask() and poll(). This replacement 50 | * obviously reintroduces it. A more intricate implementation could 51 | * avoid this bug (at a high performance cost). 52 | */ 53 | #if 0 54 | val = pthread_sigmask (SIG_SETMASK, sigset, &origset); 55 | if (val) 56 | { 57 | errno = val; 58 | return -1; 59 | } 60 | #else 61 | sigprocmask (SIG_SETMASK, sigset, &origset); 62 | #endif 63 | 64 | val = poll (fds, n, timeout); 65 | 66 | #if 0 67 | pthread_sigmask (SIG_SETMASK, &origset, NULL); /* cannot fail */ 68 | #else 69 | sigprocmask (SIG_SETMASK, &origset, NULL); /* cannot fail */ 70 | #endif 71 | return val; 72 | } 73 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl configure.ac - Configure script for ndisc6 2 | dnl based on earlier configure.ac from tcpreen by the same author 3 | 4 | dnl Process this file with GNU Autoconf to produce a configure script 5 | 6 | dnl ************************************************************************* 7 | dnl * Copyright © 2002-2016 Rémi Denis-Courmont. * 8 | dnl * This program is free software: you can redistribute and/or modify * 9 | dnl * it under the terms of the GNU General Public License as published by * 10 | dnl * the Free Software Foundation, version 2 or 3 of the license. * 11 | dnl * * 12 | dnl * This program is distributed in the hope that it will be useful, * 13 | dnl * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | dnl * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | dnl * GNU General Public License for more details. * 16 | dnl * * 17 | dnl * You should have received a copy of the GNU General Public License * 18 | dnl * along with this program. If not, see . * 19 | dnl ************************************************************************* 20 | 21 | AC_COPYRIGHT([Copyright (C) 2005-2016 Remi Denis-Courmont]) 22 | AC_INIT(ndisc6, 1.0.4, remi_no_bulk_mail@remlab.net) 23 | AC_PREREQ(2.62) 24 | INVOCATION="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`" 25 | 26 | AS_MESSAGE(checking system...) 27 | AC_CONFIG_SRCDIR(configure.ac) 28 | AC_CONFIG_AUX_DIR(admin) 29 | AC_CONFIG_MACRO_DIR(m4) 30 | AC_CONFIG_LIBOBJ_DIR(compat) 31 | AC_CONFIG_HEADERS(config.h) 32 | 33 | AC_DEFINE_UNQUOTED(PACKAGE_CONFIGURE_INVOCATION, "$INVOCATION", 34 | [Define to the command line used to invoke the configure script.]) 35 | RDC_BUILD_HOSTNAME 36 | 37 | 38 | # Checks for programs. 39 | AS_MESSAGE([checking required programs...]) 40 | AC_PROG_CC_C99 41 | AM_PROG_CC_C_O 42 | AC_USE_SYSTEM_EXTENSIONS 43 | 44 | AC_PROG_RANLIB 45 | AM_PROG_AR 46 | 47 | AC_PATH_PROG(PERL, perl, :) 48 | AC_ARG_VAR(PERL, [Perl interpreter]) 49 | 50 | AS_IF([test "x${enable_silent_rules}" = "x"], [ 51 | enable_silent_rules="yes" 52 | ]) 53 | AM_INIT_AUTOMAKE 54 | AM_SILENT_RULES 55 | 56 | # Checks for libraries. 57 | AS_MESSAGE([checking required libraries...]) 58 | 59 | LIBRT="" 60 | AC_CHECK_LIB([rt], clock_gettime, [LIBRT="-lrt"]) 61 | AC_SUBST(LIBRT) 62 | 63 | AM_GNU_GETTEXT_VERSION([0.19.3]) 64 | AM_GNU_GETTEXT([external], [need-ngettext]) 65 | 66 | dnl AC_DEFINE_UNQUOTED(PACKAGE_BUILD, "$build", 67 | dnl [Define to the canonical build-system name]) 68 | dnl AC_DEFINE_UNQUOTED(PACKAGE_HOST, "$host", 69 | dnl [Define to the canonical host-system name]) 70 | 71 | # Checks for header files. 72 | AS_MESSAGE([checking header files...]) 73 | AC_HEADER_ASSERT 74 | 75 | AH_BOTTOM([#ifdef __APPLE__ 76 | # define __APPLE_USE_RFC_3542 77 | #endif]) 78 | 79 | # Checks for typedefs, structures, and compiler characteristics. 80 | dnl AS_MESSAGE([checking target characteristics...]) 81 | dnl AC_C_BIGENDIAN 82 | dnl RDC_STRUCT_SOCKADDR_LEN 83 | 84 | 85 | # Checks for library functions. 86 | AS_MESSAGE([checking library functions...]) 87 | RDC_REPLACE_FUNC_GETOPT_LONG 88 | AC_REPLACE_FUNCS([fdatasync inet6_rth_add ppoll]) 89 | 90 | # Network stuff 91 | RDC_FUNC_SOCKET 92 | AC_SEARCH_LIBS(inet_ntop, [nsl]) 93 | 94 | # Checks for optionnal features 95 | AS_MESSAGE([checking optional features...]) 96 | AC_MSG_CHECKING([if installed programs should be setuid]) 97 | AC_ARG_ENABLE(suid-install, 98 | [AS_HELP_STRING(--disable-suid-install, 99 | [do not set the SetUID bit on installed programs])]) 100 | AS_IF([test "x${enable_suid_install}" != "xno"], 101 | [enable_suid_install=yes]) 102 | AM_CONDITIONAL(NOSUID, [test "${enable_suid_install}" = "no"]) 103 | AC_MSG_RESULT([${enable_suid_install}]) 104 | 105 | 106 | # Defines for 107 | AH_BOTTOM([ 108 | #include "compat/fixups.h" 109 | 110 | #define _( str ) gettext (str) 111 | #define N_( str ) gettext_noop (str) 112 | ]) 113 | 114 | 115 | # END 116 | AS_MESSAGE(writing results...) 117 | AC_CONFIG_FILES([Makefile po/Makefile.in]) 118 | AC_OUTPUT 119 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | rdnssd.8 2 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - doc Makefile for ndisc6 2 | 3 | # Copyright © 2006-2007 Rémi Denis-Courmont 4 | # This file is distributed under the same license as the ndisc6 package. 5 | 6 | man1_MANS = doc/addr2name.1 doc/dnssort.1 doc/tcpspray.1 7 | man8_MANS = doc/ndisc6.8 doc/rdisc6.8 doc/rltraceroute6.8 doc/rdnssd.8 8 | SOURCES_MAN = \ 9 | doc/ndisc6.8 doc/rdisc6.8 \ 10 | doc/rltraceroute6.8 \ 11 | doc/rdnssd.8-in \ 12 | $(man1_MANS) 13 | 14 | EXTRA_DIST += $(SOURCES_MAN) 15 | CLEANFILES += doc/rdnssd.8 16 | 17 | edit = sed \ 18 | -e 's,@localstatedir\@,$(localstatedir),g' \ 19 | -e 's,@sysconfdir\@,$(sysconfdir),g' 20 | 21 | .8-in.8: 22 | $(AM_V_at)rm -f -- $@ 23 | $(AM_V_at)mkdir -p doc 24 | $(sed_verbose)$(edit) $< > $@ 25 | 26 | install-data-hook:: 27 | inst=`echo rltraceroute6 | sed '$(transform)'`; \ 28 | cd "$(DESTDIR)$(man8dir)" && \ 29 | for a in tcptraceroute6 tracert6; do \ 30 | ln -sf -- "$${inst}.8" "$$a.8" ; \ 31 | done 32 | inst=`echo tcpspray | sed '$(transform)'`; \ 33 | cd "$(DESTDIR)$(man1dir)" && \ 34 | ln -sf -- "$${inst}.1" "tcpspray6.1" 35 | inst=`echo addr2name | sed '$(transform)'`; \ 36 | cd "$(DESTDIR)$(man1dir)" && \ 37 | ln -sf -- "$${inst}.1" "name2addr.1" 38 | 39 | uninstall-hook:: 40 | for a in tcptraceroute6 tracert6; do \ 41 | unlink "$(DESTDIR)$(man8dir)/$$a.8" ; \ 42 | done 43 | unlink "$(DESTDIR)$(man1dir)/tcpspray6.1" 44 | unlink "$(DESTDIR)$(man1dir)/name2addr.1" 45 | -------------------------------------------------------------------------------- /doc/addr2name.1: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2006 Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "ADDR2NAME" "1" "$Date$" "addr2name" "User's Manual" 16 | .SH NAME 17 | addr2name, name2addr \- perform DNS lookups from scripts 18 | .SH SYNOPSIS 19 | .BR "addr2name" " [" "-46cmnr" "] [" "HOSTNAMES" "]" 20 | 21 | .BR "name2addr" " [" "-46cn" "] [" "HOSTNAMES" "]" 22 | 23 | .SH DESCRIPTON 24 | Write addresses or canonical hostname of specified names to the standard 25 | output. If no names are specified via the command line, they are read from 26 | the standard input. 27 | 28 | .SH OPTIONS 29 | 30 | .TP 31 | .BR "\-4" " or " "\-\-ipv4" 32 | Only try to perform IPv4 lookups. 33 | 34 | .TP 35 | .BR "\-6" " or " "\-\-ipv6" 36 | Only try to perform IPv6 lookups. 37 | 38 | .TP 39 | .BR "\-c" " or " "\-\-config" 40 | Only lookup and print results for address families that match locally 41 | configured addresses (If the system has no IPv4 resp IPv6 address, 42 | then IPv4 resp IPv6 addresses are ignored). 43 | 44 | .TP 45 | .BR "\-h" " or " "\-\-help" 46 | Display some help and exit. 47 | 48 | .TP 49 | .BR "\-m" " or " "\-\-multiple" 50 | Normally, if a name yields multiple results, only the first one is printed. 51 | With this optional parameter, all results will be printed on a single line, 52 | separated by spaces. 53 | 54 | .TP 55 | .BR "\-n" " or " "\-\-numeric" 56 | Prevent forward hostname lookup. 57 | This ensures that the input names are numeric addresses, which do not need 58 | to be looked up. Typically used along with the \-\-reverse option to convert 59 | numerical addresses to canonical hostnames. 60 | 61 | .TP 62 | .BR "\-r" " or " "\-\-reverse" 63 | Perform a reverse DNS lookup 64 | .RB "(enabled implicitly with " "addr2name" ")." 65 | .BR "addr2name" " prints numerical resolved addresses by default instead." 66 | 67 | .TP 68 | .BR "\-\-version" 69 | Display program version and license and exit. 70 | 71 | .SH "SEE ALSO" 72 | host(1), getaddrinfo(3), getnameinfo(3), resolv.conf(5) 73 | 74 | .SH AUTHOR 75 | R\[char233]mi Denis-Courmont 76 | 77 | http://www.remlab.net/ndisc6/ 78 | -------------------------------------------------------------------------------- /doc/dnssort.1: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2006 Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "DNSSORT" "1" "$Date$" "dnssort" "User's Manual" 16 | .SH NAME 17 | dnssort \- sort DNS hostnames 18 | .SH SYNOPSIS 19 | .BR "dnssort" " [" "-r" "] [" "FILES" "]" 20 | 21 | .SH DESCRIPTON 22 | Write sorted concatenation of all specified files to standard output. 23 | If none are specified, the standard input is used. 24 | 25 | .SH OPTIONS 26 | 27 | .TP 28 | .BR "\-\-help" 29 | Display some help and exit. 30 | 31 | .TP 32 | .BR "\-r" 33 | Reverse the sorting comparisons. 34 | 35 | .TP 36 | .BR "\-\-version" 37 | Display program version and license and exit. 38 | 39 | .SH "SEE ALSO" 40 | sort(1) 41 | 42 | .SH AUTHOR 43 | R\[char233]mi Denis-Courmont 44 | 45 | http://www.remlab.net/ndisc6/ 46 | -------------------------------------------------------------------------------- /doc/ndisc6.8: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2004-2006 Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "NDISC6" "8" "$Date$" "ndisc6" "System Manager's Manual" 16 | .SH NAME 17 | ndisc6 \- ICMPv6 Neighbor Discovery tool 18 | .SH SYNOPSIS 19 | .BR "ndisc6" " [" "-1mnqv" "] [" "-r attempts" "] [" "-s source_ip" "]" 20 | .BR "" "[" "-w wait_ms" "] <" "IPv6 address" "> <" "iface" ">" 21 | 22 | .SH DESCRIPTON 23 | .B NDisc6 24 | is an Unix program which implements the ICMPv6 Neighbor Discovery in 25 | userland (it is normally done by the kernel). It is used to lookup the 26 | link-layer address (layer 2 address, MAC in the case of Ethernet) of 27 | any on-link IPv6 node. 28 | 29 | The IPv6 address of the node must be specified, as well as the 30 | networking interface on which to perform the lookup. 31 | 32 | .SH OPTIONS 33 | 34 | .TP 35 | .BR "\-1" " or " "\-\-single" 36 | Exit as soon as the first advertisement is received (default). 37 | 38 | .TP 39 | .BR "\-h" " or " "\-\-help" 40 | Display some help and exit. 41 | 42 | .TP 43 | .BR "\-m" " or " "\-\-multiple" 44 | Wait for possible duplicate advertisements and print all of them. 45 | 46 | .TP 47 | .BR "\-n" " or " "\-\-numeric" 48 | If the first parameter is not a valid IPv6 address, do not try to 49 | resolve it as a DNS hostname. 50 | 51 | .TP 52 | .BR "\-q" " or " "\-\-quiet" 53 | Only display link-layer address. Display nothing in case of failure. 54 | That is mostly useful when calling the program from a shell script. 55 | 56 | .TP 57 | .BR "\-r attempts" " or " "\-\-retry attempts" 58 | Send ICMPv6 Neighbor Discovery that many times until a reply is 59 | received, or abort. By default, ndisc6 will try 3 times before aborting 60 | (MAX_MULTICAST_SOLICIT and MAX_UNICAST_SOLICIT from RFC2461). 61 | 62 | .TP 63 | .BR "\-s source_ip" " or " "\-\-source source_ip" 64 | Specify the IPv6 address to be used as the source for the neighbor 65 | solicitation packets. 66 | 67 | .TP 68 | .BR "\-V" " or " "\-\-version" 69 | Display program version and license and exit. 70 | 71 | .TP 72 | .BR "\-v" " or " "\-\-verbose" 73 | Display verbose information. That is the default. 74 | 75 | .TP 76 | .BR "\-w wait_ms" " or " "\-\-wait wait_ms" 77 | .RI "Wait " "wait_ms" " milliseconds for a response before retrying." 78 | By default, ndisc6 waits 1 second between each attempts 79 | (RETRANS_TIMER from RFC2461). 80 | 81 | .PP 82 | .RB "If " "ndisc6" " does not receive any response after the specified number" 83 | .RI "of attempts waiting for " "wait_ms" " milliseconds each time, it will" 84 | exit with code 2. On error, it exits with code 1. 85 | Otherwise it exits with code 0. This makes it possible to use the exit 86 | code to see if a host is on-link or not. 87 | 88 | .SH DIAGNOSTICS 89 | 90 | If you get no response while you know the remote host is up, it is 91 | most likely that it is not on-link, that is to say, you must cross one 92 | or more routers to reach it. By design, IPv6 nodes ignore ICMPv6 93 | Neighbor Discovery packets received from nodes not on the same link 94 | (i.e. Ethernet segment), for the sake of security. Technically, that is 95 | done by ensuring that the Hop limit (TTL) is 255. 96 | 97 | .RB "Note that you cannot use " "ndisc6" " to lookup the local host's link-layer" 98 | address. 99 | 100 | .SH SECURITY 101 | .RB "" "ndisc6" " " 102 | .RI "should be " "setuid" " " "root" " to allow use by" 103 | non-privileged users. It will drop its root privileges before any attempt 104 | is made to send or receive data from the network to reduce the possible 105 | impact of a security vulnerability. 106 | 107 | .SH "SEE ALSO" 108 | ping6(8), rdisc6(8), ipv6(7) 109 | 110 | .SH AUTHOR 111 | R\[char233]mi Denis-Courmont 112 | 113 | http://www.remlab.net/ndisc6/ 114 | -------------------------------------------------------------------------------- /doc/rdisc6.8: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2004-2006 Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "RDISC6" "8" "$Date$" "rdisc6" "System Manager's Manual" 16 | .SH NAME 17 | rdisc \- ICMPv6 Router Discovery tool 18 | .SH SYNOPSIS 19 | .BR "rdisc6" " [" "-qv" "] [" "-r attempts" "] [" "-s source_ip" "]" 20 | .BR "" "[" "-w wait_ms" "] [" "IPv6 address" "] <" "iface" ">" 21 | 22 | .SH DESCRIPTON 23 | .B RDisc6 24 | is an Unix program which implements the ICMPv6 Router Discovery in 25 | userland (it is normally done by the kernel). It is used to lookup the 26 | list of on-link routers and IPv6 prefixes. 27 | 28 | It can also be used to force the kernel to update the state of a given 29 | IPv6-autoconfigured network interface. 30 | 31 | The name of the network interface to probe routers for must be 32 | specified. 33 | 34 | .SH OPTIONS 35 | 36 | .TP 37 | .BR "\-1" " or " "\-\-single" 38 | Exit as soon as the first advertisement is received. 39 | 40 | .TP 41 | .BR "\-h" " or " "\-\-help" 42 | Display some help and exit. 43 | 44 | .TP 45 | .BR "\-m" " or " "\-\-multiple" 46 | Wait for possible multiple advertisements and print all of them (default). 47 | 48 | .TP 49 | .BR "\-n" " or " "\-\-numeric" 50 | If the optional parameter is not a valid IPv6 address, do not try to 51 | resolve it as a DNS hostname. 52 | 53 | .TP 54 | .BR "\-q" " or " "\-\-quiet" 55 | Only display advertised IPv6 prefixes. Display nothing in case of failure. 56 | That is mostly useful when calling the program from a shell script. 57 | 58 | .TP 59 | .BR "\-r attempts" " or " "\-\-retry attempts" 60 | Send ICMPv6 Router Discovery that many times until a reply is 61 | received, or abort. By default, rdisc6 will try 3 times before aborting 62 | (MAX_RTR_SOLICITATIONS from RFC2461). 63 | 64 | .TP 65 | .BR "\-s source_ip" " or " "\-\-source source_ip" 66 | Specify the IPv6 address to be used as the source for the router 67 | solicitation packets. 68 | 69 | .TP 70 | .BR "\-V" " or " "\-\-version" 71 | Display program version and license and exit. 72 | 73 | .TP 74 | .BR "\-v" " or " "\-\-verbose" 75 | Display verbose information. That is the default. 76 | 77 | .TP 78 | .BR "\-w wait_ms" " or " "\-\-wait wait_ms" 79 | .RI "Wait " "wait_ms" " milliseconds for a response before retrying." 80 | By default, rdisc6 waits 4 second between each attempts 81 | (RTR_SOLICITATION_INTERVAL from RFC2461). 82 | 83 | .PP 84 | .RB "If " "rdisc6" " does not receive any response after the specified number" 85 | .RI "of attempts waiting for " "wait_ms" " milliseconds each time, it will" 86 | exit with code 2. On error, it exits with code 1. 87 | Otherwise it exits with code 0. 88 | 89 | .SH SECURITY 90 | .RB "" "rdisc6" " " 91 | .RI "must be " "setuid" " " "root" " to allow use by non " 92 | privileged users. It will drop its root privileges before any attempt 93 | is made to send or receive data from the network to reduce the possible 94 | impact of a security vulnerability. 95 | 96 | .SH "SEE ALSO" 97 | ndisc6(8), ipv6(7) 98 | 99 | .SH AUTHOR 100 | R\[char233]mi Denis-Courmont 101 | 102 | http://www.remlab.net/ndisc6/ 103 | -------------------------------------------------------------------------------- /doc/rdnssd.8-in: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2007 Pierre Ynard, Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "RDNSSD" "8" "$Date$" "rdnssd" "System Manager's Manual" 16 | .SH NAME 17 | rdnssd \- IPv6 Recursive DNS Server discovery Daemon 18 | .SH SYNOPSIS 19 | .BR "rdnssd" " [" "-f" "] [" "-H merge-hook" "] [" "-r resolv-file" "]" 20 | .BR "" "[" "-p pidfile" "] [" "-u username" "]" 21 | 22 | .SH DESCRIPTON 23 | .B rdnssd 24 | is a daemon program providing client-side support for DNS configuration 25 | using the Recursive DNS Server (RDNSS) option, as described in RFC 5006. 26 | Its purpose is to supply IPv6 DNS resolvers through stateless 27 | autoconfiguration, carried by Router Advertisements. 28 | 29 | rdnssd parses RDNSS options and keeps track of resolvers to write 30 | nameservers entries to a resolv.conf(5) configuration file. By default, 31 | it writes its own separate file, and may call an external hook to merge 32 | it with the main @sysconfdir@/resolv.conf. This is aimed at easing coexistence 33 | with concurrent daemons, especially IPv4 ones, updating 34 | @sysconfdir@/resolv.conf too. 35 | 36 | On Linux, since version 2.6.24, rdnssd takes advantage of a new netlink 37 | interface, forwarding RDNSS options validated by the kernel to userland. 38 | Otherwise, it merely listens to all ICMPv6 traffic through a raw socket. 39 | 40 | .SH OPTIONS 41 | 42 | .TP 43 | .BR "\-f" " or " "\-\-foreground" 44 | Do not detach from the console. Run the program in the foreground. 45 | 46 | .TP 47 | .BR "\-H merge-hook" " or " "\-\-merge-hook merge-hook" 48 | Execute this hook whenever resolv.conf is updated. If this option is 49 | not specified, then no hook will be called. 50 | 51 | .TP 52 | .BR "\-h" " or " "\-\-help" 53 | Display some help and exit. 54 | 55 | .TP 56 | .BR "\-p pidfile" " or " "\-\-pidfile pidfile" 57 | Override the location of the pidfile. 58 | 59 | .TP 60 | .BR "\-r resolv-file" " or " "\-\-resolv-file resolv-file" 61 | Set the path to the generated resolv.conf file. 62 | 63 | .TP 64 | .BR "\-u username" " or " "\-\-user username" 65 | Override the user that the program will run as. By default, it runs as 66 | .BR "nobody" "." 67 | 68 | .TP 69 | .BR "\-V" " or " "\-\-version" 70 | Display program version and license and exit. 71 | 72 | .SH FILES 73 | .TP 74 | .I @sysconfdir@/rdnssd/merge-hook 75 | A basic merge hook shipped with rdnssd, to be called with the -H option. 76 | 77 | .TP 78 | .I @localstatedir@/run/rdnssd/resolv.conf 79 | The default resolv.conf(5) file that rdnssd writes its configuration to. 80 | 81 | .TP 82 | .I @localstatedir@/run/rdnssd.pid 83 | The process-id file. 84 | 85 | .SH BUGS 86 | rdnssd does not keep track of the lifetimes of the routers associated 87 | with some DNS resolvers, whereas it should to strictly comply with RFC 88 | 5006. 89 | 90 | When rdnssd uses a raw socket instead of the netlink kernel interface, 91 | it does not validate received Neighbor Discovery traffic in any way. 92 | For example, it will always consider Router Advertisement packets, 93 | whereas it should not if the host is configured as a router. When the 94 | netlink interface is used, such validation is done by the kernel. 95 | 96 | .SH "SEE ALSO" 97 | resolv.conf(5), rdisc6(8), ipv6(7) 98 | 99 | .SH AUTHOR 100 | Pierre Ynard 101 | 102 | http://www.remlab.net/ndisc6/ 103 | -------------------------------------------------------------------------------- /doc/rltraceroute6.8: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2005-2006 Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "TRACEROUTE6" "8" "$Date$" "traceroute6" "System Manager's Manual" 16 | .SH NAME 17 | rltraceroute6 \- IPv6 traceroute tool 18 | 19 | tcptraceroute6 \- TCP/IPv6 traceroute tool 20 | 21 | .SH SYNOPSIS 22 | .BR "traceroute6" " [" "-AdEILlnrSU" "] [" "-f min_hop" "] [" "-g hop" "] [" 23 | .BR "-i iface" "] [" "-m max_hop" "] [" "-p port" "] [" "-q attempts" "] [" 24 | .BR "-s source" "] [" "-t tclass" "] [" "-w wait" "] [" "-z delay_ms" "] <" 25 | .BR "hostname/address" "> [" "packet length" "]" 26 | 27 | .BR "tcptraceroute6" " [" "-AdEnrS" "] [" "-f min_hop" "] [" "-g hop" "] [" 28 | .BR "-i iface" "] [" "-l packet_size" "] [" "-m max_hop" "] [" "-p port" "] [" 29 | .BR "-q attempts" "] [" "-s source" "] [" "-t tclass" "] [" "-w wait" "] [" 30 | .BR "-z delay_ms" "] <" 31 | .BR "hostname/address" "> [" "port" "]" 32 | 33 | .SH DESCRIPTON 34 | .B rltraceroute6 35 | is an IPv6 traceroute implementation. 36 | 37 | It displays the list of hops along the network route between the local system 38 | and specified destination, by sending packets while incrementing their hop 39 | limit, until the final destination is reached. 40 | 41 | .RB "By default, " "rltraceroute6" " sends UDP probe packets toward the" 42 | destination (that's the historical default). 43 | However, it can also send TCP packets, much like Michael C. Toren's 44 | .B tcptraceroute 45 | does on IPv4 networks; 46 | .B tcptraceroute6 47 | sends TCP packets by default (and mimics tcptraceroute command line 48 | syntax). 49 | Finally, it can also send ICMPv6 Echo Request packets, like some other 50 | traceroute implementations (such as the one in Microsoft Windows); 51 | .B tracert6 52 | does this by default. 53 | 54 | You must specify the name or address of the host toward which the network 55 | route should be determined. An optional additional parameter specifies either 56 | the probe packets length (for UDP and ICMP packets), or the destination port 57 | number/service name (for TCP packets). 58 | 59 | Note that TCP destination port zero really is TCP port numbered 0 (which 60 | cannot be used via the standard higer-level TCP/IP programming interface). 61 | 62 | .SH OPTIONS 63 | 64 | .TP 65 | .B "\-A" 66 | Send TCP/ACK probe packets. That's very efficient against stateless 67 | firewalls (e.g. the official Linux kernel versions up to and including 2.4.31 68 | and 2.6.14), and utterly helpless against stateful ones. Note that TCP/ACK 69 | probing cannot determine whether the destination TCP port is open or not. 70 | 71 | .TP 72 | .B "\-d" 73 | Enable socket debugging option (SO_DEBUG). Unless you are debugging the 74 | kernel, this is probably not going to have any actual effect. 75 | 76 | .TP 77 | .B "\-E" 78 | .RI "Send " "ECN-setup" " TCP/SYN probe packets (as per RFC 3168)" 79 | rather than non-ECN-setup TCP/SYN probe packets. This has no effect unless 80 | command line optin -S is specified as well. 81 | 82 | .TP 83 | .B "\-F" 84 | This option is ignored for backward compatibility. 85 | IPv6 packets are never fragmented en route. 86 | 87 | .TP 88 | .B "\-f" 89 | Override the initial IPv6 packets hop limit (default: 1). 90 | 91 | .TP 92 | .B "\-g" 93 | Add an IPv6 route segment within an IPv6 Routing Header. 94 | This enables loose source routing. 95 | Currently, only "Type 0" routing header is supported. 96 | 97 | .TP 98 | .B "\-h" 99 | Display some help and exit. 100 | 101 | .TP 102 | .B "\-I" " (rltraceroute6 only)" 103 | Send ICMPv6 Echo requests (like ping6) as probe packets. 104 | That's the default for tracert6. 105 | 106 | .TP 107 | .B "\-i" 108 | Only send packets through the specified interface. 109 | See also BUGS. 110 | 111 | .TP 112 | .B "\-I" " (rltraceroute6 only)" 113 | Send UDP-Lite (protocol 136) packets (with full checksum coverage) 114 | as probe packets instead of normal UDP (protocol 17). 115 | 116 | .TP 117 | .BR "\-l" " (rltraceroute6 only)" 118 | Print the hop limit of received packets. 119 | This is mostly used to detect asymmetric routing. 120 | 121 | .TP 122 | .BR "\-l" " (tcptraceroute6 only)" 123 | Specify the size (bytes) of sent packets. 124 | 125 | .TP 126 | .B "\-m" 127 | Override the maximum hop limit (maximum number of hops). 128 | The default is 30 hops which should be sufficient on the IPv6 Internet for 129 | some time. 130 | 131 | .TP 132 | .B "\-N" 133 | Try to resolve each hop's IPv6 address to a host name. This is the default. 134 | This option is meant for backward compatibility with tcptraceroute(8). 135 | 136 | .TP 137 | .B "\-n" 138 | Do not try to resolve each hop's IPv6 address to a host name. 139 | That may speed up the traceroute significantly. 140 | 141 | .TP 142 | .B "\-p" 143 | For rltraceroute6, specify the base destination port number (default: 33434). 144 | rltraceroute6 assumes that packets toward this port up to this port plus the 145 | maximum hop limit are not in use by any program on the final destination 146 | and that they are not blocked by some firewall. The fact that this very 147 | assumption was not always correct, eventually lead to the development of the 148 | original IPv4 tcptraceroute by Michael Toren. 149 | 150 | For tcptraceroute6, specify the source port number (default: auto). 151 | Note that source port number zero really means number zero, rather than some 152 | port number that would be automatically assigned, as is the case with usual 153 | softwares. 154 | 155 | .TP 156 | .B "\-q" 157 | Override the number of probes sent to each hop (default: 3). 158 | 159 | .TP 160 | .B "\-r" 161 | Do not route packets, i.e. do not send packets through a gateway that would be 162 | specified by the routing table. 163 | See also BUGS. 164 | 165 | .TP 166 | .B "\-S" 167 | Use TCP/SYN probe packets. That's the default for tcptraceroute6. 168 | 169 | .TP 170 | .B "\-s" 171 | Specify the source address to use for probe packets explicitly. 172 | 173 | .TP 174 | .B "\-S" 175 | Use UDP probe packets. That's the default for rltraceroute6. 176 | 177 | .TP 178 | .B "\-t" 179 | Specify the traffic class (DSCP) for probe packets. 180 | See also BUGS. 181 | 182 | .TP 183 | .B "\-U" " (rltraceroute6 only)" 184 | Send UDP probe packets. That's the default. 185 | 186 | .TP 187 | .B "\-V" 188 | Display program version and license and exit. 189 | 190 | .TP 191 | .B "\-w" 192 | Override the delay (in seconds) to wait for response once a given probe packet 193 | was sent (default: 5 seconds). 194 | 195 | .TP 196 | .B "\-x" 197 | This option is ignored for seamless migration from IPv4 traceroute. 198 | The IPv6 header has no checksum field. 199 | 200 | .TP 201 | .B "\-z" 202 | Specify a milliseconds delay to wait between each probe 203 | with identical hop limit. 204 | This can be useful to work-around ICMPv6 rate limitation on some hosts. 205 | 206 | .SH DIAGNOSTICS 207 | If a response is received, the round-trip time is printed. 208 | In addition, specific symbols denote certain errors: 209 | 210 | .TP 211 | .BR "*" " No response" 212 | No valid response received before the timeout delay (see -w option). 213 | 214 | .TP 215 | .BR "!N" " No route to destination" 216 | There is no entry for the destination network in the routing table. 217 | 218 | .TP 219 | .BR "!A" " Communication with destination administratively prohibited" 220 | A firewall explicitly rejected the traffic. 221 | 222 | .TP 223 | .BR "!S" " Beyond scope of source address" 224 | The address scope of the source address is too small to reach the 225 | destination address. At the time of writing, this can only happen when 226 | using a link-local source address to reach a global scope destination. 227 | (Note: some IPv4 traceroute implementations use !S for source route 228 | error which is completely different) 229 | 230 | .TP 231 | .BR "!H" " Address unreachable" 232 | The host address is not reachable for some other reasons, 233 | particularly a link-layer failure (e.g. Neighbor discovery failure). 234 | 235 | .TP 236 | .BR "!P" " Unrecognized Next Header type encountered" 237 | The destination does not implement the layer-4 protocol used. 238 | You should retry with ICMPv6 Echo Requests (-I command line option) 239 | which MUST be supported by any IPv6 node. 240 | 241 | .SH SECURITY 242 | .RI "rltraceroute6 should be " "setuid" " " "root" " to allow use by non " 243 | privileged users. It will drop its root privileges before any attempt 244 | is made to send or receive data from the network so as to reduce the possible 245 | impact of a security vulnerability. 246 | 247 | .SH BUGS 248 | However useful they might be, -i and -r options are ignored by the 249 | official Linux kernel at the time of writing this manpage, 250 | and hence do not work as documented. 251 | 252 | Support for option -t was broken until Linux kernel version 2.6.18. 253 | 254 | Usage of Routing Header, with option -g, triggers an OOPS on Linux kernel 255 | versions below 2.6.17.12. 256 | 257 | Receiving TCP/SYN-ACK packets does not work on FreeBSD at all. 258 | This severely limits the usefulness of tcptraceroute6 on FreeBSD. 259 | 260 | Packet length takes the IPv6 header and, if present, extension headers 261 | into account. 262 | rltraceroute6 versions before 0.7.4 used it as IPv6 payload length instead, 263 | i.e. did not include the layer-3 headers in the computation. 264 | Linux iputils traceroute6 does not even include the UDP header. 265 | On the whole, the packet length semantic is very inconsistent among IPv6 266 | traceroute implementations. 267 | 268 | .SH "SEE ALSO" 269 | ipv6(7), traceroute(8), tcptraceroute(8), traceroute6(8) 270 | 271 | .SH AUTHOR 272 | R\[char233]mi Denis-Courmont 273 | 274 | http://www.remlab.net/ndisc6/ 275 | -------------------------------------------------------------------------------- /doc/tcpspray.1: -------------------------------------------------------------------------------- 1 | .\" ************************************************************************* 2 | .\" * Copyright © 2006 Rémi Denis-Courmont. * 3 | .\" * This program is free software: you can redistribute and/or modify * 4 | .\" * it under the terms of the GNU General Public License as published by * 5 | .\" * the Free Software Foundation, versions 2 or 3 of the license. * 6 | .\" * * 7 | .\" * This program is distributed in the hope that it will be useful, * 8 | .\" * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | .\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 | .\" * GNU General Public License for more details. * 11 | .\" * * 12 | .\" * You should have received a copy of the GNU General Public License * 13 | .\" * along with this program. If not, see . * 14 | .\" ************************************************************************* 15 | .TH "TCPSPRAY" "1" "$Date$" "tcpspray" "User's Manual" 16 | .SH NAME 17 | tcpspray \- TCP/IP bandwidth measurement tool (Discard and Echo client) 18 | .SH SYNOPSIS 19 | .BR "tcpspray" " [" "-46ev" "] [" "-b block_size" "] [" "-d wait_\[char181]s" "] [" 20 | .BR "-f filename" "] [" "-n count" "] <" "hostname" "> [" "port" "]" 21 | 22 | .SH DESCRIPTON 23 | .B tcpspray 24 | .RI "uses the " "Discard" " resp. " "Echo" " protocol (RFC\ 863 resp. RFC\ 862)" 25 | .RI "to perform bandwidth measurements of " "TCP" " sessions between the" 26 | .RI "local system, and a " "Discard" " resp. " "Echo" " server." 27 | 28 | Unix-based hosts can provide a Discard and/or Echo servers with the Internet 29 | .I super-server 30 | .BR "inetd" ". On Windows NT, the 31 | .I simple network protocols 32 | optional component will do the same. 33 | 34 | The name or address of the server node must be specified. tcpspray will 35 | automatically try to use IPv6 when available. If not, or if it fails, it will 36 | fallback to IPv4. However, tcpspray4 resp. tcpspray6 only try to use IPv4 37 | resp. IPv6. 38 | 39 | .SH OPTIONS 40 | 41 | .TP 42 | .BR "\-4" " or " "\-\-ipv4" 43 | Force usage of TCP over IPv4. 44 | 45 | .TP 46 | .BR "\-6" " or " "\-\-ipv6" 47 | Force usage of TCP over IPv6. 48 | 49 | .TP 50 | .BR "\-b block_size" " or " "\-\-bsize block_size" 51 | Send block of the specified byte size (default: 1024). 52 | 53 | .TP 54 | .BR "\-d wait_\[char181]s" " or " "\-\-delay wait_\[char181]s" 55 | Waits for the given amount of microseconds after any given was sent 56 | before attempting to send the next one. There is no delay by default. 57 | 58 | .TP 59 | .BR "\-e" " or " "\-\-echo" 60 | Use the Echo protocol instead of Discard. tcpspray will measure the 61 | time required to send data and receive it back, instead of simply 62 | sending it. 63 | 64 | .TP 65 | .BR "\-f filename" " or " "\-\-fill filename" 66 | Read data from the specified file to fill sent blocks with. If the 67 | file is smaller than the size of blocks, or if no file were specified, 68 | the remaining trailing bytes are all set to zero. 69 | 70 | .TP 71 | .BR "\-h" " or " "\-\-help" 72 | Display some help and exit. 73 | 74 | .TP 75 | .BR "\-n block_count" " or " "\-\-count block_count" 76 | Send the specified amount of data blocks for the measurements 77 | (default: 100). 78 | 79 | .TP 80 | .BR "\-V" " or " "\-\-version" 81 | Display program version and license and exit. 82 | 83 | .TP 84 | .BR "\-v" " or " "\-\-verbose" 85 | Display more verbose informations. In particular, tcpspray will print a dot 86 | each time a block is sent. If the Echo protocol is used (option -e), dots 87 | will be erased as data is received back. 88 | 89 | .SH DIAGNOSTICS 90 | 91 | If you get no response while you know the remote host is up, it is 92 | most likely that it has no Discard/Echo service running, or that these 93 | services are blocked by a firewall. Running tcptraceroute6(8) resp. 94 | tcptraceroute(8) toward the IPv6 resp. IPv4 remote host might help detecting 95 | such a situation. 96 | 97 | .SH SECURITY 98 | tcpspray does not require any privilege to run. 99 | 100 | .SH "SEE ALSO" 101 | tcp(7), inetd(8), tcptraceroute6(8), tcptraceroute(8) 102 | 103 | .SH AUTHOR 104 | R\[char233]mi Denis-Courmont 105 | 106 | http://www.remlab.net/ndisc6/ 107 | -------------------------------------------------------------------------------- /ezirad/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc -std=gnu99 2 | CFLAGS = -g -O0 -Wall -Wextra -Werror -D_FORTIFY_SOURCE=2 -DHAVE_CONFIG_H=1 -I. 3 | TARGETS = ezirad 4 | ezirad_SOURCES = ezirad.c sys_netlink.c ezirad.h 5 | 6 | LIBNL_1_CFLAGS = $(shell pkg-config --cflags libnl-1) 7 | LIBNL_1_LDFLAGS = $(shell pkg-config --libs libnl-1) 8 | CFLAGS += $(LIBNL_1_CFLAGS) 9 | LDFLAGS += $(LIBNL_1_LDFLAGS) 10 | 11 | all: $(TARGETS) 12 | 13 | mostlyclean: 14 | rm -f *.o $(TARGETS) 15 | 16 | ezirad: $(filter %.o, $(ezirad_SOURCES:%.c=%.o)) 17 | 18 | clean: mostlyclean 19 | 20 | .PHONY: all clean mostlyclean 21 | 22 | -------------------------------------------------------------------------------- /ezirad/NOTES: -------------------------------------------------------------------------------- 1 | This document lists all the options from the classical radvd, explains how 2 | ezirad determines a value for each of them, and the rationale. 3 | 4 | Copyright © Rémi Denis-Courmont. 5 | Distributed under the same license terms as the ezirad package. 6 | 7 | Last update: 28 December 2006 8 | 9 | Interface options 10 | ================== 11 | 12 | IgnoreIfMissing (Off) N/A (or in a way, always On) 13 | ezirad automatically picks interface as they appear and disappear. 14 | 15 | AdvSendAvert (Off) always On 16 | There might be some corner cases where ezirad should not answer on an 17 | interface, though it would seldom cause harm to do so. Still, I wonder 18 | why radvd has this option (and on top of that Off by default!). You 19 | would not configure the interface if you did not send advertisements 20 | on it. 21 | 22 | UnicastOnly (Off) fail-safe Off with regards to unsolicited RAs 23 | always On with regards to solicited RAs 24 | ezirad always replies send solicited RAs as unicast, which is legal 25 | (though not the specification default), and works fine even for 26 | multicast-enabled links. It even avoids broadcasting RAs to host that 27 | did not request them. 28 | ezirad should try to send unsoliticated RAs (multicast) on 29 | IFF_MULTICAST links and ignore errors. 30 | NOT IMPLEMENTED YET 31 | 32 | MaxRtrAdvInterval (10 minutes) 33 | MinRtrAdvInterval (200) 34 | MinDelayBetweenRAs (3) 35 | NOT IMPLEMENTED YET 36 | 37 | AdvManagedFlag (Off) always Off 38 | ezirad is all about not managing the network, so there is probably no 39 | DHCPv6 server available on hosts. If there is one, you should use 40 | radvd instead. 41 | 42 | AdvOtherConfigFlag (Off) always Off 43 | Same as AdvManagedFlag. However, we may want to implement DHCPv6 in 44 | ezirad too, if only to provide Recursive DNS Server configuration. 45 | This is a huge TODO however. 46 | 47 | AdvLinkMTU (0 = Off) always Off 48 | ezirad can guess the interface MTU. Support for AdvLinkMTU is present, 49 | though commented out. It is typically useless to tell other hosts to 50 | use the MTU which we obtained from lower layer, as they know about it 51 | too already. AdvLinkMTU is only useful if hosts need to use a lower 52 | MTU for some unusual reasons (MSS clamping used to be one with broken 53 | tunnels, but it has mostly disappeared as IPv6 stacks improved). 54 | Worst yet, the MTU, as seen from the host running ezirad might be 55 | different from the MTU as seen on other nodes. A typical scenario 56 | involves an Gigabit Ethernet ezirad router (MTU=9000+) with some Fast 57 | Ethernet (MTU=1500) nodes on the network segment. 58 | 59 | AdvReachableTime (unspecified) always unspeficied 60 | AdvRetransTimer (unspecified) always unspecified 61 | The most sane default is that provided by the underlying link-layer. 62 | No need to customize this. 63 | 64 | AdvCurHopLimit (64) local kernel configuration (or 128) 65 | 66 | AdvDefaultLifetime (30 minutes) always 30 minutes 67 | AdvDefaultLifetime has to be non-zero otherwise the router will be 68 | very useless. It also has to be multiple times MaxRtrAdvInterval so 69 | that a host has little risk of loosing its autoconfiguration even if 70 | it lost a 1 or 2 subsequent unsoliticed RAs. 71 | That being said, it should be no bigger that radvd's own default, so 72 | that an explicitly configured router will not get a lower priority on 73 | the same network segment. 74 | 75 | AdvDefaultPreference (Medium) always Low 76 | 77 | AdvSourceLLAddress (On) always On (unless link has no address) 78 | 79 | AdvHomeAgentFlag (Off) always Off until Mobile IPv6 implemented 80 | AdvHomeAgentInfo (Off) always Off 81 | ezirad should determine this automatically, but this is 82 | NOT IMPLEMENTED YET. 83 | 84 | HomeAgentLifetime (30 minutes) N/A until AdvHomeAgentFlag is implemented 85 | HomeAgentPreference (0) always 0? always something <0 ? N/A currently 86 | 87 | AdvMobRtrSupportFlag (Off) always Off until Mobile Router implemented 88 | 89 | AdvIntervalOpt (Off) NOT IMPLEMENTED (should be always Off?) 90 | 91 | 92 | Prefix options 93 | =============== 94 | 95 | AdvOnLink (On) always On 96 | Let alone an uncommon link layer type, this should always work fine. 97 | Afterall, we trust our own addresses table. 98 | 99 | AdvAutonomous (On) On if and only if prefix length is 64 bits 100 | ezirad currently assumes there is no DHCPv6 server, so hosts should 101 | use autonomous address configuration. 102 | 103 | AdvRouterAddr (Off) pending Mobile IPv6 support NOT IMPLEMENTED 104 | 105 | AdvValidLifetime (30 days) always 30 days - should be smaller 106 | AdvPreferredLifetime (7 days) always 7 days - should be smaller 107 | 108 | Base6to4Interface (not used) N/A 109 | 110 | 111 | Route options 112 | ============== 113 | 114 | Route option is not currently implemented at all. 115 | 116 | AdvRouteLifetime (30 minutes) same as AdvDefaultLifetime 117 | AdvRoutePreference (Medium) same as AdvDefaultPreference 118 | 119 | 120 | Recursive DNS Server options 121 | ============================= 122 | 123 | RDNSS is purposedly not implemented because it was not standard at the time of 124 | writing this document. Relevant options will be reviewed in due time. 125 | -------------------------------------------------------------------------------- /ezirad/config.h: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 1 2 | 3 | #define gettext( str ) (str) 4 | #define gettext_noop( str ) (str) 5 | #define _( str ) gettext (str) 6 | #define N_( str ) gettext_noop (str) 7 | 8 | -------------------------------------------------------------------------------- /ezirad/ezirad.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #ifndef IPV6_RECVPKTINFO 24 | # define IPV6_RECVPKTINFO IPV6_PKTINFO 25 | #endif 26 | #ifndef IPV6_RECVHOPLIMIT 27 | # define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT 28 | #endif 29 | 30 | #include "ezirad.h" 31 | 32 | 33 | static int 34 | recv_rs (int fd, struct sockaddr_in6 *restrict src, 35 | struct sockaddr_in6 *restrict dst) 36 | { 37 | struct nd_router_solicit icmp; 38 | uint8_t opts[1280 - sizeof (struct nd_router_solicit)]; 39 | char cbuf[CMSG_SPACE (sizeof (struct in6_pktinfo)) 40 | + CMSG_SPACE (sizeof (int))]; 41 | struct iovec iov[] = 42 | { 43 | { 44 | .iov_base = &icmp, 45 | .iov_len = sizeof (icmp) 46 | }, 47 | { 48 | .iov_base = opts, 49 | .iov_len = sizeof (opts) 50 | } 51 | }; 52 | struct msghdr msg = 53 | { 54 | .msg_name = (struct sockaddr *)src, 55 | .msg_namelen = sizeof (*src), 56 | .msg_iov = iov, 57 | .msg_iovlen = sizeof (iov) / sizeof (iov[0]), 58 | .msg_control = cbuf, 59 | .msg_controllen = sizeof (cbuf) 60 | }; 61 | 62 | /* Receive router solicitation */ 63 | ssize_t val = recvmsg (fd, &msg, 0); 64 | if (val == -1) 65 | return -1; 66 | 67 | /* Validate router solicitation */ 68 | /* It is assumed checksum was validated by the kernel */ 69 | memset (dst, 0, sizeof (*dst)); 70 | for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); 71 | cmsg != NULL; 72 | cmsg = CMSG_NXTHDR (&msg, cmsg)) 73 | { 74 | if (cmsg->cmsg_level != IPPROTO_IPV6) 75 | continue; 76 | 77 | switch (cmsg->cmsg_type) 78 | { 79 | /* Ignore packets with incorrect hop limit */ 80 | case IPV6_HOPLIMIT: 81 | if (255 != *(int *)CMSG_DATA (cmsg)) 82 | goto error; 83 | break; 84 | 85 | case IPV6_PKTINFO: 86 | { 87 | const struct in6_pktinfo *nfo = 88 | (struct in6_pktinfo *)CMSG_DATA (cmsg); 89 | dst->sin6_family = AF_INET6; 90 | #ifdef HAVE_SA_LEN 91 | dst->sin6_len = sizeof (*dst); 92 | #endif 93 | dst->sin6_scope_id = nfo->ipi6_ifindex; 94 | memcpy (&dst->sin6_addr, &nfo->ipi6_addr, 16); 95 | } 96 | } 97 | } 98 | 99 | if (dst->sin6_scope_id == 0) 100 | goto error; 101 | 102 | val -= sizeof (icmp); 103 | if ((val < 0) 104 | || (icmp.nd_rs_type != ND_ROUTER_SOLICIT) 105 | || (icmp.nd_rs_code != 0)) 106 | goto error; 107 | 108 | for (uint8_t *ptr = opts; val >= 8;) 109 | { 110 | uint16_t optlen = ptr[1] << 3; 111 | 112 | if (optlen == 0) 113 | goto error; 114 | 115 | val -= optlen; 116 | if (val < 0) 117 | goto error; 118 | 119 | switch (ptr[0]) 120 | { 121 | case ND_OPT_SOURCE_LINKADDR: 122 | if (IN6_IS_ADDR_UNSPECIFIED (&src->sin6_addr)) 123 | goto error; 124 | break; 125 | } 126 | 127 | ptr += optlen; 128 | } 129 | 130 | return 0; 131 | 132 | error: 133 | errno = EAGAIN; 134 | return -1; 135 | } 136 | 137 | 138 | /** 139 | * Tries to guess the hop limit for an interface. 140 | */ 141 | static uint8_t guess_hlim (int ifindex) 142 | { 143 | int hlim = -1; 144 | 145 | int fd = socket (AF_INET6, SOCK_DGRAM, 0); 146 | if (fd != -1) 147 | { 148 | struct in6_pktinfo info = 149 | { 150 | .ipi6_ifindex = ifindex 151 | }; 152 | 153 | /* Note: Linux does not currently implements this */ 154 | setsockopt (fd, IPPROTO_IPV6, IPV6_PKTINFO, &info, sizeof (info)); 155 | 156 | /* Note: Linux only implements this as of version 2.6.20 */ 157 | if (getsockopt (fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hlim, 158 | &(socklen_t){ sizeof (hlim) })) 159 | hlim = -1; 160 | 161 | close (fd); 162 | } 163 | 164 | if (hlim == -1) 165 | hlim = 128; 166 | 167 | return hlim; 168 | } 169 | 170 | #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16 171 | #define MAX_INITIAL_RTR_ADVERTISEMENTS 3 172 | #define MAX_FINAL_RTR_ADVERTISEMENTS 3 173 | #define MIN_DELAY_BETWEEN_RAS 3 174 | //#define MAX_RA_DELAY_TIME .5 175 | 176 | 177 | 178 | typedef struct ez_prefix ez_prefix_t; 179 | typedef struct ez_iface ez_iface_t; 180 | 181 | struct ez_prefix 182 | { 183 | ez_prefix_t *next; 184 | struct in6_addr prefix; 185 | unsigned length; 186 | }; 187 | 188 | struct ez_iface 189 | { 190 | ez_iface_t *next; 191 | ez_prefix_t *prefixes; 192 | unsigned index; 193 | struct in6_addr linklocal; 194 | struct 195 | { 196 | struct timespec next; 197 | struct timespec next_multicast; 198 | unsigned initial; 199 | timer_t id; 200 | } timer; 201 | }; 202 | 203 | 204 | static void iface_destroy (ez_iface_t *iface) 205 | { 206 | /* TODO: send bye */ 207 | timer_delete (iface->timer.id); 208 | 209 | for (ez_prefix_t *p = iface->prefixes; p != NULL;) 210 | { 211 | ez_prefix_t *buf = p->next; 212 | free (p); 213 | p = buf; 214 | } 215 | } 216 | 217 | 218 | static void iface_destroy_all (ez_iface_t *iface) 219 | { 220 | while (iface != NULL) 221 | { 222 | ez_iface_t *buf = iface->next; 223 | iface_destroy (iface); 224 | iface = buf; 225 | } 226 | } 227 | 228 | 229 | static void 230 | 231 | static ez_iface_t * 232 | iface_create (ez_iface_t **list, unsigned ifindex) 233 | { 234 | ez_iface_t *iface = malloc (sizeof (**list)); 235 | if (iface == NULL) 236 | return NULL; 237 | 238 | iface->next = *list; 239 | iface->prefix = NULL; 240 | iface->index = ifindex; 241 | iface->initial = MAX_INITIAL_RTR_ADVERTISEMENTS; 242 | clock_gettime (CLOCK_MONOTONIC, &iface->next 243 | 244 | static int send_ra (int fd, const struct sockaddr_in6 *peer, 245 | const struct sockaddr_in6 *local) 246 | { 247 | const unsigned ifindex = local->sin6_scope_id; 248 | 249 | /* RA source address */ 250 | struct in6_addr src = local->sin6_addr; 251 | ezsys_addr_rewind (); 252 | while (!IN6_IS_ADDR_LINKLOCAL (&src)) 253 | { 254 | struct ez_addr p; 255 | if (ezsys_addr_read (&p) == NULL) 256 | { 257 | errno = EADDRNOTAVAIL; 258 | return -1; // could not find suitable source address 259 | } 260 | 261 | if (p.addr.sin6_scope_id != ifindex) 262 | continue; 263 | 264 | memcpy (src.s6_addr, p.addr.sin6_addr.s6_addr, 16); 265 | } 266 | 267 | /* Router advertisement */ 268 | struct nd_router_advert icmp; 269 | uint8_t optbuf[1280 - (40 + sizeof (struct nd_router_advert))]; 270 | uint8_t *opt = optbuf; 271 | const uint8_t *optend = optbuf + sizeof (optbuf); 272 | 273 | icmp.nd_ra_type = ND_ROUTER_ADVERT; 274 | icmp.nd_ra_code = 0; 275 | icmp.nd_ra_cksum = 0; 276 | icmp.nd_ra_curhoplimit = guess_hlim (ifindex); 277 | icmp.nd_ra_flags_reserved = 0x18; 278 | icmp.nd_ra_router_lifetime = htons (1800); 279 | icmp.nd_ra_reachable = 0; 280 | icmp.nd_ra_retransmit = 0; 281 | 282 | /* Source LL option option */ 283 | size_t val = ezsys_get_hwaddr (ifindex, opt + 2, sizeof (optbuf) - 2); 284 | if ((val > 0) && (val < (0x800 - 2) /* max option length */)) 285 | { 286 | val += 2; 287 | uint16_t optlen = (val + 7) & ~7; 288 | opt[0] = ND_OPT_SOURCE_LINKADDR; 289 | opt[1] = optlen >> 3; 290 | assert (optlen >= val); 291 | memset (opt + val, 0, optlen - val); 292 | opt += optlen; 293 | } 294 | 295 | #if 0 296 | /* MTU option */ 297 | uint32_t mtu = ezsys_get_mtu (local->sin6_scope_id); 298 | if ((mtu >= 1280) && ((optend - opt) >= 8)) 299 | { 300 | opt[0] = ND_OPT_MTU; 301 | opt[1] = 1; 302 | opt[2] = opt[3] = 0; 303 | memcpy (opt + 4, &(uint32_t){ htonl (mtu) }, 4); 304 | opt += 8; 305 | } 306 | #endif 307 | 308 | /* Prefix option(s) */ 309 | ezsys_addr_rewind (); 310 | 311 | for (struct nd_opt_prefix_info *first = (struct nd_opt_prefix_info *)opt; 312 | (size_t)(optend - opt) >= sizeof (struct nd_opt_prefix_info); 313 | ) 314 | { 315 | struct ez_addr p; 316 | if (ezsys_addr_read (&p) == NULL) 317 | break; 318 | 319 | if ((p.addr.sin6_scope_id != ifindex) 320 | || IN6_IS_ADDR_LINKLOCAL (&p.addr.sin6_addr) 321 | || (p.prefix_length >= 128)) 322 | continue; 323 | 324 | struct nd_opt_prefix_info *nfo = (struct nd_opt_prefix_info *)opt; 325 | nfo->nd_opt_pi_type = ND_OPT_PREFIX_INFORMATION; 326 | nfo->nd_opt_pi_len = sizeof (*nfo) >> 3; 327 | nfo->nd_opt_pi_prefix_len = p.prefix_length; 328 | 329 | uint8_t flags = ND_OPT_PI_FLAG_ONLINK; 330 | if (p.prefix_length == 64) 331 | flags |= ND_OPT_PI_FLAG_AUTO; 332 | nfo->nd_opt_pi_flags_reserved = flags; 333 | nfo->nd_opt_pi_valid_time = htonl (2592000); 334 | nfo->nd_opt_pi_preferred_time = htonl (604800); 335 | nfo->nd_opt_pi_reserved2 = 0; 336 | 337 | uint8_t i = p.prefix_length >> 3; 338 | memcpy (nfo->nd_opt_pi_prefix.s6_addr, p.addr.sin6_addr.s6_addr, i); 339 | memset (nfo->nd_opt_pi_prefix.s6_addr + i, 0, 16 - i); 340 | if (p.prefix_length & 7) 341 | { 342 | uint8_t mask = ((1 << (8 - (p.prefix_length & 7))) - 1) ^ 0xff; 343 | nfo->nd_opt_pi_prefix.s6_addr[i] |= 344 | p.addr.sin6_addr.s6_addr[i] & mask; 345 | } 346 | 347 | /* Make sure we did not already include the same prefix */ 348 | const struct nd_opt_prefix_info *other = first; 349 | while (other < nfo) 350 | { 351 | if (IN6_ARE_ADDR_EQUAL (&other->nd_opt_pi_prefix, 352 | &nfo->nd_opt_pi_prefix) 353 | && (other->nd_opt_pi_prefix_len == nfo->nd_opt_pi_prefix_len)) 354 | break; 355 | other++; 356 | } 357 | if (other < nfo) 358 | continue; // duplicate prefix! 359 | 360 | opt += sizeof (*nfo); 361 | } 362 | 363 | /* Send */ 364 | char cbuf[CMSG_SPACE (sizeof (struct in6_pktinfo))]; 365 | struct iovec iov[] = 366 | { 367 | { 368 | .iov_base = &icmp, 369 | .iov_len = sizeof (icmp) 370 | }, 371 | { 372 | .iov_base = optbuf, 373 | .iov_len = opt - optbuf 374 | } 375 | }; 376 | struct msghdr msg = 377 | { 378 | .msg_name = (struct sockaddr *)peer, 379 | .msg_namelen = sizeof (*peer), 380 | .msg_iov = iov, 381 | .msg_iovlen = sizeof (iov) / sizeof (iov[0]), 382 | .msg_control = cbuf, 383 | .msg_controllen = sizeof (cbuf) 384 | }; 385 | 386 | struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); 387 | cmsg->cmsg_level = IPPROTO_IPV6; 388 | cmsg->cmsg_type = IPV6_PKTINFO; 389 | cmsg->cmsg_len = CMSG_LEN (sizeof (struct in6_pktinfo)); 390 | 391 | struct in6_pktinfo *pinfo = (struct in6_pktinfo *)CMSG_DATA (cmsg); 392 | memcpy (&pinfo->ipi6_ifindex, &local->sin6_scope_id, 393 | sizeof (pinfo->ipi6_ifindex)); 394 | memcpy (pinfo->ipi6_addr.s6_addr, src.s6_addr, 16); 395 | 396 | return sendmsg (fd, &msg, 0) > 0 ? 0 : -1; 397 | } 398 | 399 | 400 | /* TOOD: unsolicited thread */ 401 | 402 | static int prepare_icmp_socket (int fd) 403 | { 404 | /* Only process Router Solicitation */ 405 | struct icmp6_filter f; 406 | ICMP6_FILTER_SETBLOCKALL (&f); 407 | ICMP6_FILTER_SETPASS (ND_ROUTER_SOLICIT, &f); 408 | (void)setsockopt (fd, IPPROTO_ICMPV6, ICMP6_FILTER, &f, sizeof (f)); 409 | 410 | /* Subscribe to ip6-allrouters */ 411 | struct group_req mr; 412 | memset (&mr, 0, sizeof (mr)); 413 | mr.gr_group.ss_family = AF_INET6; 414 | #ifdef HAVE_SA_LEN 415 | mr.gr_group.ss_len = sizeof (struct sockaddr_in6); 416 | #endif 417 | ((struct sockaddr_in6 *)&mr.gr_group)->sin6_addr.s6_addr[0] = 0xff; 418 | ((struct sockaddr_in6 *)&mr.gr_group)->sin6_addr.s6_addr[1] = 419 | ((struct sockaddr_in6 *)&mr.gr_group)->sin6_addr.s6_addr[15] = 0x02; 420 | setsockopt (fd, IPPROTO_IPV6, MCAST_JOIN_GROUP, &mr, sizeof (mr)); 421 | 422 | setsockopt (fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &(int){ 255 }, 423 | sizeof (int)); 424 | setsockopt (fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &(int){ 255 }, 425 | sizeof (int)); 426 | setsockopt (fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &(int){ 1 }, 427 | sizeof (int)); 428 | setsockopt (fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &(int){ 1 }, 429 | sizeof (int)); 430 | 431 | return 0; 432 | } 433 | 434 | 435 | static int exit_signal = 0; 436 | static void exit_handler (int signum) 437 | { 438 | exit_signal = signum; 439 | } 440 | 441 | 442 | static void init_signals (void) 443 | { 444 | struct sigaction sa; 445 | sigset_t set; 446 | 447 | memset (&sa, 0, sizeof (sa)); 448 | sigemptyset (&sa.sa_mask); 449 | sigemptyset (&set); 450 | 451 | sa.sa_handler = exit_handler; 452 | sigaction (SIGINT, &sa, NULL); 453 | sigaddset (&set, SIGINT); 454 | sigaction (SIGQUIT, &sa, NULL); 455 | sigaddset (&set, SIGQUIT); 456 | sigaction (SIGTERM, &sa, NULL); 457 | sigaddset (&set, SIGTERM); 458 | 459 | sa.sa_handler = SIG_IGN; 460 | sigaction (SIGPIPE, &sa, NULL); 461 | sigaddset (&set, SIGPIPE); 462 | sigaction (SIGHUP, &sa, NULL); 463 | sigaddset (&set, SIGHUP); 464 | 465 | //sigprocmask (SIG_BLOCK, &set, NULL); 466 | } 467 | 468 | 469 | int main (void) 470 | { 471 | int retval = 1; 472 | setgid (65534); // FIXME 473 | 474 | /* ICMPv6 socket initialization */ 475 | int fd = socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); 476 | if (fd == -1) 477 | { 478 | perror (_("ICMPv6 socket")); 479 | return 1; 480 | } 481 | setuid (65534); // FIXME 482 | 483 | init_signals (); 484 | 485 | if (prepare_icmp_socket (fd)) 486 | goto error; 487 | 488 | /* Netlink address cache initialization */ 489 | int nlfd = ezsys_init (); 490 | if (nlfd == -1) 491 | goto error; 492 | 493 | while (!exit_signal) 494 | { 495 | sigset_t set; 496 | struct pollfd ufd[] = 497 | { 498 | { .fd = fd, .events = POLLIN }, 499 | { .fd = nlfd, .events = POLLIN } 500 | }; 501 | sigemptyset (&set); 502 | 503 | #define ppoll( u, n, t, s ) poll( u, n, -1 ) 504 | 505 | int val = ppoll (ufd, sizeof (ufd) / sizeof (ufd[0]), NULL, &set); 506 | if (val == -1) 507 | continue; 508 | 509 | if (ufd[1].revents) 510 | ezsys_process (); 511 | 512 | if (ufd[0].revents) 513 | { 514 | struct sockaddr_in6 src, dst; 515 | if (recv_rs (fd, &src, &dst) == 0) 516 | send_ra (fd, &src, &dst); 517 | else 518 | perror ("recv_rs"); 519 | } 520 | } 521 | 522 | retval = 0; 523 | 524 | error: 525 | ezsys_deinit (); 526 | close (fd); 527 | return 0; 528 | } 529 | 530 | -------------------------------------------------------------------------------- /ezirad/ezirad.h: -------------------------------------------------------------------------------- 1 | #ifndef EZIRAD_EZIRAD_H 2 | # define EZIRAD_EZIRAD_H 1 3 | 4 | typedef struct ez_addr 5 | { 6 | struct sockaddr_in6 addr; 7 | unsigned prefix_length; 8 | } ez_addr_t; 9 | 10 | 11 | int ezsys_init (void); 12 | void ezsys_deinit (void); 13 | void ezsys_process (void); 14 | 15 | unsigned ezsys_nifaces (void); 16 | unsigned ezsys_getifaces (unsigned *restrict ifaces, unsigned size); 17 | unsigned ezsys_naddrs (void); 18 | unsigned ezsys_getaddresses (ez_addr_t *restrict ifaces, unsigned size); 19 | 20 | uint32_t ezsys_get_mtu (int ifindex); 21 | size_t ezsys_get_hwaddr (int ifindex, uint8_t *restrict buf, size_t buflen); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ezirad/sys_netlink.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include 3 | #endif 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | typedef uint8_t __u8; 15 | typedef uint16_t __u16; 16 | typedef int16_t __s16; 17 | typedef uint32_t __u32; 18 | typedef int32_t __s32; 19 | typedef uint64_t __u64; 20 | 21 | #include 22 | #include 23 | int nl_addr_fill_sockaddr(struct nl_addr *addr, struct sockaddr *sa, 24 | socklen_t *salen); 25 | #include 26 | #include 27 | #include 28 | 29 | #include "ezirad.h" 30 | 31 | 32 | static struct nl_handle *nlh = NULL; 33 | static struct nl_cache *link_cache = NULL; 34 | static struct nl_cache *addr_cache = NULL; 35 | 36 | 37 | int ezsys_init (void) 38 | { 39 | assert (nlh == NULL); 40 | 41 | nlh = nl_handle_alloc (); 42 | if (nlh != NULL) 43 | { 44 | nl_disable_sequence_check (nlh); 45 | nl_join_groups(nlh, RTMGRP_LINK); 46 | nl_join_groups (nlh, RTMGRP_IPV6_IFADDR); 47 | 48 | if (nl_connect (nlh, NETLINK_ROUTE) == 0) 49 | { 50 | link_cache = rtnl_link_alloc_cache (nlh); 51 | if (link_cache != NULL) 52 | { 53 | nl_cache_mngt_provide (link_cache); 54 | addr_cache = rtnl_addr_alloc_cache (nlh); 55 | 56 | if (addr_cache != NULL) 57 | { 58 | int fd = nl_handle_get_fd (nlh); 59 | fcntl (fd, F_SETFL, fcntl (fd, F_GETFL) | O_NONBLOCK); 60 | return fd; 61 | } 62 | nl_cache_free (link_cache); 63 | } 64 | nl_close (nlh); 65 | } 66 | nl_handle_destroy (nlh); 67 | } 68 | return -1; 69 | } 70 | 71 | 72 | void ezsys_deinit (void) 73 | { 74 | if (nlh == NULL) 75 | return; 76 | 77 | nl_cache_free (addr_cache); 78 | nl_cache_mngt_unprovide (link_cache); 79 | nl_cache_free (link_cache); 80 | nl_close (nlh); 81 | nl_handle_destroy (nlh); 82 | nlh = NULL; 83 | } 84 | 85 | 86 | void ezsys_process (void) 87 | { 88 | assert (nlh != NULL); 89 | nl_recvmsgs_def (nlh); 90 | 91 | struct nl_dump_params params = 92 | { .dp_fd = stdout, .dp_type = NL_DUMP_BRIEF }; 93 | nl_cache_update (nlh, link_cache); 94 | nl_cache_dump (link_cache, ¶ms); 95 | 96 | nl_cache_update (nlh, addr_cache); 97 | nl_cache_dump (addr_cache, ¶ms); 98 | puts (""); 99 | } 100 | 101 | 102 | void ezsys_getdatasize (unsigned *restrict niface, unsigned *restrict naddr) 103 | { 104 | *niface = nl_cache_nitems (link_cache); 105 | *naddr = nl_cache_nitems (addr_cache); 106 | } 107 | 108 | 109 | void ezsys_getdata (unsigned *restrict ifaces, ez_prefix_t *restrict addrs) 110 | { 111 | for (struct nl_object *o = nl_cache_get_first (link_cache); 112 | o != NULL; 113 | o = nl_cache_get_next (o)) 114 | { 115 | struct rtnl_link *rtl = (struct rtnl_link *)o; 116 | *ifaces++ = rtnl_link_get_ifindex (rtl); 117 | } 118 | 119 | for (struct nl_object *o = nl_cache_get_first (addr_cache); 120 | o != NULL; 121 | o = nl_cache_get_next (o)) 122 | { 123 | struct rtnl_addr *rta = (struct rtnl_addr *)o; 124 | if (rtnl_addr_get_family (rta) != AF_INET6) 125 | continue; 126 | 127 | struct nl_addr *a = rtnl_addr_get_local (rta); 128 | if (a == NULL) 129 | continue; 130 | 131 | socklen_t len = sizeof (addrs->addr); 132 | if (nl_addr_fill_sockaddr (a, (struct sockaddr *)&addrs->addr, &len) 133 | || (len < sizeof (addrs->addr))) 134 | continue; 135 | 136 | if (IN6_IS_ADDR_V4MAPPED (&addrs->addr.sin6_addr) 137 | || IN6_IS_ADDR_V4COMPAT (&addrs->addr.sin6_addr)) 138 | continue; 139 | 140 | addrs->addr.sin6_scope_id = rtnl_addr_get_ifindex (rta); 141 | addrs->prefix_length = nl_addr_get_prefixlen (a); 142 | 143 | addrs++; 144 | } 145 | } 146 | 147 | 148 | uint32_t ezsys_get_mtu (int ifindex) 149 | { 150 | struct rtnl_link *link = rtnl_link_get (link_cache, ifindex); 151 | if (link == NULL) 152 | return 0; 153 | 154 | uint32_t mtu = rtnl_link_get_mtu (link); 155 | rtnl_link_put (link); 156 | return mtu; 157 | } 158 | 159 | 160 | size_t ezsys_get_hwaddr (int ifindex, uint8_t *restrict buf, size_t buflen) 161 | { 162 | struct rtnl_link *link = rtnl_link_get (link_cache, ifindex); 163 | if (link == NULL) 164 | return 0; 165 | 166 | struct nl_addr *addr = rtnl_link_get_addr (link); 167 | unsigned alen = 0; 168 | if (addr != NULL) 169 | { 170 | alen = nl_addr_get_len (addr); 171 | void *data = nl_addr_get_binary_addr (addr); 172 | memcpy (buf, data, (alen < buflen) ? alen : buflen); 173 | } 174 | rtnl_link_put (link); 175 | return alen; 176 | } 177 | -------------------------------------------------------------------------------- /gen-alias: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # ************************************************************************* 4 | # * Copyright © 2006 Rémi Denis-Courmont. * 5 | # * This program is free software: you can redistribute and/or modify * 6 | # * it under the terms of the GNU General Public License as published by * 7 | # * the Free Software Foundation, versions 2 or 3 of the license. * 8 | # * * 9 | # * This program is distributed in the hope that it will be useful, * 10 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | # * GNU General Public License for more details. * 13 | # * * 14 | # * You should have received a copy of the GNU General Public License * 15 | # * along with this program. If not, see . * 16 | # ************************************************************************* 17 | 18 | 19 | set -e 20 | 21 | FRONTEND="$1" 22 | BACKEND="$2" 23 | PARAMS="$3" 24 | 25 | if [ -z "$PARAMS" ]; then 26 | echo "Usage: $0 " >&2 27 | exit 1 28 | fi 29 | 30 | BACKEND="`echo "${BACKEND}" | sed "${transform}"`" 31 | 32 | rm -f "${FRONTEND}" 33 | cat > "$FRONTEND" << EOF 34 | #! /bin/sh 35 | exec "\$(dirname \$0)/${BACKEND}" ${PARAMS} "\$@" 36 | EOF 37 | chmod +rx "$FRONTEND" 38 | 39 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- 1 | gettext.h 2 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | codeset.m4 2 | extern-inline.m4 3 | fcntl-o.m4 4 | gettext.m4 5 | glibc*.m4 6 | iconv.m4 7 | int*.m4 8 | lcmessage.m4 9 | lib-*.m4 10 | lock.m4 11 | longlong.m4 12 | nls.m4 13 | po.m4 14 | printf-posix.m4 15 | progtest.m4 16 | size_max.m4 17 | stdint_h.m4 18 | threadlib.m4 19 | uintmax_t.m4 20 | visibility.m4 21 | wchar_t.m4 22 | wint_t.m4 23 | xsize.m4 24 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - m4 Makefile for ndisc6 2 | 3 | # Copyright © 2006 Rémi Denis-Courmont 4 | # This file is distributed under the same license as the ndisc6 package. 5 | 6 | EXTRA_DIST += m4/sockaddr.m4 m4/getopt.m4 m4/hostname.m4 7 | -------------------------------------------------------------------------------- /m4/getopt.m4: -------------------------------------------------------------------------------- 1 | # getopt.m4 2 | dnl Copyright (C) 2003-2004 Remi Denis-Courmont 3 | dnl From Remi Denis-Courmont 4 | 5 | AC_DEFUN([RDC_FUNC_GETOPT_LONG], 6 | [AC_CHECK_HEADERS(getopt.h) 7 | AH_TEMPLATE([HAVE_GETOPT_LONG], [Define to 1 if you have the `getopt_long' function.]) 8 | AC_SEARCH_LIBS(getopt_long, [gnugetopt], have_getopt_long=yes, 9 | have_getopt_long=no) 10 | if test $have_getopt_long = yes; then 11 | AC_DEFINE(HAVE_GETOPT_LONG) 12 | $1 13 | else 14 | $2 15 | false 16 | fi 17 | ]) 18 | 19 | AC_DEFUN([RDC_REPLACE_FUNC_GETOPT_LONG], 20 | [AH_BOTTOM([/* Fallback replacement for GNU `getopt_long' */ 21 | #ifndef HAVE_GETOPT_LONG 22 | # define getopt_long( argc, argv, optstring, longopts, longindex ) \ 23 | getopt (argc, argv, optstring) 24 | # if !GETOPT_STRUCT_OPTION && !HAVE_GETOPT_H 25 | struct option { const char *name; int has_arg; int *flag; int val; }; 26 | # define GETOPT_STRUCT_OPTION 1 27 | # endif 28 | # ifndef required_argument 29 | # define no_argument 0 30 | # define required_argument 1 31 | # define optional_argument 2 32 | # endif 33 | #endif]) 34 | RDC_FUNC_GETOPT_LONG 35 | ]) 36 | 37 | -------------------------------------------------------------------------------- /m4/hostname.m4: -------------------------------------------------------------------------------- 1 | # hostname.m4 2 | dnl Copyright (C) 2003-2004 Remi Denis-Courmont 3 | dnl From Remi Denis-Courmont 4 | 5 | AC_DEFUN([RDC_BUILD_HOSTNAME], 6 | [AC_CACHE_CHECK([for build hostname], 7 | rdc_cv_build_hostname, 8 | [rdc_cv_build_hostname=`hostname -f 2>/dev/null || uname -n 2>/dev/null || hostname 2>/dev/null || echo "unknown"` 9 | ]) 10 | AC_DEFINE_UNQUOTED(PACKAGE_BUILD_HOSTNAME, "$rdc_cv_build_hostname", 11 | [Define to the hostname of the host who builds the package.]) 12 | ]) 13 | 14 | -------------------------------------------------------------------------------- /m4/sockaddr.m4: -------------------------------------------------------------------------------- 1 | # sockaddr.m4 2 | # Copyright (C) 2003-2004 Remi Denis-Courmont 3 | # . 4 | # This file (sockaddr.m4) is free software; unlimited permission to 5 | # copy and/or distribute it , with or without modifications, as long 6 | # as this notice is preserved. 7 | 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 10 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 11 | # PARTICULAR PURPOSE. 12 | 13 | dnl SHOULD check , before that 14 | AC_DEFUN([RDC_STRUCT_SOCKADDR_LEN], 15 | [AC_LANG_ASSERT(C) 16 | AH_TEMPLATE(HAVE_SA_LEN, [Define to 1 if `struct sockaddr' has a `sa_len' member.]) 17 | AC_CACHE_CHECK([if struct sockaddr has a sa_len member], 18 | rdc_cv_struct_sockaddr_len, 19 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 20 | [#if HAVE_SYS_TYPES_H 21 | # include 22 | #endif 23 | #if HAVE_SYS_SOCKET_H 24 | # include 25 | #elif HAVE_WINSOCK2_H 26 | # include 27 | #endif]], [[struct sockaddr addr; addr.sa_len = 0;]])], 28 | rdc_cv_struct_sockaddr_len=yes, 29 | rdc_cv_struct_sockaddr_len=no)]) 30 | AS_IF([test $rdc_cv_struct_sockaddr_len = yes], 31 | [AC_DEFINE(HAVE_SA_LEN)]) 32 | ]) 33 | 34 | dnl SHOULD check , before that 35 | AC_DEFUN([RDC_STRUCT_SOCKADDR_STORAGE], 36 | [AC_LANG_ASSERT(C) 37 | AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if does not define.]) 38 | AH_TEMPLATE(ss_family, [Define to `sa_family' if does not define.]) 39 | AC_CACHE_CHECK([for struct sockaddr_storage in sys/socket.h], 40 | rdc_cv_struct_sockaddr_storage, 41 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 42 | [#if HAVE_SYS_TYPES_H 43 | # include 44 | #endif 45 | #if HAVE_SYS_SOCKET_H 46 | # include 47 | #elif HAVE_WINSOCK2_H 48 | # include 49 | #endif]], [[struct sockaddr_storage addr; addr.ss_family = 0;]])], 50 | rdc_cv_struct_sockaddr_storage=yes, 51 | rdc_cv_struct_sockaddr_storage=no)]) 52 | AS_IF([test $rdc_cv_struct_sockaddr_storage = no], 53 | [AC_DEFINE(sockaddr_storage, sockaddr) 54 | AC_DEFINE(ss_family, sa_family)]) 55 | ]) 56 | 57 | dnl SHOULD check , before that 58 | AC_DEFUN([RDC_TYPE_SOCKLEN_T], 59 | [AC_LANG_ASSERT(C) 60 | AH_TEMPLATE(socklen_t, [Define to `int' if does not define.]) 61 | AC_CACHE_CHECK([for socklen_t in sys/socket.h], 62 | rdc_cv_type_socklen_t, 63 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ 64 | [#if HAVE_SYS_TYPES_H 65 | # include 66 | #endif 67 | #if HAVE_SYS_SOCKET_H 68 | # include 69 | #elif HAVE_WINSOCK2_H 70 | # include 71 | #endif]], [[socklen_t len; len = 0;]])], 72 | rdc_cv_type_socklen_t=yes, 73 | rdc_cv_type_socklen_t=no)]) 74 | AS_IF([test "$rdc_cv_type_socklen_t" = no], 75 | [AC_DEFINE(socklen_t, int)]) 76 | ]) 77 | 78 | dnl SHOULD check before that 79 | AC_DEFUN([RDC_FUNC_SOCKET], 80 | [AC_LANG_ASSERT(C) 81 | AC_SEARCH_LIBS(socket, [socket], rdc_cv_func_socket=yes, 82 | dnl AC_SEARCH_LIBS(socket, [ws2_32]) does not work with Mingw32 83 | [AC_CACHE_CHECK([for socket in -lws2_32], rdc_cv_func_socket_ws2_32, 84 | [rdc_func_socket_save_LIBS=$LIBS 85 | LIBS="-lws2_32 $LIBS" 86 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ 87 | [#if HAVE_WINSOCK2_H 88 | # include 89 | #endif]], [[socket(0, 0, 0);]])], 90 | rdc_cv_func_socket_ws2_32=yes, 91 | rdc_cv_func_socket_ws2_32=no) 92 | LIBS=$rdv_func_socket_save_LIBS]) 93 | AS_IF([test "$rdc_cv_func_socket_ws2_32" = yes], 94 | [rdc_cv_func_socket=yes; LIBS="-lws2_32 $LIBS"]) 95 | ]) 96 | AS_IF([test "$rdc_cv_func_socket" = yes], [$1], [$2]) 97 | ]) 98 | 99 | dnl SHOULD check , , before that 100 | dnl NOTE: does not check required library 101 | dnl (-lresolv is NOT needed on Solaris, but -lws2_32 is required on Windows) 102 | AC_DEFUN([RDC_FUNC_GETADDRINFO], 103 | [AC_LANG_ASSERT(C) 104 | AH_TEMPLATE(HAVE_GETADDRINFO, 105 | [Define to 1 if you have the `getaddrinfo' function.]) 106 | AH_TEMPLATE(HAVE_GETNAMEINFO, 107 | [Define to 1 if you have the `getnameinfo' function.]) 108 | AH_TEMPLATE(HAVE_GAI_STRERROR, 109 | [Define to 1 if you have the `gai_strerror' function.]) 110 | 111 | gai_support=yes 112 | 113 | AC_CACHE_CHECK([for getaddrinfo], rdc_cv_func_getaddrinfo, 114 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([ 115 | [#if HAVE_SYS_TYPES_H 116 | # include 117 | #endif 118 | #if HAVE_SYS_SOCKET_H 119 | # include 120 | #elif HAVE_WINSOCK2_H 121 | # include 122 | # include 123 | #endif 124 | #if HAVE_NETDB_H 125 | # include 126 | #endif]], [[getaddrinfo(0,0,0,0);]])], 127 | rdc_cv_func_getaddrinfo=yes, 128 | rdc_cv_func_getaddrinfo=no)]) 129 | AS_IF([test $rdc_cv_func_getaddrinfo = yes], 130 | [AC_DEFINE(HAVE_GETADDRINFO) 131 | 132 | dnl Cannot have getnameinfo if not getaddrinfo 133 | AC_CACHE_CHECK([for getnameinfo], rdc_cv_func_getnameinfo, 134 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([ 135 | [#if HAVE_SYS_TYPES_H 136 | # include 137 | #endif 138 | #if HAVE_SYS_SOCKET_H 139 | # include 140 | #elif HAVE_WINSOCK2_H 141 | # include 142 | # include 143 | #endif 144 | #if HAVE_NETDB_H 145 | # include 146 | #endif]], [[getnameinfo(0,0,0,0,0,0,0);]])], 147 | rdc_cv_func_getnameinfo=yes, 148 | rdc_cv_func_getnameinfo=no)]) 149 | AS_IF([test $rdc_cv_func_getnameinfo = yes], 150 | [AC_DEFINE(HAVE_GETNAMEINFO)], 151 | [gai_support=no]) 152 | 153 | dnl Cannot have gai_strerror if not getaddrinfo 154 | AC_CACHE_CHECK([for gai_strerror], rdc_cv_func_gai_strerror, 155 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([ 156 | [#if HAVE_SYS_TYPES_H 157 | # include 158 | #endif 159 | #if HAVE_SYS_SOCKET_H 160 | # include 161 | #elif HAVE_WINSOCK2_H 162 | # include 163 | # include 164 | #endif 165 | #if HAVE_NETDB_H 166 | # include 167 | #endif]], [[gai_strerror(0);]])], 168 | rdc_cv_func_gai_strerror=yes, 169 | rdc_cv_func_gai_strerror=no)]) 170 | AS_IF([test $rdc_cv_func_gai_strerror = yes], 171 | [AC_DEFINE(HAVE_GAI_STRERROR)], 172 | [gai_support=no]) 173 | ]) 174 | 175 | AC_LIBSOURCES([getaddrinfo.h, getaddrinfo.c])dnl 176 | AS_IF([test $gai_support = no], 177 | [AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) 178 | AC_SEARCH_LIBS(gethostbyaddr, [resolv]) 179 | AC_LIBOBJ(getaddrinfo)]) 180 | ]) 181 | 182 | -------------------------------------------------------------------------------- /po/.gitignore: -------------------------------------------------------------------------------- 1 | *.gmo 2 | *.header 3 | *.sed 4 | *.sin 5 | Makefile.in.in 6 | POTFILES 7 | Rules-quot 8 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | cs 2 | de 3 | en 4 | en_GB 5 | fr 6 | sv 7 | -------------------------------------------------------------------------------- /po/Makevars: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = $(PACKAGE) 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ 12 | 13 | # This is the copyright holder that gets inserted into the header of the 14 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 15 | # package. (Note that the msgstr strings, extracted from the package's 16 | # sources, belong to the copyright holder of the package.) Translators are 17 | # expected to transfer the copyright for their translations to this person 18 | # or entity, or to disclaim their copyright. The empty string stands for 19 | # the public domain; in this case the translators are expected to disclaim 20 | # their copyright. 21 | COPYRIGHT_HOLDER = Rémi Denis-Courmont 22 | 23 | # This is the email address or URL to which the translators shall report 24 | # bugs in the untranslated strings: 25 | # - Strings which are not entire sentences, see the maintainer guidelines 26 | # in the GNU gettext documentation, section 'Preparing Strings'. 27 | # - Strings which use unclear terms or require additional context to be 28 | # understood. 29 | # - Strings which make invalid assumptions about notation of date, time or 30 | # money. 31 | # - Pluralisation problems. 32 | # - Incorrect English spelling. 33 | # - Incorrect formatting. 34 | # It can be your email address, or a mailing list address where translators 35 | # can write to without being subscribed, or the URL of a web page through 36 | # which the translators can contact you. 37 | MSGID_BUGS_ADDRESS = remi@remlab.net 38 | 39 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 40 | # message catalogs shall be used. It is usually empty. 41 | EXTRA_LOCALE_CATEGORIES = 42 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | rdnss/rdnssd.c 2 | src/addrinfo.c 3 | src/ndisc.c 4 | src/tcpspray.c 5 | src/tcptraceroute.c 6 | src/traceroute.c 7 | -------------------------------------------------------------------------------- /po/en.po: -------------------------------------------------------------------------------- 1 | # English localization for ndisc6. 2 | # Copyright © 2007 Rémi Denis-Courmont 3 | # This file is distributed under the same license as the ndisc6 package. 4 | # Rémi Denis-Courmont, 2007. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: ndisc6 0.9.4\n" 9 | "Report-Msgid-Bugs-To: remi@remlab.net\n" 10 | "POT-Creation-Date: 2014-12-14 12:44+0200\n" 11 | "PO-Revision-Date: 2007-12-27 19:14+0200\n" 12 | "Last-Translator: Rémi Denis-Courmont\n" 13 | "Language-Team: English \n" 14 | "Language: en\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: rdnssd/rdnssd.c:100 rdnssd/rdnssd.c:131 21 | #, c-format 22 | msgid "Cannot write %s: %m" 23 | msgstr "" 24 | 25 | #: rdnssd/rdnssd.c:420 26 | #, c-format 27 | msgid "Cannot find user \"%s\"" 28 | msgstr "Cannot find user “%s”" 29 | 30 | #: rdnssd/rdnssd.c:425 rdnssd/rdnssd.c:430 rdnssd/rdnssd.c:435 31 | #: rdnssd/rdnssd.c:525 rdnssd/rdnssd.c:609 rdnssd/rdnssd.c:648 32 | #, c-format 33 | msgid "Fatal error (%s): %m" 34 | msgstr "" 35 | 36 | #: rdnssd/rdnssd.c:552 rdnssd/rdnssd.c:556 37 | #, c-format 38 | msgid "Cannot run \"%s\": %m" 39 | msgstr "Cannot run “%s”: %m" 40 | 41 | #: rdnssd/rdnssd.c:588 42 | msgid "Child process hung up unexpectedly, aborting" 43 | msgstr "" 44 | 45 | #: rdnssd/rdnssd.c:712 src/addrinfo.c:143 src/ndisc.c:858 src/tcpspray.c:269 46 | #: src/tcptraceroute.c:41 src/traceroute.c:1206 47 | #, c-format 48 | msgid "Try \"%s -h\" for more information.\n" 49 | msgstr "Try “%s -h” for more information.\n" 50 | 51 | #: rdnssd/rdnssd.c:722 52 | #, c-format 53 | msgid "" 54 | "Usage: %s [OPTIONS]\n" 55 | "Starts the IPv6 Recursive DNS Server discovery Daemon.\n" 56 | "\n" 57 | " -f, --foreground run in the foreground\n" 58 | " -H, --merge-hook execute this hook whenever resolv.conf is updated\n" 59 | " -h, --help display this help and exit\n" 60 | " -p, --pidfile override the location of the PID file\n" 61 | " -r, --resolv-file set the path to the generated resolv.conf file\n" 62 | " -u, --user override the user to set UID to\n" 63 | " -V, --version display program version and exit\n" 64 | msgstr "" 65 | 66 | #: rdnssd/rdnssd.c:739 67 | #, c-format 68 | msgid "rdnssd: IPv6 Recursive DNS Server discovery Daemon %s (%s)\n" 69 | msgstr "" 70 | 71 | #: rdnssd/rdnssd.c:741 src/addrinfo.c:151 src/ndisc.c:890 src/tcpspray.c:305 72 | #: src/traceroute.c:1253 73 | #, c-format 74 | msgid " built %s on %s\n" 75 | msgstr "" 76 | 77 | #: rdnssd/rdnssd.c:742 src/addrinfo.c:152 src/ndisc.c:892 src/tcpspray.c:306 78 | #: src/traceroute.c:1254 79 | #, c-format 80 | msgid "Configured with: %s\n" 81 | msgstr "" 82 | 83 | #: rdnssd/rdnssd.c:743 84 | msgid "Written by Pierre Ynard and Remi Denis-Courmont\n" 85 | msgstr "Written by Pierre Ynard and Rémi Denis-Courmont\n" 86 | 87 | #: rdnssd/rdnssd.c:745 88 | #, c-format 89 | msgid "Copyright (C) %u-%u Pierre Ynard, Remi Denis-Courmont\n" 90 | msgstr "Copyright © %u-%u Pierre Ynard, Rémi Denis-Courmont\n" 91 | 92 | #: rdnssd/rdnssd.c:748 src/addrinfo.c:156 src/ndisc.c:896 src/tcpspray.c:310 93 | #: src/traceroute.c:1258 94 | msgid "" 95 | "This is free software; see the source for copying conditions.\n" 96 | "There is NO warranty; not even for MERCHANTABILITY or\n" 97 | "FITNESS FOR A PARTICULAR PURPOSE.\n" 98 | msgstr "" 99 | 100 | #: rdnssd/rdnssd.c:861 101 | #, c-format 102 | msgid "Cannot create %s (%m) - already running?" 103 | msgstr "" 104 | 105 | #: src/addrinfo.c:115 106 | msgid "Input error" 107 | msgstr "" 108 | 109 | #: src/addrinfo.c:126 110 | #, c-format 111 | msgid "" 112 | "Usage: %s [-4|-6] [hostnames]\n" 113 | "Converts names to addresses.\n" 114 | "\n" 115 | " -4, --ipv4 only lookup IPv4 addresses\n" 116 | " -6, --ipv6 only lookup IPv6 addresses\n" 117 | " -c, --config only return addresses for locally configured protocols\n" 118 | " -h, --help display this help and exit\n" 119 | " -m, --multiple print multiple results separated by spaces\n" 120 | " -n, --numeric do not perform forward hostname lookup\n" 121 | " -r, --reverse perform reverse address to hostname lookup\n" 122 | " -V, --version display program version and exit\n" 123 | msgstr "" 124 | 125 | #: src/addrinfo.c:150 126 | #, c-format 127 | msgid "addrinfo %s (%s)\n" 128 | msgstr "" 129 | 130 | #: src/addrinfo.c:153 src/ndisc.c:893 src/tcpspray.c:307 src/traceroute.c:1255 131 | msgid "Written by Remi Denis-Courmont\n" 132 | msgstr "Written by Rémi Denis-Courmont\n" 133 | 134 | #: src/addrinfo.c:155 src/ndisc.c:895 src/tcpspray.c:309 src/traceroute.c:1257 135 | #, c-format 136 | msgid "Copyright (C) %u-%u Remi Denis-Courmont\n" 137 | msgstr "Copyright © %u-%u Rémi Denis-Courmont\n" 138 | 139 | #: src/ndisc.c:102 src/traceroute.c:946 140 | #, c-format 141 | msgid "%s: %s\n" 142 | msgstr "" 143 | 144 | #: src/ndisc.c:218 145 | #, c-format 146 | msgid "" 147 | "Usage: %s [options] \n" 148 | "Looks up an on-link IPv6 node link-layer address (Neighbor Discovery)\n" 149 | msgstr "" 150 | 151 | #: src/ndisc.c:220 152 | msgid "link-layer address" 153 | msgstr "" 154 | 155 | #: src/ndisc.c:299 156 | msgid "Target link-layer address: " 157 | msgstr "" 158 | 159 | #: src/ndisc.c:312 160 | #, c-format 161 | msgid "" 162 | "Usage: %s [options] [IPv6 address] \n" 163 | "Solicits on-link IPv6 routers (Router Discovery)\n" 164 | msgstr "" 165 | 166 | #: src/ndisc.c:314 167 | msgid "advertized prefixes" 168 | msgstr "" 169 | 170 | #: src/ndisc.c:339 171 | msgid " infinite (0xffffffff)\n" 172 | msgstr "" 173 | 174 | #: src/ndisc.c:341 src/ndisc.c:543 src/ndisc.c:550 src/ndisc.c:559 175 | #, c-format 176 | msgid "%12u (0x%08x) %s\n" 177 | msgstr "" 178 | 179 | #: src/ndisc.c:342 src/ndisc.c:544 src/tcpspray.c:119 180 | msgid "second" 181 | msgid_plural "seconds" 182 | msgstr[0] "" 183 | msgstr[1] "" 184 | 185 | #: src/ndisc.c:360 186 | msgid " Prefix : " 187 | msgstr "" 188 | 189 | #: src/ndisc.c:367 190 | #, c-format 191 | msgid " On-link : %3s\n" 192 | msgstr "" 193 | 194 | #: src/ndisc.c:368 src/ndisc.c:370 src/ndisc.c:531 src/ndisc.c:533 195 | #: src/ndisc.c:535 src/ndisc.c:538 196 | msgid "Yes" 197 | msgstr "" 198 | 199 | #: src/ndisc.c:368 src/ndisc.c:370 src/ndisc.c:531 src/ndisc.c:533 200 | #: src/ndisc.c:535 src/ndisc.c:538 201 | msgid "No" 202 | msgstr "" 203 | 204 | #: src/ndisc.c:369 205 | #, c-format 206 | msgid " Autonomous address conf.: %3s\n" 207 | msgstr "" 208 | 209 | #: src/ndisc.c:372 210 | msgid " Valid time : " 211 | msgstr "" 212 | 213 | #: src/ndisc.c:374 214 | msgid " Pref. time : " 215 | msgstr "" 216 | 217 | #: src/ndisc.c:386 218 | msgid " MTU : " 219 | msgstr "" 220 | 221 | #: src/ndisc.c:388 src/tcpspray.c:118 src/tcpspray.c:154 src/tcpspray.c:155 222 | #: src/tcpspray.c:163 src/tcpspray.c:164 223 | msgid "byte" 224 | msgid_plural "bytes" 225 | msgstr[0] "" 226 | msgstr[1] "" 227 | 228 | #: src/ndisc.c:389 229 | msgid "valid" 230 | msgstr "" 231 | 232 | #: src/ndisc.c:389 233 | msgid "invalid" 234 | msgstr "" 235 | 236 | #: src/ndisc.c:397 237 | msgid "medium" 238 | msgstr "" 239 | 240 | #: src/ndisc.c:397 241 | msgid "high" 242 | msgstr "" 243 | 244 | #: src/ndisc.c:397 245 | msgid "medium (invalid)" 246 | msgstr "" 247 | 248 | #: src/ndisc.c:397 249 | msgid "low" 250 | msgstr "" 251 | 252 | #: src/ndisc.c:415 253 | #, c-format 254 | msgid " Route : %s/%\n" 255 | msgstr "" 256 | 257 | #: src/ndisc.c:416 258 | #, c-format 259 | msgid " Route preference : %6s\n" 260 | msgstr "" 261 | 262 | #: src/ndisc.c:417 263 | msgid " Route lifetime : " 264 | msgstr "" 265 | 266 | #: src/ndisc.c:439 267 | #, c-format 268 | msgid " Recursive DNS server : %s\n" 269 | msgstr "" 270 | 271 | #: src/ndisc.c:442 272 | msgid " DNS server lifetime : " 273 | msgid_plural " DNS servers lifetime : " 274 | msgstr[0] "" 275 | msgstr[1] "" 276 | 277 | #: src/ndisc.c:457 278 | #, c-format 279 | msgid " DNS search list : " 280 | msgstr "" 281 | 282 | #: src/ndisc.c:493 283 | msgid " DNS search list lifetime: " 284 | msgstr "" 285 | 286 | #: src/ndisc.c:521 287 | msgid "Hop limit : " 288 | msgstr "" 289 | 290 | #: src/ndisc.c:524 291 | #, c-format 292 | msgid " %3u" 293 | msgstr "" 294 | 295 | #: src/ndisc.c:526 296 | msgid "undefined" 297 | msgstr "" 298 | 299 | #: src/ndisc.c:527 300 | #, c-format 301 | msgid " ( 0x%02x)\n" 302 | msgstr "" 303 | 304 | #: src/ndisc.c:530 305 | #, c-format 306 | msgid "Stateful address conf. : %3s\n" 307 | msgstr "" 308 | 309 | #: src/ndisc.c:532 310 | #, c-format 311 | msgid "Stateful other conf. : %3s\n" 312 | msgstr "" 313 | 314 | #: src/ndisc.c:534 315 | #, c-format 316 | msgid "Mobile home agent : %3s\n" 317 | msgstr "" 318 | 319 | #: src/ndisc.c:536 320 | #, c-format 321 | msgid "Router preference : %6s\n" 322 | msgstr "" 323 | 324 | #: src/ndisc.c:537 325 | #, c-format 326 | msgid "Neighbor discovery proxy : %3s\n" 327 | msgstr "" 328 | 329 | #: src/ndisc.c:541 330 | msgid "Router lifetime : " 331 | msgstr "" 332 | 333 | #: src/ndisc.c:547 334 | msgid "Reachable time : " 335 | msgstr "" 336 | 337 | #: src/ndisc.c:551 src/ndisc.c:560 338 | msgid "millisecond" 339 | msgid_plural "milliseconds" 340 | msgstr[0] "" 341 | msgstr[1] "" 342 | 343 | #: src/ndisc.c:553 src/ndisc.c:562 344 | msgid " unspecified (0x00000000)\n" 345 | msgstr "" 346 | 347 | #: src/ndisc.c:556 348 | msgid "Retransmit time : " 349 | msgstr "" 350 | 351 | #: src/ndisc.c:585 352 | msgid " Source link-layer address: " 353 | msgstr "" 354 | 355 | #: src/ndisc.c:724 356 | msgid "Receiving ICMPv6 packet" 357 | msgstr "" 358 | 359 | #: src/ndisc.c:741 360 | #, c-format 361 | msgid " from %s\n" 362 | msgstr "" 363 | 364 | #: src/ndisc.c:766 src/traceroute.c:921 src/traceroute.c:929 365 | msgid "Raw IPv6 socket" 366 | msgstr "" 367 | 368 | #: src/ndisc.c:801 369 | #, c-format 370 | msgid "Soliciting %s (%s) on %s...\n" 371 | msgstr "" 372 | 373 | #: src/ndisc.c:821 374 | msgid "Sending ICMPv6 packet" 375 | msgstr "" 376 | 377 | #: src/ndisc.c:837 378 | msgid "Timed out." 379 | msgstr "" 380 | 381 | #: src/ndisc.c:846 382 | msgid "No response." 383 | msgstr "" 384 | 385 | #: src/ndisc.c:868 386 | #, c-format 387 | msgid "" 388 | "\n" 389 | " -1, --single display first response and exit\n" 390 | " -h, --help display this help and exit\n" 391 | " -m, --multiple wait and display all responses\n" 392 | " -n, --numeric don't resolve host names\n" 393 | " -q, --quiet only print the %s (mainly for scripts)\n" 394 | " -r, --retry maximum number of attempts (default: 3)\n" 395 | " -s, --source specify source IPv6 address\n" 396 | " -V, --version display program version and exit\n" 397 | " -v, --verbose verbose display (this is the default)\n" 398 | " -w, --wait how long to wait for a response [ms] (default: 1000)\n" 399 | "\n" 400 | msgstr "" 401 | "\n" 402 | " -1, --single display first response and exit\n" 403 | " -h, --help display this help and exit\n" 404 | " -m, --multiple wait and display all responses\n" 405 | " -n, --numeric don’t resolve host names\n" 406 | " -q, --quiet only print the %s (mainly for scripts)\n" 407 | " -r, --retry maximum number of attempts (default: 3)\n" 408 | " -s, --source specify source IPv6 address\n" 409 | " -V, --version display program version and exit\n" 410 | " -v, --verbose verbose display (this is the default)\n" 411 | " -w, --wait how long to wait for a response [ms] (default: 1000)\n" 412 | "\n" 413 | 414 | #: src/ndisc.c:889 415 | #, c-format 416 | msgid "ndisc6: IPv6 Neighbor/Router Discovery userland tool %s (%s)\n" 417 | msgstr "" 418 | 419 | #: src/tcpspray.c:73 src/tcpspray.c:94 420 | #, c-format 421 | msgid "%s port %s: %s\n" 422 | msgstr "" 423 | 424 | #: src/tcpspray.c:117 425 | #, c-format 426 | msgid "%s %lu %s in %f %s" 427 | msgstr "" 428 | 429 | #: src/tcpspray.c:121 430 | #, c-format 431 | msgid " (%0.3f kbytes/s)" 432 | msgstr "" 433 | 434 | #: src/tcpspray.c:152 435 | #, c-format 436 | msgid "Warning: \"%s\" is too small (%zu %s) to fill block of %zu %s.\n" 437 | msgstr "Warning: “%s” is too small (%zu %s) to fill block of %zu %s.\n" 438 | 439 | #: src/tcpspray.c:162 440 | #, c-format 441 | msgid "Sending %ju %s with blocksize %zu %s\n" 442 | msgstr "" 443 | 444 | #: src/tcpspray.c:179 src/traceroute.c:497 445 | #, c-format 446 | msgid "Receive error: %s\n" 447 | msgstr "" 448 | 449 | #: src/tcpspray.c:181 src/tcpspray.c:217 450 | msgid "Connection closed by peer" 451 | msgstr "" 452 | 453 | #: src/tcpspray.c:215 src/traceroute.c:1112 454 | #, c-format 455 | msgid "Cannot send data: %s\n" 456 | msgstr "" 457 | 458 | #: src/tcpspray.c:239 459 | #, c-format 460 | msgid "Child process returned an error" 461 | msgstr "" 462 | 463 | #: src/tcpspray.c:246 464 | msgid "Received" 465 | msgstr "" 466 | 467 | #: src/tcpspray.c:250 468 | msgid "Transmitted" 469 | msgstr "" 470 | 471 | #: src/tcpspray.c:278 472 | #, c-format 473 | msgid "" 474 | "Usage: %s [options] [service/port number]\n" 475 | "Use the discard TCP service at the specified host\n" 476 | "(the default host is the local system, the default service is discard)\n" 477 | msgstr "" 478 | 479 | #: src/tcpspray.c:283 480 | msgid "" 481 | "\n" 482 | " -4 force usage of the IPv4 protocols family\n" 483 | " -6 force usage of the IPv6 protocols family\n" 484 | " -b specify the block bytes size (default: 1024)\n" 485 | " -d wait for given delay (usec) between each block (default: 0)\n" 486 | " -e perform a duplex test (TCP Echo instead of TCP Discard)\n" 487 | " -f fill sent data blocks with the specified file content\n" 488 | " -h display this help and exit\n" 489 | " -n specify the number of blocks to send (default: 100)\n" 490 | " -V display program version and exit\n" 491 | " -v enable verbose output\n" 492 | msgstr "" 493 | "\n" 494 | " -4 force usage of the IPv4 protocols family\n" 495 | " -6 force usage of the IPv6 protocols family\n" 496 | " -b specify the block bytes size (default: 1024)\n" 497 | " -d wait for given delay (µsec) between each block (default: 0)\n" 498 | " -e perform a duplex test (TCP Echo instead of TCP Discard)\n" 499 | " -f fill sent data blocks with the specified file content\n" 500 | " -h display this help and exit\n" 501 | " -n specify the number of blocks to send (default: 100)\n" 502 | " -V display program version and exit\n" 503 | " -v enable verbose output\n" 504 | 505 | #: src/tcpspray.c:304 506 | #, c-format 507 | msgid "tcpspray6: TCP/IP bandwidth tester %s (%s)\n" 508 | msgstr "" 509 | 510 | #: src/tcptraceroute.c:50 src/traceroute.c:1215 511 | #, c-format 512 | msgid "" 513 | "Usage: %s [options] [%s]\n" 514 | "Print IPv6 network route to a host\n" 515 | msgstr "" 516 | 517 | #: src/tcptraceroute.c:51 518 | msgid "port number" 519 | msgstr "" 520 | 521 | #: src/tcptraceroute.c:53 522 | msgid "" 523 | "\n" 524 | " -A send TCP ACK probes\n" 525 | " -d enable socket debugging\n" 526 | " -E set TCP Explicit Congestion Notification bits in probe packets\n" 527 | " -f specify the initial hop limit (default: 1)\n" 528 | " -g insert a route segment within a \"Type 0\" routing header\n" 529 | " -h display this help and exit\n" 530 | " -i force outgoing network interface\n" 531 | " -l set probes byte size\n" 532 | " -m set the maximum hop limit (default: 30)\n" 533 | " -N perform reverse name lookups on the addresses of every hop\n" 534 | " -n don't perform reverse name lookup on addresses\n" 535 | " -p override source TCP port\n" 536 | " -q override the number of probes per hop (default: 3)\n" 537 | " -r do not route packets\n" 538 | " -S send TCP SYN probes (default)\n" 539 | " -s specify the source IPv6 address of probe packets\n" 540 | " -t set traffic class of probe packets\n" 541 | " -V, --version display program version and exit\n" 542 | " -w override the timeout for response in seconds (default: 5)\n" 543 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 544 | msgstr "" 545 | "\n" 546 | " -A send TCP ACK probes\n" 547 | " -d enable socket debugging\n" 548 | " -E set TCP Explicit Congestion Notification bits in probe packets\n" 549 | " -f specify the initial hop limit (default: 1)\n" 550 | " -g insert a route segment within a “Type 0” routing header\n" 551 | " -h display this help and exit\n" 552 | " -i force outgoing network interface\n" 553 | " -l set probes byte size\n" 554 | " -m set the maximum hop limit (default: 30)\n" 555 | " -N perform reverse name lookups on the addresses of every hop\n" 556 | " -n don’t perform reverse name lookup on addresses\n" 557 | " -p override source TCP port\n" 558 | " -q override the number of probes per hop (default: 3)\n" 559 | " -r do not route packets\n" 560 | " -S send TCP SYN probes (default)\n" 561 | " -s specify the source IPv6 address of probe packets\n" 562 | " -t set traffic class of probe packets\n" 563 | " -V, --version display program version and exit\n" 564 | " -w override the timeout for response in seconds (default: 5)\n" 565 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 566 | 567 | #: src/traceroute.c:620 568 | #, c-format 569 | msgid " %u.%03u ms " 570 | msgstr "" 571 | 572 | #: src/traceroute.c:661 573 | msgid "[closed] " 574 | msgstr "" 575 | 576 | #: src/traceroute.c:665 577 | msgid "[open] " 578 | msgstr "" 579 | 580 | #: src/traceroute.c:723 581 | #, c-format 582 | msgid "%s%s%s%s: %s\n" 583 | msgstr "" 584 | 585 | #: src/traceroute.c:724 586 | msgid "port " 587 | msgstr "" 588 | 589 | #: src/traceroute.c:784 590 | #, c-format 591 | msgid "traceroute to %s (%s) " 592 | msgstr "" 593 | 594 | #: src/traceroute.c:789 595 | #, c-format 596 | msgid "from %s, " 597 | msgstr "" 598 | 599 | #: src/traceroute.c:793 600 | #, c-format 601 | msgid "port %u, from port %u, " 602 | msgstr "" 603 | 604 | #: src/traceroute.c:1010 605 | #, c-format 606 | msgid "%u hop max, " 607 | msgid_plural "%u hops max, " 608 | msgstr[0] "" 609 | msgstr[1] "" 610 | 611 | #: src/traceroute.c:1061 612 | #, c-format 613 | msgid "%zu byte packets\n" 614 | msgid_plural "%zu bytes packets\n" 615 | msgstr[0] "" 616 | msgstr[1] "" 617 | 618 | #: src/traceroute.c:1089 src/traceroute.c:1163 619 | #, c-format 620 | msgid " %3u%% completed..." 621 | msgstr "" 622 | 623 | #: src/traceroute.c:1179 624 | msgid " " 625 | msgstr "" 626 | 627 | #: src/traceroute.c:1216 628 | msgid "packet length" 629 | msgstr "" 630 | 631 | #: src/traceroute.c:1218 632 | msgid "" 633 | "\n" 634 | " -A send TCP ACK probes\n" 635 | " -d enable socket debugging\n" 636 | " -E set TCP Explicit Congestion Notification bits in TCP packets\n" 637 | " -f specify the initial hop limit (default: 1)\n" 638 | " -g insert a route segment within a \"Type 0\" routing header\n" 639 | " -h display this help and exit\n" 640 | " -I use ICMPv6 Echo Request packets as probes\n" 641 | " -i force outgoing network interface\n" 642 | " -l display incoming packets hop limit\n" 643 | " -m set the maximum hop limit (default: 30)\n" 644 | " -N perform reverse name lookups on the addresses of every hop\n" 645 | " -n don't perform reverse name lookup on addresses\n" 646 | " -p override destination port\n" 647 | " -q override the number of probes per hop (default: 3)\n" 648 | " -r do not route packets\n" 649 | " -S send TCP SYN probes\n" 650 | " -s specify the source IPv6 address of probe packets\n" 651 | " -t set traffic class of probe packets\n" 652 | " -U send UDP probes (default)\n" 653 | " -V display program version and exit\n" 654 | " -w override the timeout for response in seconds (default: 5)\n" 655 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 656 | msgstr "" 657 | "\n" 658 | " -A send TCP ACK probes\n" 659 | " -d enable socket debugging\n" 660 | " -E set TCP Explicit Congestion Notification bits in TCP packets\n" 661 | " -f specify the initial hop limit (default: 1)\n" 662 | " -g insert a route segment within a “Type 0” routing header\n" 663 | " -h display this help and exit\n" 664 | " -I use ICMPv6 Echo Request packets as probes\n" 665 | " -i force outgoing network interface\n" 666 | " -l display incoming packets hop limit\n" 667 | " -m set the maximum hop limit (default: 30)\n" 668 | " -N perform reverse name lookups on the addresses of every hop\n" 669 | " -n don’t perform reverse name lookup on addresses\n" 670 | " -p override destination port\n" 671 | " -q override the number of probes per hop (default: 3)\n" 672 | " -r do not route packets\n" 673 | " -S send TCP SYN probes\n" 674 | " -s specify the source IPv6 address of probe packets\n" 675 | " -t set traffic class of probe packets\n" 676 | " -U send UDP probes (default)\n" 677 | " -V display program version and exit\n" 678 | " -w override the timeout for response in seconds (default: 5)\n" 679 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 680 | 681 | #: src/traceroute.c:1252 682 | #, c-format 683 | msgid "traceroute6: TCP & UDP IPv6 traceroute tool %s (%s)\n" 684 | msgstr "" 685 | 686 | #: src/traceroute.c:1272 687 | #, c-format 688 | msgid "%s: invalid hop limit\n" 689 | msgstr "" 690 | 691 | #: src/traceroute.c:1286 692 | #, c-format 693 | msgid "%s: invalid packet length\n" 694 | msgstr "" 695 | -------------------------------------------------------------------------------- /po/ndisc6.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Rémi Denis-Courmont 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: ndisc6 1.0.3\n" 10 | "Report-Msgid-Bugs-To: remi@remlab.net\n" 11 | "POT-Creation-Date: 2014-12-14 12:44+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 20 | 21 | #: rdnssd/rdnssd.c:100 rdnssd/rdnssd.c:131 22 | #, c-format 23 | msgid "Cannot write %s: %m" 24 | msgstr "" 25 | 26 | #: rdnssd/rdnssd.c:420 27 | #, c-format 28 | msgid "Cannot find user \"%s\"" 29 | msgstr "" 30 | 31 | #: rdnssd/rdnssd.c:425 rdnssd/rdnssd.c:430 rdnssd/rdnssd.c:435 32 | #: rdnssd/rdnssd.c:525 rdnssd/rdnssd.c:609 rdnssd/rdnssd.c:648 33 | #, c-format 34 | msgid "Fatal error (%s): %m" 35 | msgstr "" 36 | 37 | #: rdnssd/rdnssd.c:552 rdnssd/rdnssd.c:556 38 | #, c-format 39 | msgid "Cannot run \"%s\": %m" 40 | msgstr "" 41 | 42 | #: rdnssd/rdnssd.c:588 43 | msgid "Child process hung up unexpectedly, aborting" 44 | msgstr "" 45 | 46 | #: rdnssd/rdnssd.c:712 src/addrinfo.c:143 src/ndisc.c:858 src/tcpspray.c:269 47 | #: src/tcptraceroute.c:41 src/traceroute.c:1206 48 | #, c-format 49 | msgid "Try \"%s -h\" for more information.\n" 50 | msgstr "" 51 | 52 | #: rdnssd/rdnssd.c:722 53 | #, c-format 54 | msgid "" 55 | "Usage: %s [OPTIONS]\n" 56 | "Starts the IPv6 Recursive DNS Server discovery Daemon.\n" 57 | "\n" 58 | " -f, --foreground run in the foreground\n" 59 | " -H, --merge-hook execute this hook whenever resolv.conf is updated\n" 60 | " -h, --help display this help and exit\n" 61 | " -p, --pidfile override the location of the PID file\n" 62 | " -r, --resolv-file set the path to the generated resolv.conf file\n" 63 | " -u, --user override the user to set UID to\n" 64 | " -V, --version display program version and exit\n" 65 | msgstr "" 66 | 67 | #: rdnssd/rdnssd.c:739 68 | #, c-format 69 | msgid "rdnssd: IPv6 Recursive DNS Server discovery Daemon %s (%s)\n" 70 | msgstr "" 71 | 72 | #: rdnssd/rdnssd.c:741 src/addrinfo.c:151 src/ndisc.c:890 src/tcpspray.c:305 73 | #: src/traceroute.c:1253 74 | #, c-format 75 | msgid " built %s on %s\n" 76 | msgstr "" 77 | 78 | #: rdnssd/rdnssd.c:742 src/addrinfo.c:152 src/ndisc.c:892 src/tcpspray.c:306 79 | #: src/traceroute.c:1254 80 | #, c-format 81 | msgid "Configured with: %s\n" 82 | msgstr "" 83 | 84 | #: rdnssd/rdnssd.c:743 85 | msgid "Written by Pierre Ynard and Remi Denis-Courmont\n" 86 | msgstr "" 87 | 88 | #: rdnssd/rdnssd.c:745 89 | #, c-format 90 | msgid "Copyright (C) %u-%u Pierre Ynard, Remi Denis-Courmont\n" 91 | msgstr "" 92 | 93 | #: rdnssd/rdnssd.c:748 src/addrinfo.c:156 src/ndisc.c:896 src/tcpspray.c:310 94 | #: src/traceroute.c:1258 95 | msgid "" 96 | "This is free software; see the source for copying conditions.\n" 97 | "There is NO warranty; not even for MERCHANTABILITY or\n" 98 | "FITNESS FOR A PARTICULAR PURPOSE.\n" 99 | msgstr "" 100 | 101 | #: rdnssd/rdnssd.c:861 102 | #, c-format 103 | msgid "Cannot create %s (%m) - already running?" 104 | msgstr "" 105 | 106 | #: src/addrinfo.c:115 107 | msgid "Input error" 108 | msgstr "" 109 | 110 | #: src/addrinfo.c:126 111 | #, c-format 112 | msgid "" 113 | "Usage: %s [-4|-6] [hostnames]\n" 114 | "Converts names to addresses.\n" 115 | "\n" 116 | " -4, --ipv4 only lookup IPv4 addresses\n" 117 | " -6, --ipv6 only lookup IPv6 addresses\n" 118 | " -c, --config only return addresses for locally configured protocols\n" 119 | " -h, --help display this help and exit\n" 120 | " -m, --multiple print multiple results separated by spaces\n" 121 | " -n, --numeric do not perform forward hostname lookup\n" 122 | " -r, --reverse perform reverse address to hostname lookup\n" 123 | " -V, --version display program version and exit\n" 124 | msgstr "" 125 | 126 | #: src/addrinfo.c:150 127 | #, c-format 128 | msgid "addrinfo %s (%s)\n" 129 | msgstr "" 130 | 131 | #: src/addrinfo.c:153 src/ndisc.c:893 src/tcpspray.c:307 src/traceroute.c:1255 132 | msgid "Written by Remi Denis-Courmont\n" 133 | msgstr "" 134 | 135 | #: src/addrinfo.c:155 src/ndisc.c:895 src/tcpspray.c:309 src/traceroute.c:1257 136 | #, c-format 137 | msgid "Copyright (C) %u-%u Remi Denis-Courmont\n" 138 | msgstr "" 139 | 140 | #: src/ndisc.c:102 src/traceroute.c:946 141 | #, c-format 142 | msgid "%s: %s\n" 143 | msgstr "" 144 | 145 | #: src/ndisc.c:218 146 | #, c-format 147 | msgid "" 148 | "Usage: %s [options] \n" 149 | "Looks up an on-link IPv6 node link-layer address (Neighbor Discovery)\n" 150 | msgstr "" 151 | 152 | #: src/ndisc.c:220 153 | msgid "link-layer address" 154 | msgstr "" 155 | 156 | #: src/ndisc.c:299 157 | msgid "Target link-layer address: " 158 | msgstr "" 159 | 160 | #: src/ndisc.c:312 161 | #, c-format 162 | msgid "" 163 | "Usage: %s [options] [IPv6 address] \n" 164 | "Solicits on-link IPv6 routers (Router Discovery)\n" 165 | msgstr "" 166 | 167 | #: src/ndisc.c:314 168 | msgid "advertized prefixes" 169 | msgstr "" 170 | 171 | #: src/ndisc.c:339 172 | msgid " infinite (0xffffffff)\n" 173 | msgstr "" 174 | 175 | #: src/ndisc.c:341 src/ndisc.c:543 src/ndisc.c:550 src/ndisc.c:559 176 | #, c-format 177 | msgid "%12u (0x%08x) %s\n" 178 | msgstr "" 179 | 180 | #: src/ndisc.c:342 src/ndisc.c:544 src/tcpspray.c:119 181 | msgid "second" 182 | msgid_plural "seconds" 183 | msgstr[0] "" 184 | msgstr[1] "" 185 | 186 | #: src/ndisc.c:360 187 | msgid " Prefix : " 188 | msgstr "" 189 | 190 | #: src/ndisc.c:367 191 | #, c-format 192 | msgid " On-link : %3s\n" 193 | msgstr "" 194 | 195 | #: src/ndisc.c:368 src/ndisc.c:370 src/ndisc.c:531 src/ndisc.c:533 196 | #: src/ndisc.c:535 src/ndisc.c:538 197 | msgid "Yes" 198 | msgstr "" 199 | 200 | #: src/ndisc.c:368 src/ndisc.c:370 src/ndisc.c:531 src/ndisc.c:533 201 | #: src/ndisc.c:535 src/ndisc.c:538 202 | msgid "No" 203 | msgstr "" 204 | 205 | #: src/ndisc.c:369 206 | #, c-format 207 | msgid " Autonomous address conf.: %3s\n" 208 | msgstr "" 209 | 210 | #: src/ndisc.c:372 211 | msgid " Valid time : " 212 | msgstr "" 213 | 214 | #: src/ndisc.c:374 215 | msgid " Pref. time : " 216 | msgstr "" 217 | 218 | #: src/ndisc.c:386 219 | msgid " MTU : " 220 | msgstr "" 221 | 222 | #: src/ndisc.c:388 src/tcpspray.c:118 src/tcpspray.c:154 src/tcpspray.c:155 223 | #: src/tcpspray.c:163 src/tcpspray.c:164 224 | msgid "byte" 225 | msgid_plural "bytes" 226 | msgstr[0] "" 227 | msgstr[1] "" 228 | 229 | #: src/ndisc.c:389 230 | msgid "valid" 231 | msgstr "" 232 | 233 | #: src/ndisc.c:389 234 | msgid "invalid" 235 | msgstr "" 236 | 237 | #: src/ndisc.c:397 238 | msgid "medium" 239 | msgstr "" 240 | 241 | #: src/ndisc.c:397 242 | msgid "high" 243 | msgstr "" 244 | 245 | #: src/ndisc.c:397 246 | msgid "medium (invalid)" 247 | msgstr "" 248 | 249 | #: src/ndisc.c:397 250 | msgid "low" 251 | msgstr "" 252 | 253 | #: src/ndisc.c:415 254 | #, c-format 255 | msgid " Route : %s/%\n" 256 | msgstr "" 257 | 258 | #: src/ndisc.c:416 259 | #, c-format 260 | msgid " Route preference : %6s\n" 261 | msgstr "" 262 | 263 | #: src/ndisc.c:417 264 | msgid " Route lifetime : " 265 | msgstr "" 266 | 267 | #: src/ndisc.c:439 268 | #, c-format 269 | msgid " Recursive DNS server : %s\n" 270 | msgstr "" 271 | 272 | #: src/ndisc.c:442 273 | msgid " DNS server lifetime : " 274 | msgid_plural " DNS servers lifetime : " 275 | msgstr[0] "" 276 | msgstr[1] "" 277 | 278 | #: src/ndisc.c:457 279 | #, c-format 280 | msgid " DNS search list : " 281 | msgstr "" 282 | 283 | #: src/ndisc.c:493 284 | msgid " DNS search list lifetime: " 285 | msgstr "" 286 | 287 | #: src/ndisc.c:521 288 | msgid "Hop limit : " 289 | msgstr "" 290 | 291 | #: src/ndisc.c:524 292 | #, c-format 293 | msgid " %3u" 294 | msgstr "" 295 | 296 | #: src/ndisc.c:526 297 | msgid "undefined" 298 | msgstr "" 299 | 300 | #: src/ndisc.c:527 301 | #, c-format 302 | msgid " ( 0x%02x)\n" 303 | msgstr "" 304 | 305 | #: src/ndisc.c:530 306 | #, c-format 307 | msgid "Stateful address conf. : %3s\n" 308 | msgstr "" 309 | 310 | #: src/ndisc.c:532 311 | #, c-format 312 | msgid "Stateful other conf. : %3s\n" 313 | msgstr "" 314 | 315 | #: src/ndisc.c:534 316 | #, c-format 317 | msgid "Mobile home agent : %3s\n" 318 | msgstr "" 319 | 320 | #: src/ndisc.c:536 321 | #, c-format 322 | msgid "Router preference : %6s\n" 323 | msgstr "" 324 | 325 | #: src/ndisc.c:537 326 | #, c-format 327 | msgid "Neighbor discovery proxy : %3s\n" 328 | msgstr "" 329 | 330 | #: src/ndisc.c:541 331 | msgid "Router lifetime : " 332 | msgstr "" 333 | 334 | #: src/ndisc.c:547 335 | msgid "Reachable time : " 336 | msgstr "" 337 | 338 | #: src/ndisc.c:551 src/ndisc.c:560 339 | msgid "millisecond" 340 | msgid_plural "milliseconds" 341 | msgstr[0] "" 342 | msgstr[1] "" 343 | 344 | #: src/ndisc.c:553 src/ndisc.c:562 345 | msgid " unspecified (0x00000000)\n" 346 | msgstr "" 347 | 348 | #: src/ndisc.c:556 349 | msgid "Retransmit time : " 350 | msgstr "" 351 | 352 | #: src/ndisc.c:585 353 | msgid " Source link-layer address: " 354 | msgstr "" 355 | 356 | #: src/ndisc.c:724 357 | msgid "Receiving ICMPv6 packet" 358 | msgstr "" 359 | 360 | #: src/ndisc.c:741 361 | #, c-format 362 | msgid " from %s\n" 363 | msgstr "" 364 | 365 | #: src/ndisc.c:766 src/traceroute.c:921 src/traceroute.c:929 366 | msgid "Raw IPv6 socket" 367 | msgstr "" 368 | 369 | #: src/ndisc.c:801 370 | #, c-format 371 | msgid "Soliciting %s (%s) on %s...\n" 372 | msgstr "" 373 | 374 | #: src/ndisc.c:821 375 | msgid "Sending ICMPv6 packet" 376 | msgstr "" 377 | 378 | #: src/ndisc.c:837 379 | msgid "Timed out." 380 | msgstr "" 381 | 382 | #: src/ndisc.c:846 383 | msgid "No response." 384 | msgstr "" 385 | 386 | #: src/ndisc.c:868 387 | #, c-format 388 | msgid "" 389 | "\n" 390 | " -1, --single display first response and exit\n" 391 | " -h, --help display this help and exit\n" 392 | " -m, --multiple wait and display all responses\n" 393 | " -n, --numeric don't resolve host names\n" 394 | " -q, --quiet only print the %s (mainly for scripts)\n" 395 | " -r, --retry maximum number of attempts (default: 3)\n" 396 | " -s, --source specify source IPv6 address\n" 397 | " -V, --version display program version and exit\n" 398 | " -v, --verbose verbose display (this is the default)\n" 399 | " -w, --wait how long to wait for a response [ms] (default: 1000)\n" 400 | "\n" 401 | msgstr "" 402 | 403 | #: src/ndisc.c:889 404 | #, c-format 405 | msgid "ndisc6: IPv6 Neighbor/Router Discovery userland tool %s (%s)\n" 406 | msgstr "" 407 | 408 | #: src/tcpspray.c:73 src/tcpspray.c:94 409 | #, c-format 410 | msgid "%s port %s: %s\n" 411 | msgstr "" 412 | 413 | #: src/tcpspray.c:117 414 | #, c-format 415 | msgid "%s %lu %s in %f %s" 416 | msgstr "" 417 | 418 | #: src/tcpspray.c:121 419 | #, c-format 420 | msgid " (%0.3f kbytes/s)" 421 | msgstr "" 422 | 423 | #: src/tcpspray.c:152 424 | #, c-format 425 | msgid "Warning: \"%s\" is too small (%zu %s) to fill block of %zu %s.\n" 426 | msgstr "" 427 | 428 | #: src/tcpspray.c:162 429 | #, c-format 430 | msgid "Sending %ju %s with blocksize %zu %s\n" 431 | msgstr "" 432 | 433 | #: src/tcpspray.c:179 src/traceroute.c:497 434 | #, c-format 435 | msgid "Receive error: %s\n" 436 | msgstr "" 437 | 438 | #: src/tcpspray.c:181 src/tcpspray.c:217 439 | msgid "Connection closed by peer" 440 | msgstr "" 441 | 442 | #: src/tcpspray.c:215 src/traceroute.c:1112 443 | #, c-format 444 | msgid "Cannot send data: %s\n" 445 | msgstr "" 446 | 447 | #: src/tcpspray.c:239 448 | #, c-format 449 | msgid "Child process returned an error" 450 | msgstr "" 451 | 452 | #: src/tcpspray.c:246 453 | msgid "Received" 454 | msgstr "" 455 | 456 | #: src/tcpspray.c:250 457 | msgid "Transmitted" 458 | msgstr "" 459 | 460 | #: src/tcpspray.c:278 461 | #, c-format 462 | msgid "" 463 | "Usage: %s [options] [service/port number]\n" 464 | "Use the discard TCP service at the specified host\n" 465 | "(the default host is the local system, the default service is discard)\n" 466 | msgstr "" 467 | 468 | #: src/tcpspray.c:283 469 | msgid "" 470 | "\n" 471 | " -4 force usage of the IPv4 protocols family\n" 472 | " -6 force usage of the IPv6 protocols family\n" 473 | " -b specify the block bytes size (default: 1024)\n" 474 | " -d wait for given delay (usec) between each block (default: 0)\n" 475 | " -e perform a duplex test (TCP Echo instead of TCP Discard)\n" 476 | " -f fill sent data blocks with the specified file content\n" 477 | " -h display this help and exit\n" 478 | " -n specify the number of blocks to send (default: 100)\n" 479 | " -V display program version and exit\n" 480 | " -v enable verbose output\n" 481 | msgstr "" 482 | 483 | #: src/tcpspray.c:304 484 | #, c-format 485 | msgid "tcpspray6: TCP/IP bandwidth tester %s (%s)\n" 486 | msgstr "" 487 | 488 | #: src/tcptraceroute.c:50 src/traceroute.c:1215 489 | #, c-format 490 | msgid "" 491 | "Usage: %s [options] [%s]\n" 492 | "Print IPv6 network route to a host\n" 493 | msgstr "" 494 | 495 | #: src/tcptraceroute.c:51 496 | msgid "port number" 497 | msgstr "" 498 | 499 | #: src/tcptraceroute.c:53 500 | msgid "" 501 | "\n" 502 | " -A send TCP ACK probes\n" 503 | " -d enable socket debugging\n" 504 | " -E set TCP Explicit Congestion Notification bits in probe packets\n" 505 | " -f specify the initial hop limit (default: 1)\n" 506 | " -g insert a route segment within a \"Type 0\" routing header\n" 507 | " -h display this help and exit\n" 508 | " -i force outgoing network interface\n" 509 | " -l set probes byte size\n" 510 | " -m set the maximum hop limit (default: 30)\n" 511 | " -N perform reverse name lookups on the addresses of every hop\n" 512 | " -n don't perform reverse name lookup on addresses\n" 513 | " -p override source TCP port\n" 514 | " -q override the number of probes per hop (default: 3)\n" 515 | " -r do not route packets\n" 516 | " -S send TCP SYN probes (default)\n" 517 | " -s specify the source IPv6 address of probe packets\n" 518 | " -t set traffic class of probe packets\n" 519 | " -V, --version display program version and exit\n" 520 | " -w override the timeout for response in seconds (default: 5)\n" 521 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 522 | msgstr "" 523 | 524 | #: src/traceroute.c:620 525 | #, c-format 526 | msgid " %u.%03u ms " 527 | msgstr "" 528 | 529 | #: src/traceroute.c:661 530 | msgid "[closed] " 531 | msgstr "" 532 | 533 | #: src/traceroute.c:665 534 | msgid "[open] " 535 | msgstr "" 536 | 537 | #: src/traceroute.c:723 538 | #, c-format 539 | msgid "%s%s%s%s: %s\n" 540 | msgstr "" 541 | 542 | #: src/traceroute.c:724 543 | msgid "port " 544 | msgstr "" 545 | 546 | #: src/traceroute.c:784 547 | #, c-format 548 | msgid "traceroute to %s (%s) " 549 | msgstr "" 550 | 551 | #: src/traceroute.c:789 552 | #, c-format 553 | msgid "from %s, " 554 | msgstr "" 555 | 556 | #: src/traceroute.c:793 557 | #, c-format 558 | msgid "port %u, from port %u, " 559 | msgstr "" 560 | 561 | #: src/traceroute.c:1010 562 | #, c-format 563 | msgid "%u hop max, " 564 | msgid_plural "%u hops max, " 565 | msgstr[0] "" 566 | msgstr[1] "" 567 | 568 | #: src/traceroute.c:1061 569 | #, c-format 570 | msgid "%zu byte packets\n" 571 | msgid_plural "%zu bytes packets\n" 572 | msgstr[0] "" 573 | msgstr[1] "" 574 | 575 | #: src/traceroute.c:1089 src/traceroute.c:1163 576 | #, c-format 577 | msgid " %3u%% completed..." 578 | msgstr "" 579 | 580 | #: src/traceroute.c:1179 581 | msgid " " 582 | msgstr "" 583 | 584 | #: src/traceroute.c:1216 585 | msgid "packet length" 586 | msgstr "" 587 | 588 | #: src/traceroute.c:1218 589 | msgid "" 590 | "\n" 591 | " -A send TCP ACK probes\n" 592 | " -d enable socket debugging\n" 593 | " -E set TCP Explicit Congestion Notification bits in TCP packets\n" 594 | " -f specify the initial hop limit (default: 1)\n" 595 | " -g insert a route segment within a \"Type 0\" routing header\n" 596 | " -h display this help and exit\n" 597 | " -I use ICMPv6 Echo Request packets as probes\n" 598 | " -i force outgoing network interface\n" 599 | " -l display incoming packets hop limit\n" 600 | " -m set the maximum hop limit (default: 30)\n" 601 | " -N perform reverse name lookups on the addresses of every hop\n" 602 | " -n don't perform reverse name lookup on addresses\n" 603 | " -p override destination port\n" 604 | " -q override the number of probes per hop (default: 3)\n" 605 | " -r do not route packets\n" 606 | " -S send TCP SYN probes\n" 607 | " -s specify the source IPv6 address of probe packets\n" 608 | " -t set traffic class of probe packets\n" 609 | " -U send UDP probes (default)\n" 610 | " -V display program version and exit\n" 611 | " -w override the timeout for response in seconds (default: 5)\n" 612 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 613 | msgstr "" 614 | 615 | #: src/traceroute.c:1252 616 | #, c-format 617 | msgid "traceroute6: TCP & UDP IPv6 traceroute tool %s (%s)\n" 618 | msgstr "" 619 | 620 | #: src/traceroute.c:1272 621 | #, c-format 622 | msgid "%s: invalid hop limit\n" 623 | msgstr "" 624 | 625 | #: src/traceroute.c:1286 626 | #, c-format 627 | msgid "%s: invalid packet length\n" 628 | msgstr "" 629 | -------------------------------------------------------------------------------- /rdnss/.gitignore: -------------------------------------------------------------------------------- 1 | merge-hook 2 | rdnssd 3 | -------------------------------------------------------------------------------- /rdnss/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - rdnss/ directory Makefile for ndisc6 2 | 3 | # Copyright © 2006-2007 Rémi Denis-Courmont 4 | # This file is distributed under the same license as the ndisc6 package. 5 | 6 | confdir = $(sysconfdir)/rdnssd 7 | myrundir = $(localstatedir)/run/rdnssd 8 | 9 | EXTRA_DIST += rdnss/merge-hook.in 10 | CLEANFILES += $(conf_SCRIPTS) 11 | AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = merge-hook 12 | sbin_PROGRAMS = rdnssd 13 | conf_SCRIPTS = merge-hook 14 | 15 | # rdnssd 16 | rdnssd_SOURCES = rdnss/rdnssd.c rdnss/rdnssd.h \ 17 | rdnss/icmp.c \ 18 | rdnss/netlink.c 19 | rdnssd_LDADD = $(LIBRT) libcompat.a 20 | 21 | # merge-hook 22 | merge-hook: rdnss/merge-hook.in config.status 23 | $(AM_V_at)rm -f -- $@.tmp $@ 24 | $(sed_verbose)$(subst_script) < $(srcdir)/rdnss/$@.in > $@.tmp 25 | $(AM_V_at)chmod -- +x $@.tmp 26 | $(AM_V_at)mv -f -- $@.tmp $@ 27 | 28 | install-data-hook:: 29 | $(install_sh) -d -- $(DESTDIR)$(myrundir) 30 | -chown -- nobody $(DESTDIR)$(myrundir) 31 | 32 | uninstall-hook:: 33 | -rmdir $(DESTDIR)$(myrundir) 34 | -------------------------------------------------------------------------------- /rdnss/icmp.c: -------------------------------------------------------------------------------- 1 | /** 2 | * icmp.c - raw socket source for ICMPv6 RDNSS 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2007-2008 Pierre Ynard, Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "rdnssd.h" 33 | #include "gettext.h" 34 | 35 | #ifndef IPV6_RECVHOPLIMIT 36 | # warning using RFC2922 instead of RFC3542 37 | # define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT 38 | #endif 39 | 40 | #ifndef SOL_IPV6 41 | # define SOL_IPV6 IPPROTO_IPV6 42 | #endif 43 | #ifndef SOL_ICMPV6 44 | # define SOL_ICMPV6 IPPROTO_ICMPV6 45 | #endif 46 | 47 | static int icmp_recv (int fd) 48 | { 49 | struct nd_router_advert icmp6; 50 | uint8_t buf[65536 - sizeof (icmp6)], cbuf[CMSG_SPACE (sizeof (int))]; 51 | struct iovec iov[2] = 52 | { 53 | { .iov_base = &icmp6, .iov_len = sizeof (icmp6) }, 54 | { .iov_base = buf, .iov_len = sizeof (buf) } 55 | }; 56 | struct sockaddr_in6 src; 57 | struct msghdr msg = 58 | { 59 | .msg_iov = iov, 60 | .msg_iovlen = sizeof (iov) / sizeof (iov[0]), 61 | .msg_name = &src, 62 | .msg_namelen = sizeof (src), 63 | .msg_control = cbuf, 64 | .msg_controllen = sizeof (cbuf) 65 | }; 66 | 67 | ssize_t len = recvmsg (fd, &msg, 0); 68 | 69 | /* Sanity checks */ 70 | if ((len < (ssize_t)sizeof (icmp6)) /* error or too small packet */ 71 | || (msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)) /* truncated packet */ 72 | || !IN6_IS_ADDR_LINKLOCAL (&src.sin6_addr) /* bad source address */ 73 | || (icmp6.nd_ra_code != 0)) /* unknown ICMPv6 code */ 74 | return -1; 75 | 76 | for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); 77 | cmsg != NULL; 78 | cmsg = CMSG_NXTHDR (&msg, cmsg)) 79 | { 80 | if ((cmsg->cmsg_level == IPPROTO_IPV6) 81 | && (cmsg->cmsg_type == IPV6_HOPLIMIT) 82 | && (255 != *(int *)CMSG_DATA (cmsg))) /* illegal hop limit */ 83 | return -1; 84 | } 85 | 86 | /* Parses RA options */ 87 | len -= sizeof (icmp6); 88 | return parse_nd_opts((struct nd_opt_hdr *) buf, len, src.sin6_scope_id); 89 | 90 | } 91 | 92 | static int icmp_socket() 93 | { 94 | int fd = socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); 95 | if (fd == -1) 96 | { 97 | syslog (LOG_CRIT, _("cannot open ICMPv6 socket")); 98 | return -1; 99 | } 100 | 101 | /* set ICMPv6 filter */ 102 | { 103 | struct icmp6_filter f; 104 | 105 | ICMP6_FILTER_SETBLOCKALL (&f); 106 | ICMP6_FILTER_SETPASS (ND_ROUTER_ADVERT, &f); 107 | setsockopt (fd, SOL_ICMPV6, ICMP6_FILTER, &f, sizeof (f)); 108 | } 109 | 110 | setsockopt (fd, SOL_IPV6, IPV6_RECVHOPLIMIT, &(int){ 1 }, sizeof (int)); 111 | 112 | return fd; 113 | } 114 | 115 | const rdnss_src_t rdnss_icmp = { icmp_socket, icmp_recv }; 116 | -------------------------------------------------------------------------------- /rdnss/merge-hook.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # resolv.conf merge hook for rdnssd 4 | 5 | # ************************************************************************* 6 | # * Copyright © 2007-2009, 2017 Pierre Ynard. * 7 | # * This program is free software: you can redistribute and/or modify * 8 | # * it under the terms of the GNU General Public License as published by * 9 | # * the Free Software Foundation, versions 2 or 3 of the license. * 10 | # * * 11 | # * This program is distributed in the hope that it will be useful, * 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | # * GNU General Public License for more details. * 15 | # * * 16 | # * You should have received a copy of the GNU General Public License * 17 | # * along with this program. If not, see . * 18 | # ************************************************************************* 19 | 20 | set -e 21 | 22 | PATH=/sbin:/bin 23 | 24 | # Max number of nameserver options taken into account. Should be as 25 | # defined in 26 | MAXNS=3 27 | 28 | # This script tries to share available nameserver slots with IPv4 29 | # entries, for example to allow fallback to IPv4 if IPv6 fails. If 30 | # there is not enough room for all IPv6 and IPv4 entries, this script 31 | # will limit the IPv6 entries it adds to $RDNSS_LIMIT only. 32 | RDNSS_LIMIT=$(($MAXNS - 1)) 33 | 34 | sysconfdir='@SYSCONFDIR@' 35 | localstatedir='@LOCALSTATEDIR@' 36 | resolvconf="$sysconfdir/resolv.conf" 37 | myresolvconf="$localstatedir/run/rdnssd/resolv.conf" 38 | 39 | # These should be POSIX-compliant BREs 40 | RE_NSV4='^nameserver *\([0-9]\{1,3\}\.\)\{3,3\}[0-9]\{1,3\} *$' 41 | RE_NSV4OR6='^nameserver *[a-fA-F0-9:\.]\{1,46\}\(%[a-zA-Z0-9]\{1,\}\)\{,1\} *$' 42 | 43 | # Count how many IPv6 nameservers we can fit 44 | 45 | limit=$RDNSS_LIMIT 46 | 47 | nnsv4=`grep -c "$RE_NSV4" $resolvconf || [ $? -le 1 ]` 48 | room=$(($MAXNS - $nnsv4)) 49 | 50 | if [ $limit -lt $room ]; then 51 | limit=$room 52 | fi 53 | 54 | # Merge and write the result. Let rdnssd assume ownership of all IPv6 55 | # nameservers, and remove extraneous IPv6 entries as expired. However 56 | # DHCPv4 most often sets up search list entries, and rdnssd cannot 57 | # clobber these lest it causes counterintuitive breakage. There is no 58 | # easy way to properly merge and manage DNSSL entries here, so just drop 59 | # them. 60 | 61 | { 62 | sed -e "/$RE_NSV4OR6/d" < $resolvconf 63 | grep -m $limit "$RE_NSV4OR6" < $myresolvconf || [ $? -le 1 ] 64 | sed -ne "/$RE_NSV4/p" < $resolvconf 65 | } > $resolvconf.tmp 66 | 67 | mv -f $resolvconf.tmp $resolvconf 68 | 69 | -------------------------------------------------------------------------------- /rdnss/netlink.c: -------------------------------------------------------------------------------- 1 | /** 2 | * netlink.c - NetLink source for ICMPv6 RDNSS 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2007 Pierre Ynard, Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #ifdef __linux__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "rdnssd.h" 39 | #include "gettext.h" 40 | 41 | 42 | #ifndef RTNLGRP_ND_USEROPT 43 | # warning You need to update your Linux kernel headers (>= 2.6.24) 44 | /* Belongs in */ 45 | 46 | struct nduseroptmsg 47 | { 48 | unsigned char nduseropt_family; 49 | unsigned char nduseropt_pad1; 50 | unsigned short nduseropt_opts_len; /* Total length of options */ 51 | int nduseropt_ifindex; 52 | __u8 nduseropt_icmp_type; 53 | __u8 nduseropt_icmp_code; 54 | unsigned short nduseropt_pad2; 55 | unsigned int nduseropt_pad3; 56 | /* Followed by one or more ND options */ 57 | }; 58 | 59 | # define RTNLGRP_ND_USEROPT 20 60 | #endif 61 | 62 | static int nl_recv (int fd) 63 | { 64 | unsigned int buf_size = NLMSG_SPACE(65536 - sizeof(struct icmp6_hdr)); 65 | uint8_t buf[buf_size]; 66 | size_t msg_size; 67 | struct nduseroptmsg *ndmsg; 68 | 69 | memset(buf, 0, buf_size); 70 | msg_size = recv(fd, buf, buf_size, 0); 71 | if (msg_size == (size_t)(-1)) 72 | return -1; 73 | 74 | if (msg_size < NLMSG_SPACE(sizeof(struct nduseroptmsg))) 75 | return -1; 76 | 77 | ndmsg = (struct nduseroptmsg *) NLMSG_DATA((struct nlmsghdr *) buf); 78 | 79 | if (ndmsg->nduseropt_family != AF_INET6 80 | || ndmsg->nduseropt_icmp_type != ND_ROUTER_ADVERT 81 | || ndmsg->nduseropt_icmp_code != 0) 82 | return 0; 83 | 84 | if (msg_size < NLMSG_SPACE(sizeof(struct nduseroptmsg) + ndmsg->nduseropt_opts_len)) 85 | return -1; 86 | 87 | return parse_nd_opts((struct nd_opt_hdr *) (ndmsg + 1), ndmsg->nduseropt_opts_len, ndmsg->nduseropt_ifindex); 88 | 89 | } 90 | 91 | 92 | static int nl_socket (void) 93 | { 94 | struct sockaddr_nl saddr; 95 | struct utsname uts; 96 | int fd; 97 | 98 | /* Netlink RDNSS support starts with 2.6.24 */ 99 | uname (&uts); 100 | if (strverscmp (uts.release, "2.6.24") < 0) 101 | { 102 | errno = ENOSYS; 103 | return -1; 104 | } 105 | 106 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); 107 | if (fd == -1) 108 | { 109 | syslog(LOG_CRIT, _("cannot open netlink socket")); 110 | return fd; 111 | } 112 | 113 | memset(&saddr, 0, sizeof(struct sockaddr_nl)); 114 | saddr.nl_family = AF_NETLINK; 115 | saddr.nl_pid = getpid(); 116 | saddr.nl_groups = 1 << (RTNLGRP_ND_USEROPT - 1); 117 | 118 | if (bind (fd, (struct sockaddr *) &saddr, sizeof (struct sockaddr_nl))) 119 | return -1; 120 | 121 | return fd; 122 | } 123 | 124 | const rdnss_src_t rdnss_netlink = { nl_socket, nl_recv }; 125 | 126 | #endif /* __linux__ */ 127 | -------------------------------------------------------------------------------- /rdnss/rdnssd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * rdnssd.h - daemon for DNS configuration from ICMPv6 RA 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2007 Pierre Ynard, Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifndef NDISC6_RDNSSD_H 21 | # define NDISC6_RDNSSD_H 1 22 | 23 | typedef struct rdnss_src 24 | { 25 | int (*setup) (void); 26 | int (*process) (int fd); 27 | } rdnss_src_t; 28 | 29 | extern const rdnss_src_t rdnss_netlink, rdnss_icmp; 30 | 31 | /* Belongs in */ 32 | #define ND_OPT_RDNSS 25 33 | #define ND_OPT_DNSSL 31 34 | 35 | struct nd_opt_rdnss 36 | { 37 | uint8_t nd_opt_rdnss_type; 38 | uint8_t nd_opt_rdnss_len; 39 | uint16_t nd_opt_rdnss_reserved; 40 | uint32_t nd_opt_rdnss_lifetime; 41 | /* followed by one or more IPv6 addresses */ 42 | }; 43 | 44 | struct nd_opt_dnssl 45 | { 46 | uint8_t nd_opt_dnssl_type; 47 | uint8_t nd_opt_dnssl_len; 48 | uint16_t nd_opt_dnssl_reserved; 49 | uint32_t nd_opt_dnssl_lifetime; 50 | /* followed by one or more domain names */ 51 | }; 52 | 53 | # ifdef __cplusplus 54 | extern "C" { 55 | # endif 56 | 57 | int parse_nd_opts (const struct nd_opt_hdr *opt, size_t opts_len, unsigned int ifindex); 58 | 59 | # ifdef __cplusplus 60 | } 61 | # endif 62 | 63 | #endif /* !NDISC6_RDNSSD_H */ 64 | 65 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | addr2name 2 | dnssort 3 | name2addr 4 | ndisc6 5 | rdisc6 6 | rltraceroute6 7 | tcpspray 8 | tcpspray6 9 | tcptraceroute6 10 | tracert6 11 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - src/ directory Makefile for ndisc6 2 | 3 | # Copyright © 2006-2008 Rémi Denis-Courmont 4 | # This file is distributed under the same license as the ndisc6 package. 5 | 6 | mysuidexecdir = $(myexecdir) 7 | 8 | mysuidexec_PROGRAMS = ndisc6 rdisc6 rltraceroute6 9 | myexec_PROGRAMS = tcptraceroute6 10 | myexec_SCRIPTS = tracert6 11 | bin_PROGRAMS = tcpspray name2addr 12 | bin_SCRIPTS = tcpspray6 dnssort addr2name 13 | noinst_HEADERS += src/gettime.h 14 | dist_noinst_SCRIPTS = gen-alias 15 | EXTRA_DIST += src/dnssort.in 16 | MOSTLYCLEANFILES += $(myexec_SCRIPTS) $(bin_SCRIPTS) 17 | 18 | gen_alias = transform="$(transform)" ${SHELL} $(srcdir)/gen-alias 19 | 20 | alias_verbose = $(alias_verbose_$(V)) 21 | alias_verbose_ = $(alias_verbose_$(AM_DEFAULT_VERBOSITY)) 22 | alias_verbose_0 = @echo " ALIAS $@"; 23 | 24 | # ndisc6 25 | ndisc6_SOURCES = src/ndisc.c 26 | ndisc6_LDADD = $(LIBRT) $(AM_LIBADD) 27 | 28 | # rdisc6 29 | rdisc6_SOURCES = src/ndisc.c 30 | rdisc6_CPPFLAGS = -DRDISC $(AM_CPPFLAGS) 31 | rdisc6_LDADD = $(LIBRT) $(AM_LIBADD) 32 | 33 | # traceroute6 34 | rltraceroute6_SOURCES = src/traceroute.c src/traceroute.h \ 35 | src/trace-tcp.c src/trace-udp.c src/trace-icmp.c 36 | rltraceroute6_LDADD = $(LIBRT) $(AM_LIBADD) 37 | tcptraceroute6_SOURCES = src/tcptraceroute.c 38 | tcptraceroute6_CPPFLAGS = $(AM_CPPFLAGS) \ 39 | -DRLTRACEROUTE6=\"`echo rltraceroute6 | sed '$(transform)'`\" 40 | 41 | tracert6: src/Makefile.am gen-alias 42 | $(alias_verbose)$(gen_alias) tracert6 rltraceroute6 -I 43 | 44 | # tcpspray 45 | tcpspray_SOURCES = src/tcpspray.c 46 | tcpspray_LDADD = $(LIBRT) $(AM_LIBADD) 47 | 48 | tcpspray6: src/Makefile.am gen-alias 49 | $(alias_verbose)$(gen_alias) tcpspray6 tcpspray -6 50 | 51 | # addr2name 52 | name2addr_SOURCES = src/addrinfo.c 53 | addr2name: src/Makefile.am gen-alias 54 | $(alias_verbose)$(gen_alias) addr2name name2addr -r 55 | 56 | # dnssort 57 | dnssort: src/dnssort.in config.status 58 | $(AM_V_at)rm -f $@.tmp $@ 59 | $(sed_verbose)$(subst_script) < $(srcdir)/src/$@.in > $@.tmp 60 | $(AM_V_at)chmod +x $@.tmp 61 | $(AM_V_at)mv -f $@.tmp $@ 62 | 63 | if NOSUID 64 | myexecdir = $(sbindir) 65 | else 66 | myexecdir = $(bindir) 67 | 68 | # IMPORTANT NOTE for packagers: 69 | # If you want to disable setuid installation, 70 | # you can invoke the configure with '--disable-suid-install'. 71 | install-exec-hook: 72 | @for f in $(mysuidexec_PROGRAMS); do \ 73 | i="`echo "$$f" | sed -e '$(program)'`" ; \ 74 | echo chmod u+s "$(DESTDIR)$(mysuidexecdir)/$$i" ; \ 75 | chmod u+s "$(DESTDIR)$(mysuidexecdir)/$$i" || exit $$? ; \ 76 | done 77 | endif 78 | 79 | -------------------------------------------------------------------------------- /src/addrinfo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * addrinfo.c - converts names to network addresses 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2002-2009 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include 25 | 26 | #include 27 | #include /* strchr() */ 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #ifdef HAVE_GETOPT_H 35 | # include 36 | #endif 37 | 38 | #ifndef AI_IDN 39 | # define AI_IDN 0 40 | #endif 41 | 42 | static void 43 | gai_perror (int errval, const char *msg) 44 | { 45 | if (errval == EAI_SYSTEM) 46 | perror (msg); 47 | else 48 | fprintf (stderr, "%s: %s\n", msg, gai_strerror (errval)); 49 | } 50 | 51 | 52 | static int 53 | printnames (const char *name, int family, int aflags, int nflags, bool single) 54 | { 55 | struct addrinfo hints, *res; 56 | 57 | memset (&hints, 0, sizeof (hints)); 58 | hints.ai_family = family; 59 | hints.ai_socktype = SOCK_DGRAM; 60 | hints.ai_flags = aflags; 61 | 62 | int check = getaddrinfo (name, NULL, &hints, &res); 63 | if (check) 64 | { 65 | gai_perror (check, name); 66 | return -1; 67 | } 68 | 69 | for (struct addrinfo *ptr = res; ptr != NULL; ptr = ptr->ai_next) 70 | { 71 | char hostname[NI_MAXHOST]; 72 | 73 | check = getnameinfo (ptr->ai_addr, ptr->ai_addrlen, 74 | hostname, sizeof (hostname), 75 | NULL, 0, nflags); 76 | 77 | if (check) 78 | gai_perror (check, name); 79 | else 80 | fputs (hostname, stdout); 81 | 82 | if (single) 83 | break; 84 | 85 | if (ptr->ai_next != NULL) 86 | fputc (' ', stdout); 87 | } 88 | 89 | fputc ('\n', stdout); 90 | freeaddrinfo (res); 91 | return 0; 92 | } 93 | 94 | 95 | static int 96 | printnamesf (FILE *input, int family, int aflags, int nflags, bool single) 97 | { 98 | do 99 | { 100 | char buf[NI_MAXHOST + 1], *ptr; 101 | 102 | if (fgets (buf, sizeof (buf), input) != NULL) 103 | { 104 | ptr = strchr (buf, '\n'); 105 | if (ptr != NULL) 106 | *ptr = '\0'; 107 | 108 | printnames (buf, family, aflags, nflags, single); 109 | } 110 | } 111 | while (!ferror (input) && !feof (input)); 112 | 113 | if (ferror (input)) 114 | { 115 | perror (_("Input error")); 116 | return -1; 117 | } 118 | 119 | return 0; 120 | } 121 | 122 | 123 | static int usage (const char *path) 124 | { 125 | printf (_( 126 | "Usage: %s [-4|-6] [hostnames]\n" 127 | "Converts names to addresses.\n" 128 | "\n" 129 | " -4, --ipv4 only lookup IPv4 addresses\n" 130 | " -6, --ipv6 only lookup IPv6 addresses\n" 131 | " -c, --config only return addresses for locally configured protocols\n" 132 | " -h, --help display this help and exit\n" 133 | " -m, --multiple print multiple results separated by spaces\n" 134 | " -n, --numeric do not perform forward hostname lookup\n" 135 | " -r, --reverse perform reverse address to hostname lookup\n" 136 | " -V, --version display program version and exit\n"), path); 137 | return 0; 138 | } 139 | 140 | 141 | static int quick_usage (const char *path) 142 | { 143 | fprintf (stderr, _("Try \"%s -h\" for more information.\n"), path); 144 | return 2; 145 | } 146 | 147 | 148 | static int version (void) 149 | { 150 | printf (_("addrinfo %s (%s)\n"), VERSION, "$Rev$"); 151 | printf (_(" built %s on %s\n"), __DATE__, PACKAGE_BUILD_HOSTNAME); 152 | printf (_("Configured with: %s\n"), PACKAGE_CONFIGURE_INVOCATION); 153 | puts (_("Written by Remi Denis-Courmont\n")); 154 | 155 | printf (_("Copyright (C) %u-%u Remi Denis-Courmont\n"), 2002, 2007); 156 | puts (_("This is free software; see the source for copying conditions.\n" 157 | "There is NO warranty; not even for MERCHANTABILITY or\n" 158 | "FITNESS FOR A PARTICULAR PURPOSE.\n")); 159 | return 0; 160 | } 161 | 162 | static const struct option lopts[] = 163 | { 164 | { "ipv4", no_argument, NULL, '4' }, 165 | { "ipv6", no_argument, NULL, '6' }, 166 | { "config", no_argument, NULL, 'c' }, 167 | { "help", no_argument, NULL, 'h' }, 168 | { "multiple", no_argument, NULL, 'm' }, 169 | { "numeric", no_argument, NULL, 'n' }, 170 | { "reverse", no_argument, NULL, 'r' }, 171 | { "version", no_argument, NULL, 'V' }, 172 | { NULL, 0, NULL, 0 } 173 | }; 174 | 175 | static const char sopts[] = "46chmnrV"; 176 | 177 | int main (int argc, char *argv[]) 178 | { 179 | setlocale (LC_ALL, ""); 180 | bindtextdomain (PACKAGE, LOCALEDIR); 181 | textdomain (PACKAGE); 182 | 183 | int val, family = AF_UNSPEC, aflags = AI_IDN, nflags = NI_NUMERICHOST; 184 | bool single = true; 185 | 186 | while ((val = getopt_long (argc, argv, sopts, lopts, NULL)) != EOF) 187 | switch (val) 188 | { 189 | case '4': 190 | family = AF_INET; 191 | break; 192 | 193 | case '6': 194 | family = AF_INET6; 195 | break; 196 | 197 | case 'c': 198 | aflags |= AI_ADDRCONFIG; 199 | break; 200 | 201 | case 'h': 202 | return usage (argv[0]); 203 | 204 | case 'm': 205 | single = false; 206 | break; 207 | 208 | case 'n': 209 | aflags |= AI_NUMERICHOST; 210 | break; 211 | 212 | case 'r': 213 | nflags &= ~NI_NUMERICHOST; 214 | break; 215 | 216 | case 'V': 217 | return version (); 218 | 219 | case '?': 220 | default: 221 | return quick_usage (argv[0]); 222 | } 223 | 224 | setvbuf (stdout, NULL, _IOLBF, 0); 225 | val = 0; 226 | if (optind < argc) 227 | { 228 | while (optind < argc) 229 | printnames (argv[optind++], family, aflags, nflags, single); 230 | } 231 | else 232 | val = printnamesf (stdin, family, aflags, nflags, single); 233 | 234 | return val; 235 | } 236 | -------------------------------------------------------------------------------- /src/dnssort.in: -------------------------------------------------------------------------------- 1 | #! @PERL@ 2 | # 3 | # Perl script to sort DNS names 4 | # 5 | 6 | # ************************************************************************* 7 | # * Copyright © 2004-2006 Rémi Denis-Courmont. * 8 | # * This program is free software: you can redistribute and/or modify * 9 | # * it under the terms of the GNU General Public License as published by * 10 | # * the Free Software Foundation, versions 2 or 3 of the license. * 11 | # * * 12 | # * This program is distributed in the hope that it will be useful, * 13 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | # * GNU General Public License for more details. * 16 | # * * 17 | # * You should have received a copy of the GNU General Public License * 18 | # * along with this program. If not, see . * 19 | # ************************************************************************* 20 | 21 | use strict; 22 | #use locale; -- not very useful for DNS 23 | use Getopt::Std; 24 | 25 | $Getopt::Std::STANDARD_HELP_VERSION = 1; 26 | $main::VERSION = '@VERSION@'; 27 | 28 | sub main::HELP_MESSAGE() 29 | { 30 | print "Usage: dnssort [-r] [FILES]\n". 31 | " Sorts DNS hostnames from input.\n"; 32 | } 33 | 34 | 35 | # Parse command line 36 | our $opt_r; 37 | getopts('r'); 38 | 39 | if ($#ARGV < 0) 40 | { 41 | # No files specified -> Use standard input 42 | push @ARGV, '-'; 43 | } 44 | 45 | # Read files 46 | my @names = (); 47 | 48 | foreach (@ARGV) 49 | { 50 | open FD,"< $_" or die "$_: $!\n"; 51 | while() 52 | { 53 | chomp; 54 | push @names, join('.', reverse split /\./); 55 | } 56 | close FD; 57 | } 58 | 59 | # Sort entries 60 | @names = sort { lc($a) cmp lc($b) } @names; 61 | if ($opt_r) 62 | { 63 | @names = reverse @names; 64 | } 65 | 66 | # Print results 67 | foreach (@names) 68 | { 69 | print join('.', reverse split /\./)."\n"; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/gettime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gettime.h - compatibility wrapper around clock_gettime() 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #include 21 | #include 22 | 23 | static inline int mono_gettime (struct timespec *ts) 24 | { 25 | int rc; 26 | 27 | #if (_POSIX_MONOTONIC_CLOCK >= 0) 28 | rc = clock_gettime (CLOCK_MONOTONIC, ts); 29 | #endif 30 | #if (_POSIX_MONOTONIC_CLOCK == 0) 31 | if (errno == EINVAL) 32 | #endif 33 | #if (_POSIX_MONOTONIC_CLOCK <= 0) 34 | rc = clock_gettime (CLOCK_REALTIME, ts); 35 | #endif 36 | return rc; 37 | } 38 | 39 | 40 | static inline int mono_nanosleep (const struct timespec *ts) 41 | { 42 | int rc; 43 | 44 | #if (_POSIX_MONOTONIC_CLOCK >= 0) 45 | rc = clock_nanosleep (CLOCK_MONOTONIC, 0, ts, NULL); 46 | #endif 47 | #if (_POSIX_MONOTONIC_CLOCK == 0) 48 | if (rc == EINVAL) 49 | #endif 50 | #if (_POSIX_MONOTONIC_CLOCK <= 0) 51 | rc = clock_nanosleep (CLOCK_REALTIME, 0, ts, NULL); 52 | #endif 53 | return rc; 54 | } 55 | -------------------------------------------------------------------------------- /src/tcpspray.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tcpspray.c - Address family independant complete rewrite of tcpspray 3 | * Plus, this file has a clear copyright statement. 4 | */ 5 | 6 | /************************************************************************* 7 | * Copyright © 2006-2007 Rémi Denis-Courmont. * 8 | * This program is free software: you can redistribute and/or modify * 9 | * it under the terms of the GNU General Public License as published by * 10 | * the Free Software Foundation, versions 2 or 3 of the license. * 11 | * * 12 | * This program is distributed in the hope that it will be useful, * 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 15 | * GNU General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU General Public License * 18 | * along with this program. If not, see . * 19 | *************************************************************************/ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include // uint8_t, SIZE_MAX 31 | #include // SIZE_MAX on Solaris (non-standard) 32 | #ifndef SIZE_MAX 33 | # define SIZE_MAX SIZE_T_MAX // FreeBSD 4.x workaround 34 | #endif 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #ifdef HAVE_GETOPT_H 49 | # include 50 | #endif 51 | 52 | #include "gettime.h" 53 | #ifndef AI_IDN 54 | # define AI_IDN 0 55 | #endif 56 | 57 | static int family = 0; 58 | static unsigned verbose = 0; 59 | 60 | static int tcpconnect (const char *host, const char *serv) 61 | { 62 | struct addrinfo hints, *res; 63 | 64 | memset (&hints, 0, sizeof (hints)); 65 | hints.ai_family = family; 66 | hints.ai_socktype = SOCK_STREAM; 67 | hints.ai_protocol = IPPROTO_TCP; 68 | hints.ai_flags = AI_IDN; 69 | 70 | int val = getaddrinfo (host, serv, &hints, &res); 71 | if (val) 72 | { 73 | fprintf (stderr, _("%s port %s: %s\n"), host, serv, 74 | gai_strerror (val)); 75 | return -1; 76 | } 77 | 78 | val = -1; 79 | 80 | for (struct addrinfo *p = res; (p != NULL) && (val == -1); p = p->ai_next) 81 | { 82 | val = socket (p->ai_family, p->ai_socktype, p->ai_protocol); 83 | if (val == -1) 84 | { 85 | perror ("socket"); 86 | continue; 87 | } 88 | 89 | setsockopt (val, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int)); 90 | fcntl (val, F_SETFD, FD_CLOEXEC); 91 | 92 | if (connect (val, p->ai_addr, p->ai_addrlen)) 93 | { 94 | fprintf (stderr, _("%s port %s: %s\n"), host, serv, 95 | strerror (errno)); 96 | close (val); 97 | val = -1; 98 | continue; 99 | } 100 | } 101 | 102 | freeaddrinfo (res); 103 | return val; 104 | } 105 | 106 | 107 | static void 108 | print_duration (const char *msg, 109 | const struct timespec *end, const struct timespec *start, 110 | unsigned long bytes) 111 | { 112 | double duration = ((double)end->tv_sec) 113 | + ((double)end->tv_nsec) / 1000000000 114 | - ((double)start->tv_sec) 115 | - ((double)start->tv_nsec) / 1000000000; 116 | 117 | printf (_("%s %lu %s in %f %s"), gettext (msg), 118 | bytes, ngettext ("byte", "bytes", bytes), 119 | duration, ngettext ("second", "seconds", duration)); 120 | if (duration > 0) 121 | printf (_(" (%0.3f kbytes/s)"), bytes / (duration * 1024)); 122 | } 123 | 124 | 125 | static int 126 | tcpspray (const char *host, const char *serv, unsigned long n, size_t blen, 127 | unsigned delay_us, const char *fillname, bool echo) 128 | { 129 | if (serv == NULL) 130 | serv = echo ? "echo" : "discard"; 131 | 132 | int fd = tcpconnect (host, serv); 133 | if (fd == -1) 134 | return -1; 135 | 136 | uint8_t block[blen]; 137 | memset (block, 0, blen); 138 | 139 | if (fillname != NULL) 140 | { 141 | FILE *stream = fopen (fillname, "r"); 142 | if (stream == NULL) 143 | { 144 | perror (fillname); 145 | close (fd); 146 | return -1; 147 | } 148 | 149 | size_t res = fread (block, 1, blen, stream); 150 | if (res < blen) 151 | { 152 | fprintf (stderr, _("Warning: \"%s\" is too small (%zu %s) " 153 | "to fill block of %zu %s.\n"), fillname, 154 | res, ngettext ("byte", "bytes", res), 155 | blen, ngettext ("byte", "bytes", blen)); 156 | } 157 | fclose (stream); 158 | } 159 | 160 | if (verbose) 161 | { 162 | printf (_("Sending %ju %s with blocksize %zu %s\n"), 163 | (uintmax_t)n * blen, ngettext ("byte", "bytes", n * blen), 164 | blen, ngettext ("byte", "bytes", n * blen)); 165 | } 166 | 167 | pid_t child = -1; 168 | if (echo) 169 | { 170 | child = fork (); 171 | switch (child) 172 | { 173 | case 0: 174 | for (unsigned i = 0; i < n; i++) 175 | { 176 | ssize_t val = recv (fd, block, blen, MSG_WAITALL); 177 | if (val != (ssize_t)blen) 178 | { 179 | fprintf (stderr, _("Receive error: %s\n"), 180 | (val == -1) ? strerror (errno) 181 | : _("Connection closed by peer")); 182 | exit (1); 183 | } 184 | 185 | if (verbose) 186 | fputs ("\b \b", stdout); 187 | } 188 | exit (0); 189 | 190 | case -1: 191 | perror ("fork"); 192 | close (fd); 193 | return -1; 194 | } 195 | } 196 | else 197 | shutdown (fd, SHUT_RD); 198 | 199 | struct timespec delay_ts = { 0, 0 }; 200 | if (delay_us) 201 | { 202 | div_t d = div (delay_us, 1000000); 203 | delay_ts.tv_sec = d.quot; 204 | delay_ts.tv_nsec = d.rem * 1000; 205 | } 206 | 207 | struct timespec start, end; 208 | mono_gettime (&start); 209 | 210 | for (unsigned i = 0; i < n; i++) 211 | { 212 | ssize_t val = write (fd, block, blen); 213 | if (val != (ssize_t)blen) 214 | { 215 | fprintf (stderr, _("Cannot send data: %s\n"), 216 | (val == -1) ? strerror (errno) 217 | : _("Connection closed by peer")); 218 | goto abort; 219 | } 220 | 221 | if (verbose) 222 | fputc ('.', stdout); 223 | 224 | if (delay_us && mono_nanosleep (&delay_ts)) 225 | goto abort; 226 | } 227 | 228 | mono_gettime (&end); 229 | shutdown (fd, SHUT_WR); 230 | close (fd); 231 | 232 | if (child != -1) 233 | { 234 | int status; 235 | while (wait (&status) == -1); 236 | 237 | if (!WIFEXITED (status) || WEXITSTATUS (status)) 238 | { 239 | fprintf (stderr, _("Child process returned an error")); 240 | return -1; 241 | } 242 | 243 | struct timespec end_recv; 244 | mono_gettime (&end_recv); 245 | 246 | print_duration (N_("Received"), &end_recv, &start, blen * n); 247 | } 248 | puts (""); 249 | 250 | print_duration (N_("Transmitted"), &end, &start, blen * n); 251 | puts (""); 252 | 253 | return 0; 254 | 255 | abort: 256 | close (fd); 257 | if (child != -1) 258 | { 259 | kill (child, SIGTERM); 260 | while (wait (NULL) == -1); 261 | } 262 | return -1; 263 | } 264 | 265 | 266 | static int 267 | quick_usage (const char *path) 268 | { 269 | fprintf (stderr, _("Try \"%s -h\" for more information.\n"), path); 270 | return 2; 271 | } 272 | 273 | 274 | static int 275 | usage (const char *path) 276 | { 277 | printf (_( 278 | "Usage: %s [options] [service/port number]\n" 279 | "Use the discard TCP service at the specified host\n" 280 | "(the default host is the local system, the default service is discard)\n"), 281 | path); 282 | 283 | puts (_("\n" 284 | " -4 force usage of the IPv4 protocols family\n" 285 | " -6 force usage of the IPv6 protocols family\n" 286 | " -b specify the block bytes size (default: 1024)\n" 287 | " -d wait for given delay (usec) between each block (default: 0)\n" 288 | " -e perform a duplex test (TCP Echo instead of TCP Discard)\n" 289 | " -f fill sent data blocks with the specified file content\n" 290 | " -h display this help and exit\n" 291 | " -n specify the number of blocks to send (default: 100)\n" 292 | " -V display program version and exit\n" 293 | " -v enable verbose output\n" 294 | )); 295 | 296 | return 0; 297 | } 298 | 299 | 300 | static int 301 | version (void) 302 | { 303 | printf (_( 304 | "tcpspray6: TCP/IP bandwidth tester %s (%s)\n"), VERSION, "$Rev$"); 305 | printf (_(" built %s on %s\n"), __DATE__, PACKAGE_BUILD_HOSTNAME); 306 | printf (_("Configured with: %s\n"), PACKAGE_CONFIGURE_INVOCATION); 307 | puts (_("Written by Remi Denis-Courmont\n")); 308 | 309 | printf (_("Copyright (C) %u-%u Remi Denis-Courmont\n"), 2005, 2007); 310 | puts (_("This is free software; see the source for copying conditions.\n" 311 | "There is NO warranty; not even for MERCHANTABILITY or\n" 312 | "FITNESS FOR A PARTICULAR PURPOSE.\n")); 313 | return 0; 314 | } 315 | 316 | 317 | static const struct option opts[] = 318 | { 319 | { "ipv4", no_argument, NULL, '4' }, 320 | { "ipv6", no_argument, NULL, '6' }, 321 | { "bsize", required_argument, NULL, 'b' }, 322 | { "delay", required_argument, NULL, 'd' }, 323 | { "echo", no_argument, NULL, 'e' }, 324 | { "file", required_argument, NULL, 'f' }, 325 | { "fill", required_argument, NULL, 'f' }, 326 | { "help", no_argument, NULL, 'h' }, 327 | { "count", required_argument, NULL, 'n' }, 328 | { "version", no_argument, NULL, 'V' }, 329 | { "verbose", no_argument, NULL, 'v' }, 330 | { NULL, 0, NULL, 0 } 331 | }; 332 | 333 | static const char optstr[] = "46b:d:ef:hn:Vv"; 334 | 335 | int main (int argc, char *argv[]) 336 | { 337 | setlocale (LC_ALL, ""); 338 | bindtextdomain (PACKAGE, LOCALEDIR); 339 | textdomain (PACKAGE); 340 | 341 | unsigned long block_count = 100; 342 | size_t block_length = 1024; 343 | unsigned delay_ms = 0; 344 | bool echo = false; 345 | const char *fillname = NULL; 346 | 347 | int c; 348 | while ((c = getopt_long (argc, argv, optstr, opts, NULL)) != EOF) 349 | { 350 | switch (c) 351 | { 352 | case '4': 353 | family = AF_INET; 354 | break; 355 | 356 | case '6': 357 | family = AF_INET6; 358 | break; 359 | 360 | case 'b': 361 | { 362 | char *end; 363 | unsigned long value = strtoul (optarg, &end, 0); 364 | if (*end) 365 | errno = EINVAL; 366 | else 367 | if (value > SIZE_MAX) 368 | errno = ERANGE; 369 | if (errno) 370 | { 371 | perror (optarg); 372 | return 2; 373 | } 374 | block_length = (size_t)value; 375 | break; 376 | } 377 | 378 | case 'd': 379 | { 380 | char *end; 381 | unsigned long value = strtoul (optarg, &end, 0); 382 | if (*end) 383 | errno = EINVAL; 384 | else 385 | if (value > UINT_MAX) 386 | errno = ERANGE; 387 | if (errno) 388 | { 389 | perror (optarg); 390 | return 2; 391 | } 392 | delay_ms = (unsigned)value; 393 | break; 394 | } 395 | 396 | case 'e': 397 | echo = true; 398 | break; 399 | 400 | case 'f': 401 | fillname = optarg; 402 | break; 403 | 404 | case 'h': 405 | return usage (argv[0]); 406 | 407 | case 'n': 408 | { 409 | char *end; 410 | block_count = strtoul (optarg, &end, 0); 411 | if (*end) 412 | errno = EINVAL; 413 | if (errno) 414 | { 415 | perror (optarg); 416 | return 2; 417 | } 418 | break; 419 | } 420 | 421 | case 'V': 422 | return version (); 423 | 424 | case 'v': 425 | if (verbose < UINT_MAX) 426 | verbose++; 427 | break; 428 | 429 | case '?': 430 | default: 431 | return quick_usage (argv[0]); 432 | } 433 | } 434 | 435 | if (optind >= argc) 436 | return quick_usage (argv[0]); 437 | 438 | const char *hostname = argv[optind++]; 439 | const char *servname = (optind < argc) ? argv[optind++] : NULL; 440 | 441 | setvbuf (stdout, NULL, _IONBF, 0); 442 | c = tcpspray (hostname, servname, block_count, block_length, 443 | delay_ms, fillname, echo); 444 | return c ? 1 : 0; 445 | } 446 | -------------------------------------------------------------------------------- /src/tcptraceroute.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tcptraceroute.c - tcptraceroute-like wrapper around rltraceroute6 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2005-2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | #include 33 | #ifdef HAVE_GETOPT_H 34 | # include 35 | #endif 36 | #include 37 | 38 | static int 39 | quick_usage (const char *path) 40 | { 41 | fprintf (stderr, _("Try \"%s -h\" for more information.\n"), path); 42 | return 2; 43 | } 44 | 45 | 46 | static int 47 | usage (const char *path) 48 | { 49 | printf (_( 50 | "Usage: %s [options] [%s]\n" 51 | "Print IPv6 network route to a host\n"), path, _("port number")); 52 | 53 | puts (_("\n" 54 | " -A send TCP ACK probes\n" 55 | " -d enable socket debugging\n" 56 | " -E set TCP Explicit Congestion Notification bits in probe packets\n" 57 | " -f specify the initial hop limit (default: 1)\n" 58 | " -g insert a route segment within a \"Type 0\" routing header\n" 59 | " -h display this help and exit\n" 60 | " -i force outgoing network interface\n" 61 | //" -l display incoming packets hop limit\n" -- FIXME 62 | " -l set probes byte size\n" 63 | " -m set the maximum hop limit (default: 30)\n" 64 | " -N perform reverse name lookups on the addresses of every hop\n" 65 | " -n don't perform reverse name lookup on addresses\n" 66 | " -p override source TCP port\n" 67 | " -q override the number of probes per hop (default: 3)\n" 68 | " -r do not route packets\n" 69 | " -S send TCP SYN probes (default)\n" 70 | " -s specify the source IPv6 address of probe packets\n" 71 | " -t set traffic class of probe packets\n" 72 | " -V, --version display program version and exit\n" 73 | /*" -v, --verbose display all kind of ICMPv6 errors\n"*/ 74 | " -w override the timeout for response in seconds (default: 5)\n" 75 | " -z specify a time to wait (in ms) between each probes (default: 0)\n" 76 | )); 77 | 78 | return 0; 79 | } 80 | 81 | 82 | static const struct option opts[] = 83 | { 84 | { "ack", no_argument, NULL, 'A' }, 85 | { "debug", no_argument, NULL, 'd' }, 86 | { "ecn", no_argument, NULL, 'E' }, 87 | // -F is a stub 88 | { "first", required_argument, NULL, 'f' }, 89 | { "segment", required_argument, NULL, 'g' }, 90 | { "help", no_argument, NULL, 'h' }, 91 | { "iface", required_argument, NULL, 'i' }, 92 | { "length", required_argument, NULL, 'l' }, 93 | { "max", required_argument, NULL, 'm' }, 94 | // -N is not really a stub, should have a long name 95 | { "numeric", no_argument, NULL, 'n' }, 96 | { "port", required_argument, NULL, 'p' }, 97 | { "retry", required_argument, NULL, 'q' }, 98 | { "noroute", no_argument, NULL, 'r' }, 99 | { "syn", no_argument, NULL, 'S' }, 100 | { "source", required_argument, NULL, 's' }, 101 | { "tclass", required_argument, NULL, 't' }, 102 | { "version", no_argument, NULL, 'V' }, 103 | /*{ "verbose", no_argument, NULL, 'v' },*/ 104 | { "wait", required_argument, NULL, 'w' }, 105 | // -x is a stub 106 | { "delay", required_argument, NULL, 'z' }, 107 | { NULL, 0, NULL, 0 } 108 | }; 109 | 110 | 111 | static const char optstr[] = "AdEFf:g:hi:l:m:Nnp:q:rSs:t:Vw:xz:"; 112 | static const char bin_name[] = RLTRACEROUTE6; 113 | 114 | int main (int argc, char *argv[]) 115 | { 116 | setlocale (LC_ALL, ""); 117 | bindtextdomain (PACKAGE, LOCALEDIR); 118 | textdomain (PACKAGE); 119 | 120 | /* Determine path to wrapped binary */ 121 | char arg0[strlen (argv[0]) + sizeof (bin_name)]; 122 | strcpy (arg0, argv[0]); 123 | char *ptr = strrchr (arg0, '/'); 124 | if (ptr != NULL) 125 | ptr++; 126 | else 127 | ptr = arg0; 128 | strcpy (ptr, bin_name); 129 | 130 | /* Prepare big enough buffers */ 131 | unsigned len = 0; 132 | for (int i = 1; i < argc; i++) 133 | len += strlen (argv[i]); 134 | 135 | char optbuf[3 * len + argc], *buf = optbuf; 136 | char *optv[argc + len + /* "-S", "-p", NULL */ 3]; 137 | char *psize = NULL; 138 | 139 | int val, optc = 0; 140 | 141 | optv[optc++] = arg0; 142 | optv[optc++] = "-S"; 143 | 144 | while ((val = getopt_long (argc, argv, optstr, opts, NULL)) != EOF) 145 | { 146 | assert (optbuf + sizeof (optbuf) > buf); 147 | assert ((sizeof (optv) / sizeof (optv[0])) > (unsigned)optc); 148 | 149 | char name; 150 | 151 | switch (val) 152 | { 153 | case 'h': 154 | return usage (argv[0]); 155 | 156 | case 'V': 157 | optc = 1; 158 | optv[optc++] = "-V"; 159 | goto run; 160 | 161 | case '?': 162 | return quick_usage (argv[0]); 163 | 164 | case 'l': /* Packet size */ 165 | psize = optarg; 166 | continue; 167 | 168 | case 'p': /* Source port number */ 169 | name = 'P'; // traceroute6 secret name for this 170 | break; 171 | 172 | default: 173 | name = (char)val; 174 | } 175 | 176 | assert (strchr (optstr, val) != NULL); 177 | 178 | optv[optc++] = buf; 179 | *buf++ = '-'; 180 | *buf++ = name; 181 | *buf++ = '\0'; 182 | 183 | if ((strchr (optstr, val))[1] != ':') 184 | continue; // no_argument option 185 | 186 | optv[optc++] = optarg; 187 | } 188 | 189 | switch (argc - optind) 190 | { 191 | case 2: 192 | case 1: 193 | break; 194 | 195 | default: 196 | return quick_usage (argv[0]); 197 | } 198 | 199 | /* Destination host */ 200 | char *dsthost = argv[optind++]; 201 | 202 | /* Destination port number */ 203 | optv[optc++] = "-p"; 204 | optv[optc++] = (optind < argc) ? argv[optind] : "80"; 205 | optind++; 206 | 207 | /* Inserts destination */ 208 | if (dsthost != NULL) 209 | optv[optc++] = dsthost; 210 | 211 | /* Inserts packet size */ 212 | if (psize != NULL) 213 | optv[optc++] = psize; 214 | 215 | run: 216 | assert (optbuf + sizeof (optbuf) >= buf); 217 | assert ((sizeof (optv) / sizeof (optv[0])) > (unsigned)optc); 218 | optv[optc] = NULL; 219 | 220 | execvp (optv[0], optv); 221 | perror (optv[0]); 222 | exit (2); 223 | } 224 | -------------------------------------------------------------------------------- /src/trace-icmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * trace-icmp.c - ICMP code for IPv6 traceroute tool 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2005-2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include 25 | #include 26 | #include // uint16_t 27 | 28 | #include // getpid() 29 | #include 30 | #include 31 | #include 32 | 33 | #include "traceroute.h" 34 | 35 | 36 | /* ICMPv6 Echo probes */ 37 | static ssize_t 38 | send_echo_probe (int fd, unsigned ttl, unsigned n, size_t plen, uint16_t port) 39 | { 40 | if (plen < sizeof (struct icmp6_hdr)) 41 | plen = sizeof (struct icmp6_hdr); 42 | 43 | struct 44 | { 45 | struct icmp6_hdr ih; 46 | uint8_t payload[plen - sizeof (struct icmp6_hdr)]; 47 | } packet; 48 | memset (&packet, 0, plen); 49 | 50 | packet.ih.icmp6_type = ICMP6_ECHO_REQUEST; 51 | packet.ih.icmp6_id = htons (getpid ()); 52 | packet.ih.icmp6_seq = htons ((ttl << 8) | (n & 0xff)); 53 | (void)port; 54 | 55 | return send_payload (fd, &packet.ih, plen, ttl); 56 | } 57 | 58 | 59 | static ssize_t 60 | parse_echo_reply (const void *data, size_t len, int *ttl, unsigned *n, 61 | uint16_t port) 62 | { 63 | const struct icmp6_hdr *pih = (const struct icmp6_hdr *)data; 64 | 65 | if ((len < sizeof (*pih)) 66 | || (pih->icmp6_type != ICMP6_ECHO_REPLY) 67 | || (pih->icmp6_id != htons (getpid ()))) 68 | return -1; 69 | 70 | (void)port; 71 | 72 | *ttl = ntohs (pih->icmp6_seq) >> 8; 73 | *n = ntohs (pih->icmp6_seq) & 0xff; 74 | return 0; 75 | } 76 | 77 | 78 | static ssize_t 79 | parse_echo_error (const void *data, size_t len, int *ttl, unsigned *n, 80 | uint16_t port) 81 | { 82 | const struct icmp6_hdr *pih = (const struct icmp6_hdr *)data; 83 | 84 | if ((len < sizeof (*pih)) 85 | || (pih->icmp6_type != ICMP6_ECHO_REQUEST) || (pih->icmp6_code) 86 | || (pih->icmp6_id != htons (getpid ()))) 87 | return -1; 88 | 89 | (void)port; 90 | 91 | *ttl = ntohs (pih->icmp6_seq) >> 8; 92 | *n = ntohs (pih->icmp6_seq) & 0xff; 93 | return 0; 94 | } 95 | 96 | 97 | const tracetype echo_type = 98 | { SOCK_DGRAM, IPPROTO_ICMPV6, -1 /* checksum auto-set for ICMPv6 */, 99 | send_echo_probe, parse_echo_reply, parse_echo_error }; 100 | -------------------------------------------------------------------------------- /src/trace-tcp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * trace-tcp.c - TCP support for IPv6 traceroute tool 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2005-2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #undef _GNU_SOURCE 25 | #define _DEFAULT_SOURCE 1 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include // getpid() 34 | #include // SOCK_STREAM 35 | #include 36 | #include 37 | 38 | #include "traceroute.h" 39 | 40 | #define TCP_WINDOW 4096 41 | 42 | #ifndef TH_ECE 43 | # define TH_ECE 0x40 44 | # define TH_CWR 0x80 45 | #endif 46 | 47 | /* TCP/SYN probes */ 48 | static ssize_t 49 | send_syn_probe (int fd, unsigned ttl, unsigned n, size_t plen, uint16_t port) 50 | { 51 | if (plen < sizeof (struct tcphdr)) 52 | plen = sizeof (struct tcphdr); 53 | 54 | struct 55 | { 56 | struct tcphdr th; 57 | uint8_t payload[plen - sizeof (struct tcphdr)]; 58 | } packet; 59 | 60 | memset (&packet, 0, sizeof (packet)); 61 | packet.th.th_sport = sport; 62 | packet.th.th_dport = port; 63 | packet.th.th_seq = htonl ((ttl << 24) | (n << 16) | getpid ()); 64 | packet.th.th_off = sizeof (packet.th) / 4; 65 | packet.th.th_flags = TH_SYN | (ecn ? (TH_ECE | TH_CWR) : 0); 66 | packet.th.th_win = htons (TCP_WINDOW); 67 | 68 | return send_payload (fd, &packet, plen, ttl); 69 | } 70 | 71 | 72 | static ssize_t 73 | parse_syn_resp (const void *data, size_t len, int *ttl, unsigned *n, 74 | uint16_t port) 75 | { 76 | const struct tcphdr *pth = (const struct tcphdr *)data; 77 | uint32_t seq; 78 | 79 | if ((len < sizeof (*pth)) 80 | || (pth->th_dport != sport) 81 | || (pth->th_sport != port) 82 | || ((pth->th_flags & TH_ACK) == 0) 83 | || (((pth->th_flags & TH_SYN) != 0) == ((pth->th_flags & TH_RST) != 0)) 84 | || (pth->th_off < (sizeof (*pth) / 4))) 85 | return -1; 86 | 87 | seq = ntohl (pth->th_ack) - 1; 88 | if ((seq & 0xffff) != (unsigned)getpid ()) 89 | return -1; 90 | 91 | *ttl = seq >> 24; 92 | *n = (seq >> 16) & 0xff; 93 | return 1 + ((pth->th_flags & TH_SYN) == TH_SYN); 94 | } 95 | 96 | 97 | static ssize_t 98 | parse_syn_error (const void *data, size_t len, int *ttl, unsigned *n, 99 | uint16_t port) 100 | { 101 | const struct tcphdr *pth = (const struct tcphdr *)data; 102 | uint32_t seq; 103 | 104 | if ((len < 8) 105 | || (pth->th_sport != sport) 106 | || (pth->th_dport != port)) 107 | return -1; 108 | 109 | seq = ntohl (pth->th_seq); 110 | if ((seq & 0xffff) != (unsigned)getpid ()) 111 | return -1; 112 | 113 | *ttl = seq >> 24; 114 | *n = (seq >> 16) & 0xff; 115 | return 0; 116 | } 117 | 118 | 119 | const tracetype syn_type = 120 | { SOCK_STREAM, IPPROTO_TCP, 16, 121 | send_syn_probe, parse_syn_resp, parse_syn_error }; 122 | 123 | 124 | /* TCP/ACK probes */ 125 | static ssize_t 126 | send_ack_probe (int fd, unsigned ttl, unsigned n, size_t plen, uint16_t port) 127 | { 128 | if (plen < sizeof (struct tcphdr)) 129 | plen = sizeof (struct tcphdr); 130 | 131 | struct 132 | { 133 | struct tcphdr th; 134 | uint8_t payload[plen - sizeof (struct tcphdr)]; 135 | } packet; 136 | 137 | memset (&packet, 0, sizeof (packet)); 138 | packet.th.th_sport = sport; 139 | packet.th.th_dport = port; 140 | packet.th.th_ack = htonl ((ttl << 24) | (n << 16) | getpid ()); 141 | packet.th.th_off = sizeof (packet.th) / 4; 142 | packet.th.th_flags = TH_ACK; 143 | packet.th.th_win = htons (TCP_WINDOW); 144 | 145 | return send_payload (fd, &packet, plen, ttl); 146 | } 147 | 148 | 149 | static ssize_t 150 | parse_ack_resp (const void *data, size_t len, int *ttl, unsigned *n, 151 | uint16_t port) 152 | { 153 | const struct tcphdr *pth = (const struct tcphdr *)data; 154 | uint32_t seq; 155 | 156 | if ((len < sizeof (*pth)) 157 | || (pth->th_dport != sport) 158 | || (pth->th_sport != port) 159 | || (pth->th_flags & TH_SYN) 160 | || (pth->th_flags & TH_ACK) 161 | || ((pth->th_flags & TH_RST) == 0) 162 | || (pth->th_off < (sizeof (*pth) / 4))) 163 | return -1; 164 | 165 | seq = ntohl (pth->th_seq); 166 | if ((seq & 0xffff) != (unsigned)getpid ()) 167 | return -1; 168 | 169 | *ttl = seq >> 24; 170 | *n = (seq >> 16) & 0xff; 171 | return 0; 172 | } 173 | 174 | 175 | static ssize_t 176 | parse_ack_error (const void *data, size_t len, int *ttl, unsigned *n, 177 | uint16_t port) 178 | { 179 | const struct tcphdr *pth = (const struct tcphdr *)data; 180 | uint32_t seq; 181 | 182 | if ((len < 8) 183 | || (pth->th_sport != sport) 184 | || (pth->th_dport != port)) 185 | return -1; 186 | 187 | seq = ntohl (pth->th_ack); 188 | if ((seq & 0xffff) != (unsigned)getpid ()) 189 | return -1; 190 | 191 | *ttl = seq >> 24; 192 | *n = (seq >> 16) & 0xff; 193 | return 0; 194 | } 195 | 196 | 197 | const tracetype ack_type = 198 | { SOCK_STREAM, IPPROTO_TCP, 16, 199 | send_ack_probe, parse_ack_resp, parse_ack_error }; 200 | 201 | -------------------------------------------------------------------------------- /src/trace-udp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * traceroute.c - TCP/IPv6 traceroute tool 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2005-2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #undef _GNU_SOURCE 25 | #define _DEFAULT_SOURCE 1 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include // SOCK_DGRAM 33 | #include 34 | #include 35 | 36 | #include "traceroute.h" 37 | 38 | 39 | /* UDP probes (traditional traceroute) */ 40 | static ssize_t 41 | send_udp_probe (int fd, unsigned ttl, unsigned n, size_t plen, uint16_t port) 42 | { 43 | if (plen < sizeof (struct udphdr)) 44 | plen = sizeof (struct udphdr); 45 | 46 | struct 47 | { 48 | struct udphdr uh; 49 | uint8_t payload[plen - sizeof (struct udphdr)]; 50 | } packet; 51 | memset (&packet, 0, plen); 52 | 53 | (void)n; 54 | packet.uh.uh_sport = sport; 55 | packet.uh.uh_dport = htons (ntohs (port) + ttl); 56 | /* For UDP-Lite we have full checksum coverage, if only because the 57 | * IPV6_CHECKSUM setsockopt only supports full coverage. Hence 58 | * we can set coverage to the length of the packet, even though zero 59 | * would be more idiosyncrasic. */ 60 | packet.uh.uh_ulen = htons (plen); 61 | /*if (plen > sizeof (struct udphdr)) 62 | packet.payload[0] = (uint8_t)ttl;*/ 63 | 64 | return send_payload (fd, &packet, plen, ttl); 65 | } 66 | 67 | 68 | static ssize_t 69 | parse_udp_error (const void *data, size_t len, int *ttl, unsigned *n, 70 | uint16_t port) 71 | { 72 | const struct udphdr *puh = (const struct udphdr *)data; 73 | uint16_t rport; 74 | 75 | if ((len < 4) || (puh->uh_sport != sport )) 76 | return -1; 77 | 78 | rport = ntohs (puh->uh_dport); 79 | port = ntohs (port); 80 | if ((rport < port) || (rport > port + 255)) 81 | return -1; 82 | 83 | *ttl = rport - port; 84 | *n = (unsigned)(-1); 85 | return 0; 86 | } 87 | 88 | 89 | const tracetype udp_type = 90 | { SOCK_DGRAM, IPPROTO_UDP, 6, 91 | send_udp_probe, NULL, parse_udp_error }; 92 | const tracetype udplite_type = 93 | { SOCK_DGRAM, IPPROTO_UDPLITE, 6, 94 | send_udp_probe, NULL, parse_udp_error }; 95 | -------------------------------------------------------------------------------- /src/traceroute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * traceroute.h - TCP/IPv6 traceroute tool common header 3 | */ 4 | 5 | /************************************************************************* 6 | * Copyright © 2005-2006 Rémi Denis-Courmont. * 7 | * This program is free software: you can redistribute and/or modify * 8 | * it under the terms of the GNU General Public License as published by * 9 | * the Free Software Foundation, versions 2 or 3 of the license. * 10 | * * 11 | * This program is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 | * GNU General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU General Public License * 17 | * along with this program. If not, see . * 18 | *************************************************************************/ 19 | 20 | #ifndef NDISC6_TRACEROUTE_H 21 | # define NDISC6_TRACEROUTE_H 22 | 23 | typedef ssize_t (*trace_send_t) (int fd, unsigned ttl, unsigned n, 24 | size_t plen, uint16_t port); 25 | 26 | typedef ssize_t (*trace_parser_t) (const void *restrict data, size_t len, 27 | int *restrict ttl, 28 | unsigned *restrict n, uint16_t port); 29 | 30 | typedef struct tracetype 31 | { 32 | int gai_socktype; 33 | int protocol; 34 | int checksum_offset; 35 | trace_send_t send_probe; 36 | trace_parser_t parse_resp, parse_err; 37 | } tracetype; 38 | 39 | # ifdef __cplusplus 40 | extern "C" { 41 | # endif 42 | 43 | ssize_t send_payload (int fd, const void *payload, size_t length, int hlim); 44 | 45 | # ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | extern bool ecn; 50 | extern uint16_t sport; 51 | 52 | extern const tracetype udp_type, udplite_type, echo_type, syn_type, ack_type; 53 | 54 | #ifndef IPPROTO_UDPLITE 55 | # define IPPROTO_UDPLITE 136 56 | #endif 57 | 58 | #endif 59 | --------------------------------------------------------------------------------