diff options
author | Lennart Poettering <lennart@poettering.net> | 2003-09-13 11:41:48 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2003-09-13 11:41:48 +0000 |
commit | ec6cea168c42ba0d84b1024d7d2c0b38b41a5cee (patch) | |
tree | 52f9f79e8795d14bf6ec6fd0f161f32c46e55b0e | |
parent | ea15d5e9dc4d56a7c5b8f6024fd159a68cd5f070 (diff) | |
parent | 3466defa6628261499d050c92769beacb9dd792e (diff) |
tag 0.17b againtags/release-0.17b
git-svn-id: file:///home/lennart/svn/public/ifplugd/tags/release-0.17b@51 2bf48fe7-cfc1-0310-909f-d9042e1e0fef
37 files changed, 6 insertions, 4913 deletions
@@ -1,4 +1,4 @@ -0.17b :: 13 Sep 2003 :: SVN 45 +0.17b :: 13 Sep 2003 :: SVN 48 Fixed some typos 0.17 :: 13 Sep 2003 :: SVN 42 diff --git a/doc/README.html.in b/doc/README.html.in index df3a95b..ca9d27e 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -43,6 +43,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p> <h2><a name="news">News</a></h2> <div class="news-date">Fri Sep 13 2003: </div> <p class="news-text"><a +href="@PACKAGE_URL@ifplugd-0.17b.tar.gz">Version +0.17b</a> released, changes include: typo and date fix</p> + +<div class="news-date">Fri Sep 13 2003: </div> <p class="news-text"><a href="@PACKAGE_URL@ifplugd-0.17.tar.gz">Version 0.17</a> released, changes include: documentation update, better support for multiple interfaces, gcc 2.95 build fix</p> @@ -274,7 +278,7 @@ manpage</p> <hr/> <address>Lennart Poettering <@PACKAGE_BUGREPORT@>, July 2003</address> -<div><i>$Id: README.html.in 9 2003-07-05 17:59:40Z lennart $</i></div> +<div><i>$Id$</i></div> </body> </html> diff --git a/trunk/LICENSE b/trunk/LICENSE deleted file mode 100644 index d60c31a..0000000 --- a/trunk/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/trunk/Makefile.am b/trunk/Makefile.am deleted file mode 100644 index 13d8694..0000000 --- a/trunk/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -EXTRA_DIST=bootstrap.sh README LICENSE ifplugd.spec -SUBDIRS=src man conf doc patches - -MAINTAINERCLEANFILES = README ifplugd.spec -noinst_DATA = README ifplugd.spec - -README: - rm -f README - $(MAKE) -C doc README - ln -s doc/README README - -homepage: all dist - test -d $$HOME/homepage/lennart - mkdir -p $$HOME/homepage/lennart/projects/ifplugd - cp *.tar.gz $$HOME/homepage/lennart/projects/ifplugd - cp man/ifplugd.8.xml man/ifstatus.8.xml man/ifplugd.conf.5.xml man/man.css man/man.xsl doc/README.html doc/style.css doc/NEWS $$HOME/homepage/lennart/projects/ifplugd - cp $$HOME/homepage/lennart/projects/ifplugd/README.html $$HOME/homepage/lennart/projects/ifplugd/index.html - - -distcleancheck: - @: - -.PHONY: homepage distcleancheck diff --git a/trunk/bootstrap.sh b/trunk/bootstrap.sh deleted file mode 100755 index 583cdea..0000000 --- a/trunk/bootstrap.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# $Id: bootstrap.sh 20 2003-07-10 16:21:55Z lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -if [ "x$1" = "xam" ] ; then - set -ex - automake -a -c - ./config.status -else - set -ex - -# make maintainer-clean || true - - rm -rf autom4te.cache - rm -f config.cache - - aclocal - autoheader - automake -a -c - autoconf -Wall - - ./configure --sysconfdir=/etc "$@" -fi diff --git a/trunk/conf/Makefile.am b/trunk/conf/Makefile.am deleted file mode 100644 index 743aa41..0000000 --- a/trunk/conf/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -noinst_DATA = ifplugd.init ifplugd.action ifplugd.conf - -EXTRA_DIST = ifplugd.init.in ifplugd.action ifplugd.conf - -CLEANFILES = ifplugd.init - -ifplugd.init: ifplugd.init.in Makefile - sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@sbindir\@,$(sbindir),g' $< > $@ - chmod 755 $@ - -install-data-local: ifplugd.init - $(INSTALL) -b -D -m755 ifplugd.init ${DESTDIR}/${sysconfdir}/init.d/ifplugd - $(INSTALL) -b -D -m755 $(srcdir)/ifplugd.action ${DESTDIR}/${sysconfdir}/ifplugd/ifplugd.action - $(INSTALL) -b -D -m644 $(srcdir)/ifplugd.conf ${DESTDIR}/${sysconfdir}/ifplugd/ifplugd.conf - -uninstall-local: - rm -f ${DESTDIR}/${sysconfdir}/ifplugd/ifplugd.action ${DESTDIR}/${sysconfdir}/ifplugd/ifplugd.conf ${DESTDIR}/${sysconfdir}/init.d/ifplugd diff --git a/trunk/conf/ifplugd.action b/trunk/conf/ifplugd.action deleted file mode 100755 index 463fc0b..0000000 --- a/trunk/conf/ifplugd.action +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# $Id: ifplugd.action 1.4 Wed, 23 Oct 2002 20:49:08 +0200 lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -set -e - -if [ -z "$1" ] || [ -z "$2" ] ; then - echo "Wrong arguments" > /dev/stderr - exit 1 -fi - -[ "$2" = "up" ] && exec /sbin/ifup $1 -[ "$2" = "down" ] && exec /sbin/ifdown $1 - -exit 1 diff --git a/trunk/conf/ifplugd.conf b/trunk/conf/ifplugd.conf deleted file mode 100644 index 1787dd1..0000000 --- a/trunk/conf/ifplugd.conf +++ /dev/null @@ -1,42 +0,0 @@ -# -*-sh-*- -# $Id: ifplugd.conf 1.5 Wed, 13 Nov 2002 22:37:54 +0100 lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -# ifplugd configuration file - -# Please note that this is a bourne shell fragment sourced by the -# init script of ifplugd. - -# Specify the interfaces to control here, separated by spaces. -# Ifplugd processes will be started for each of these interfaces when -# the ifplugd init script is called with the "start" argument. You may -# use the magic string "auto" to make the init script start or stop -# ifplugd processes for ALL eth and wlan interfaces that are available -# according to /proc/net/dev. Note that the list of interfaces -# appearing in /proc/net/dev may depend on which kernel modules you -# have loaded. -INTERFACES="eth0" - -# Additional parameters for ifplugd. -# (Run "ifplugd -h" for further information.) -ARGS="-fwI -u0 -d10" - -# Additional parameters for ifplugd for the specified interface. Note -# that $ARGS is ignored, when a variable like this is set for an -# interface -#ARGS_wlan0="-MwI -u5 -d5" diff --git a/trunk/conf/ifplugd.init.in b/trunk/conf/ifplugd.init.in deleted file mode 100755 index 3064a84..0000000 --- a/trunk/conf/ifplugd.init.in +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# $Id: ifplugd.init 1.6 Sat, 01 Feb 2003 03:00:07 +0100 lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -# ifplugd Brings up/down network automatically -# -# chkconfig: 2345 11 89 -# description: Brings networks interfaces up and down automatically when \ -# the cable is removed / inserted -# -# processname: @sbindir@/ifplugd -# config: @sysconfdir@/ifplugd/ifplugd.conf - -### BEGIN INIT INFO -# Provides: ifplugd -# Required-Start: $network -# X-UnitedLinux-Should-Start: -# Required-Stop: $network -# X-UnitedLinux-Should-Stop: $ -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: ifplugd daemon providing -# Description: Start ifplugd to allow XY and provide YZ -# continued on second line by '#<TAB>' -# should contain enough info for the runlevel editor -# to give admin some idea what this service does and -# what it's needed for ... -# (The Short-Description should already be a good hint.) -### END INIT INFO - -CFG=@sysconfdir@/ifplugd/ifplugd.conf - -IFPLUGD=@sbindir@/ifplugd -test -x $IFPLUGD || exit 0 - -if [ `id -u` != "0" ] && [ "$1" = "start" -o "$1" = "stop" ] ; then - echo "You must be root to start, stop or restart ifplugd." - exit 1 -fi - -[ -f $CFG ] && . $CFG - -VERB="$1" -shift - -[ "x$@" != "x" ] && INTERFACES="$@" - -[ "x$INTERFACES" = "xauto" ] && INTERFACES="`cat /proc/net/dev | awk '{ print $1 }' | egrep '^(eth|wlan)' | cut -d: -f1`" - -case "$VERB" in - start) - echo -n "Starting Network Interface Plugging Daemon:" - for IF in $INTERFACES ; do - A="`eval echo \$\{ARGS_${IF}\}`" - [ -z "$A" ] && A="$ARGS" - $IFPLUGD -i $IF $A - echo -n " $IF" - done - echo "." - ;; - stop) - echo -n "Stopping Network Interface Plugging Daemon:" - for IF in $INTERFACES ; do - $IFPLUGD -k -i $IF - echo -n " $IF" - done - echo "." - ;; - status) - for IF in $INTERFACES ; do - $IFPLUGD -c -i $IF - done - ;; - suspend) - echo -n "Suspending Network Interface Plugging Daemon:" - for IF in $INTERFACES ; do - $IFPLUGD -S -i $IF - echo -n " $IF" - done - echo "." - ;; - resume) - echo -n "Resuming Network Interface Plugging Daemon:" - for IF in $INTERFACES ; do - $IFPLUGD -R -i $IF - echo -n " $IF" - done - echo "." - ;; - force-reload|restart) - $0 stop $INTERFACES - sleep 3 - $0 start $INTERFACES - ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload|status|suspend|resume}" - exit 1 -esac - -exit 0 diff --git a/trunk/configure.ac b/trunk/configure.ac deleted file mode 100644 index 24e03e5..0000000 --- a/trunk/configure.ac +++ /dev/null @@ -1,132 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -# $Id$ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -AC_PREREQ(2.57) -AC_INIT([ifplugd], [0.17b], [mzvscyhtq (at) 0pointer (dot) de]) -AC_CONFIG_SRCDIR([src/ifplugd.c]) -AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([foreign -Wall]) - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC - -AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/ifplugd/]) - -# If using GCC specifiy some additional parameters -if test "x$GCC" = "xyes" ; then - CFLAGS="$CFLAGS -pipe -Wall" -fi - -if test -d /usr/local/stow ; then - AC_MSG_NOTICE([*** Found /usr/local/stow: installing to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) - AC_PREFIX_DEFAULT([/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}]) -fi - -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET - -# Checks for libraries. -AC_CHECK_LIB([daemon], [daemon_fork],, [AC_MSG_ERROR([*** Sorry, you have to install libdaemon ***])]) - -# Checks for header files. -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/time.h syslog.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_PID_T -AC_HEADER_TIME -AC_C_VOLATILE - -# Checks for library functions. -AC_FUNC_FORK -AC_PROG_GCC_TRADITIONAL -AC_FUNC_SELECT_ARGTYPES -#AC_FUNC_MALLOC -AC_TYPE_SIGNAL -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([alarm dup2 memset select setenv socket strchr strdup strerror strrchr strspn]) - -# LYNX documentation generation -AC_ARG_ENABLE(lynx, - AC_HELP_STRING([--disable-lynx], [Turn off lynx usage for documentation generation]), -[case "${enableval}" in - yes) lynx=yes ;; - no) lynx=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-lynx) ;; -esac],[lynx=yes]) - -if test x$lynx = xyes ; then - AC_CHECK_PROG(have_lynx, lynx, yes, no) - - if test x$have_lynx = xno ; then - AC_MSG_ERROR([*** Sorry, you have to install lynx or use --disable-lynx ***]) - fi -fi - -AM_CONDITIONAL([USE_LYNX], [test "x$lynx" = xyes]) - -# XMLTOMAN manpage generation -AC_ARG_ENABLE(xmltoman, - AC_HELP_STRING([--disable-xmltoman], [Disable rebuilding of man pages with xmltoman]), -[case "${enableval}" in - yes) xmltoman=yes ;; - no) xmltoman=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;; -esac],[xmltoman=yes]) - -if test x$xmltoman = xyes ; then - AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no) - - if test x$have_xmltoman = xno ; then - AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***]) - xmltoman=no - fi -fi - -AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes]) - -# subversion release number generation -AC_ARG_ENABLE(subversion, - AC_HELP_STRING([--disable-subversion], [Disable rebuilding of svn-release.h]), -[case "${enableval}" in - yes) subversion=yes ;; - no) subversion=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --disable-subversion]) ;; -esac],[subversion=yes]) - -if test x$subversion = xyes ; then - AC_CHECK_PROG(have_subversion, svn, yes, no) - - if test x$have_subversion = xno ; then - AC_MSG_WARN([*** Not rebuilding svn-release.h as subversion is not found ***]) - subversion=no - fi -fi - -AM_CONDITIONAL([USE_SUBVERSION], [test "x$subversion" = xyes]) - -AC_CONFIG_FILES([src/Makefile Makefile man/Makefile conf/Makefile doc/Makefile doc/README.html patches/Makefile ifplugd.spec]) -AC_OUTPUT diff --git a/trunk/doc/Makefile.am b/trunk/doc/Makefile.am deleted file mode 100644 index 61f2444..0000000 --- a/trunk/doc/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -noinst_DATA = README.html README -EXTRA_DIST = $(noinst_DATA) style.css README.html.in SUPPORTED_DRIVERS NEWS - -MAINTAINERCLEANFILES = README README.html -CLEANFILES = - -if USE_LYNX -README: README.html - lynx --dump $^ | sed 's,file://localhost/.*/doc/README.html,README,' > $@ - -CLEANFILES += README -endif - -tidy: README.html - tidy -e < README.html - -.PHONY: tidy - diff --git a/trunk/doc/NEWS b/trunk/doc/NEWS deleted file mode 100644 index ed64e88..0000000 --- a/trunk/doc/NEWS +++ /dev/null @@ -1,102 +0,0 @@ -0.17b :: 13 Sep 2003 :: SVN 48 - Fixed some typos - -0.17 :: 13 Sep 2003 :: SVN 42 - Init script update - compativility fix for gcc 2.95 - -0.16 :: 13. Aug 2003 :: SVN 31 - Spec file update - Build fixes - monitor mode - init script update - -0.15 :: 10. Jul 2003 :: SVN 16 - umask fix - Documentation update - -0.14 :: 7. Jul 2003 :: SVN 9 - Add WLAN support - Move to Autoconf - Add switch -F - Add suspend/resume - Modify logging - Depend on libdaemon - -0.13 :: 1. Feb 2003 :: PRCS 0.40 - Add note about 3c59x on kernel 2.4.20 to SUPPORTED_DRIVERS - Add Suse/United Linux compatibility - Move Manpages from man/ to share/man/ - Apply patch from Mandrake Linux regarding syslog, potential buffer overflow and more - Reduce stack usage - Remove -Werror from gcc command line - Small improvement to client program logging - Added option -c and adjustet init script accordingly - -0.12 :: 11. Jan 2003 :: PRCS 0.34 - Fix to the specfile (thanks to Asgeir Nilsen) - chkonfig compatibility (the same) - RH6.2 compatibility (thanks to R. Steve McKown) - New option -x (as well) - -0.11 :: 24. Dec 2002 :: PRCS 0.25 - added RPM specfile (thanks to Sean Reifschneider) - Extended SUPPORTED_DRIVERS - -0.10 :: 13. Nov 2002 - Added the option -w - Portability fixes - Corrected daemonizing strategy - Removed PRCS residues from distribution - -0.9 :: 7. Nov 2002 - Automatically remove all IP addresses from interface when doing "interface up" without -a - Add SUPPORTED_DRIVERS - Add patch for 8139too - Added trailing newline to version.h - -0.8 :: 25. Oct. 2002 - Syslog spamming corrected - Makefile fixes - Manpage typos removed - Ignore-failure logic inverted, broken in 0.7 - -0.7 :: 23. Oct. 2002 - Introduced ifstatus - New manpages - Implemented support for SIOCPRIV - Fixed some bashisms and ashisms - Changed -m semantics - set -e in default action script - Created seperate module interface.c for link status detection functions - Documentation update - On request of Enrico Zini: - Environment variables are now exported to the action script - Network devices may be detected automatically - -0.6 :: 14. Oct. 2002 - Documentation fixes - License fixes - Manpage added - New option -q - -0.5 :: n.n. - Workaround for kernel bug triggered by using tcpdump together with ifplugd - -0.4 :: n.n. - Link beat detection fixes - -0.3 :: n.n. - Link beat detection fixes - Syslog cleanup - -0.2 :: 30. Sept. 2002 - New option -m - Command line parsing fixes - Documentation update - Installation script fixes - -0.1 :: 29. Sept. 2002 - Initial version - -$Id$ diff --git a/trunk/doc/README.html.in b/trunk/doc/README.html.in deleted file mode 100644 index ca9d27e..0000000 --- a/trunk/doc/README.html.in +++ /dev/null @@ -1,284 +0,0 @@ -<?xml version="1.0" encoding="iso-8895-15"?> <!-- -*-html-helper-*- --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - -<head> -<title>ifplugd @PACKAGE_VERSION@</title> -<link rel="stylesheet" type="text/css" href="style.css" /> -</head> - -<body> -<h1><a name="top">ifplugd @PACKAGE_VERSION@</a></h1> - -<p><i>Copyright 2002,2003 Lennart Poettering <@PACKAGE_BUGREPORT@></i></p> - -<ul class="toc"> - <li><a href="#license">License</a></li> - <li><a href="#news">News</a></li> - <li><a href="#overview">Overview</a></li> - <li><a href="#status">Status</a></li> - <li><a href="#documentation">Documentation</a></li> - <li><a href="#requirements">Requirements</a></li> - <li><a href="#installation">Installation</a></li> - <li><a href="#acks">Acknowledgements</a></li> - <li><a href="#download">Download</a></li> -</ul> - -<h2><a name="license">License</a></h2> - -<p>This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version.</p> - -<p>This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details.</p> - -<p>You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p> - -<h2><a name="news">News</a></h2> - -<div class="news-date">Fri Sep 13 2003: </div> <p class="news-text"><a -href="@PACKAGE_URL@ifplugd-0.17b.tar.gz">Version -0.17b</a> released, changes include: typo and date fix</p> - -<div class="news-date">Fri Sep 13 2003: </div> <p class="news-text"><a -href="@PACKAGE_URL@ifplugd-0.17.tar.gz">Version -0.17</a> released, changes include: documentation update, better support for multiple interfaces, gcc 2.95 build fix</p> - -<div class="news-date">Thu Aug 13 2003: </div> <p class="news-text"><a -href="@PACKAGE_URL@ifplugd-0.16.tar.gz">Version -0.16</a> released, changes include: RPM spec file added, build fixes, WLAN improvements (including compatibility with the upcoming <tt>waproamd</tt>, a WLAN roaming daemon), monitor mode for use in conjunction with PCMCIA devices, better support for multiple interface setups, <tt>SUPPORTED_DRIVERS</tt> returns</p> - -<div class="news-date">Thu July 10 2003: </div> <p class="news-text"><a -href="@PACKAGE_URL@ifplugd-0.15.tar.gz">Version -0.15</a> released, changes include: bad umask fix, documentation update</p> - -<div class="news-date">Mon July 7 2003: </div> <p class="news-text"><a -href="@PACKAGE_URL@ifplugd-0.14.tar.gz">Version -0.14</a> released, changes include: autoconf usage, new dependency <a -href="http://0pointer.de/lennart/projects/libdaemon/"><tt>libdaemon</tt></a>, wireless LAN support, support for -suspending/resuming, many fixes</p> - -<h2><a name="overview">Overview</a></h2> - -<p><tt>ifplugd</tt> is a Linux daemon which will automatically -configure your ethernet device when a cable is plugged in and -automatically unconfigure it if the cable is pulled. This is useful on -laptops with onboard network adapters, since it will only configure -the interface when a cable is really connected. - -<p><tt>ifplugd</tt> is a rather simplistic approach to this target since it relies -on your distribution's native interface configuration system.</p> - -<p>Some features:</p> - -<ul> - <li>Uses your distribution's native <tt>ifup</tt>/<tt>ifdown</tt> programs.</li> - - <li>May beep when the cable is unplugged, plugged, the interface - configuration succeeded or failed.</li> - - <li>Supports the Linux <tt>SIOCETHTOOL</tt> (newer, aka <tt>ethtool</tt> API), <tt>SIOCGMIIREG</tt> - (older, aka <tt>mii-diag</tt>/<tt>mii-tool</tt> API) and SIOCDEVPRIVATE (oldest, aka - <tt>mii-tool</tt> API) <tt>ioctl()</tt>s for getting link status.</li> - - <li>Syslog support</li> - - <li>Simplistic C source code, just 19k binary (+11k for libdaemon)</li> - - <li>Multiple ethernet interface support</li> - - <li>May ignore short unplugged whiles (<tt>-d</tt> option) or plugged whiles (<tt>-u</tt> - option)</li> - - <li>Support for wireless networking. Whenever an AP is detected the -network is configured.</li> - - <li>Compatibility mode for network devices which do not support cable detection (<tt>-F</tt> option)</li> -</ul> - -<h2><a name="status">Status</a></h2> - -<p>Version 0.14 is stable and has all the sensible features its users could think of.</p> - -<h2><a name="documentation">Documentation</a></h2> - -<p>Have a look on the man pages <a href="@PACKAGE_URL@ifplugd.8.xml"><tt>ifplugd(8)</tt></a>, <a href="@PACKAGE_URL@ifstatus.8.xml"><tt>ifstatus(8)</tt></a>, <a href="@PACKAGE_URL@ifplugd.conf.5.xml"><tt>ifplugd.conf(5)</tt></a>. (A XSLT capable browser is required)</p> - -<h3>Configuration</h3> - -<p>Edit <tt>/etc/ifplugd/ifplugd.conf</tt> for configuration -changes. This file is a bourne shell script sourced by the init script -and used to generate a suiting command line. You may specify more than -one ethernet interface in <tt>INTERFACES</tt>. For each interface a -seperate instance of <tt>ifplugd</tt> is spawned. The arguments specified in -<tt>ARGS</tt> are append to <tt>ifplugd</tt>'s command line. Have a look on -<tt>ifplugd -h</tt> or <tt>man ifplugd</tt> for further information -about the available options.</p> - -<p>The network interface which is controlled by <tt>ifplugd</tt> -should not be configured automatically by your distribution's network -subsystem, since <tt>ifplugd</tt> will do this for you if needed. On -Debian remove interface names beginning with <tt>eth</tt> or -<tt>wlan</tt> from the <tt>auto</tt> option line in -<tt>/etc/network/interfaces</tt>.</p> - -<h3>Troubleshooting</h3> - -<p>When you are using the hotplug subsystem (Debian package -<tt>hotplug</tt>) you may notice that the network device is configured -even when it is not listed on an <tt>auto</tt> line in -<tt>/etc/network/interface</tt>. This may be due to <tt>hotplug</tt> -being configured to <tt>ifup</tt> the network interface when it -becomes available. This was the default behavior in the Debian -<tt>hotplug</tt> package prior to release <tt>0.0.20030117-1</tt>, for -example. To prevent this you should either upgrade your -<tt>hotplug</tt> package or comment out the <tt>ifup</tt> call in -<tt>/etc/hotplug/net.agent</tt>.</p> - -<p>When using <tt>ifplugd</tt> together with APM (and probably ACPI) -suspends, strange things may happen: some network devices fail to -detect the network cable for a short period of time before and after -the suspend. When using the <tt>-f</tt> switch, this will be treated -as "no link beat", thus the network is shutdown after a -timeout. During this timeout the machine changes to suspended -state. When it is resumed again, the timeout will be run out, the -network is deconfigured, however, as the next cable detection -succeeds, the network is configured again immediately. To fix this -problem, <tt>ifplugd</tt> should be disabled before the APM suspend -and enabled back after the suspend. This may be done by using -<tt>apmd</tt> and adding a script to -<tt>/etc/apm/{suspend,resume}.d</tt> which simply calls -<tt>/etc/init.d/ifplugd suspend</tt>, resp. <tt>/etc/init.d/ifplugd -resume</tt>. It might even be a good idea to shut down the network -completely during suspend, this may be achieved by calling -<tt>/etc/init.d/ifplugd stop</tt> and <tt>/etc/init.d/ifplugd -start</tt> in the appropriate places. I strongly urge the packagers of -this software for the Linux distributions to add such scripts to their -packages.</p> - -<h3>FAQ</h3> - -<ol> - <li><p><b>Q:</b> I want to use <tt>ifplugd</tt> with my PCMCIA device, but <tt>ifplugd</tt> quits - when it doesn't find <tt>eth0</tt>, when I have not inserted the - card. What can I do?</p> - - <p><b>A:</b> Use the <tt>-f</tt> switch. This is not very clean however, - since modprobe is called on each cable detection query of <tt>ifplugd</tt> to - load a module for the network device. This is suboptimal. You should - probably run <tt>ifplugd</tt> only when the card is really inserted.</p> - </li> - - <li><p><b>Q:</b> I am using the <tt>-f</tt> switch, but the kernel logs are getting filled - with messages like "<tt>modprobe: modprobe: Can't locate module - eth0</tt>". What can I do?</p> - - <p><b>A:</b> Make sure you have a line like <tt>alias eth0 off</tt> in your <tt>/etc/modules.conf</tt></p> - </li> - - <li><p><b>Q:</b> When the cable is unplugged and the interface shut down it is - still available with <tt>ifconfig</tt> and markes as UP. Why this?</p> - - <p><b>A:</b> <tt>ifplugd</tt> cannot detect the link beat with a shut down interface on - certain (most as of kernel 2.4.19) network drivers. Thus <tt>ifplugd</tt> - enables the interface before querying the link status. This may - be switched off with -a flag. You might want to use it if you - have a sane network driver (e.g. <tt>eepro100</tt>). The subdirectory - <tt>patches/</tt> in the <tt>ifplugd</tt> distribution includes a patch for the - 8139too 0.9.26 driver, which makes the driver compatible with - -a. Don't ask me how to apply this patch. If you don't know, you - won't need it.</p></li> - - <li><p><b>Q:</b> Does it work with anything else than plain ethernet or wireless LAN?</p> - - <p><b>A:</b> Certainly not, since the <tt>MII</tt> and -<tt>ETHTOOL</tt> <tt>ioctl()</tt>s and the wireless extension don't -exist on - other network device types.</p></li> - - <li><p><b>Q:</b> I have a Realtek 8139 based network card. Everytime <tt>ifplugd</tt> - starts on bootup my machine freezes. What can I do?</p> - - <p><b>A:</b> This is a bug in the <tt>8139too</tt> driver 0.9.25 (at least) shipped - with Linux 2.4.19, please upgrade to <tt>8139too</tt> 0.9.26 (Linux 2.4.20 - or seperately at <a href="http://www.sourceforge.net/projects/gkernel/">http://www.sourceforge.net/projects/gkernel/</a>).</p></li> - - - <li><p><b>Q:</b> There are already <tt>laptop-net</tt>'s <tt>ifd</tt> and <tt>miid</tt>, why did you write - your own daemon?</p> - - <p><b>A:</b> <tt>laptop-net</tt> simply sucks and I didn't know of <tt>miid</tt> when I wrote - <tt>ifplugd</tt>. However, <tt>ifplugd</tt> is far better than <tt>miid</tt>. For a - comparison of <tt>miid</tt> and <tt>ifplugd</tt>, have a look on - - <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=162763&repeatmerged=yes">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=162763&repeatmerged=yes</a></p></li> -</ol> - - -<h2><a name="requirements">Requirements</a></h2> - -<p>A newer Linux Kernel (I think 2.2 is good enough, alltough I tested it -only with 2.4) with a compatible device driver and -ethernet card. Most modern cards and drivers are compatible, like mine -which works with the <tt>8139too</tt> driver.</p> - -<p><tt>ifplugd</tt> was developed and tested on Debian GNU/Linux -"testing" from July 2003, it should work on most other Linux -distributions (and maybe Unix versions) since it uses GNU autoconf and -GNU libtool for source code configuration and shared library -management.</p> - -<p>The machine used was a Medion 9580-F laptop with a Realtek 8139 -network card and a PRISM1 PCMCIA wireless LAN card.</p> - -<p><tt>ifplugd</tt> needs <a -href="http://0pointer.de/lennart/projects/libdaemon/"><tt>libdaemon</tt></a>.</p> - -<h2><a name="installation">Installation</a></h2> - -<p>As this package is made with the GNU autotools you should run -<tt>./configure</tt> inside the distribution directory for configuring -the source tree. After that you should run <tt>make</tt> for -compilation and <tt>make install</tt> (as root) for installation of -<tt>ifplugd</tt>.</p> - -<p>The installation scripts create an init script in -<tt>${sysconfdir}/init.d/ifplugd</tt>, however no <tt>/etc/rc?.d/</tt> links are created -for it.</p> - -<h2><a name="acks">Acknowledgements</a></h2> - -<p>For the developers of <tt>mii-diag</tt>, <tt>ethtool</tt> and <tt>laptop-net</tt>, since I looked -on their source codes for learning how to use the link beat ioctls.</p> - -<p>Oliver Kurth for packaging <tt>ifplugd</tt> for Debian and <tt>ifplugd</tt>'s -manpage</p> - -<p>Asgeir Nilsen, Sean Reifschneider, R. Steve McKown, David Mitchell for patches</p> - -<p>Frederic Lepied for integrating <tt>ifplugd</tt> into Mandrake Linux</p> - -<h2><a name="download">Download</a></h2> - -<p>The newest release is always available from <a href="@PACKAGE_URL@">@PACKAGE_URL@</a></p> - -<p>The current release is <a href="@PACKAGE_URL@ifplugd-@PACKAGE_VERSION@.tar.gz">@PACKAGE_VERSION@</a></p> - -<p>Get <tt>ifplugd</tt>'s development sources from the <a href="http://subversion.tigris.org/">Subversion</a> <a href="https://seth.intheinter.net:8081/svn/ifplugd/">repository</a>.</p> - -<p>You may find a mostly up to date Debian package of <tt>ifplugd</tt> on the <a href="http://packages.debian.org/ifplugd">Debian package repository</a>.</p> - -<p>Packages for Mandrake Linux may be found in the Cooker distribution; Gentoo packages are available as well</p> - -<hr/> -<address>Lennart Poettering <@PACKAGE_BUGREPORT@>, July 2003</address> -<div><i>$Id$</i></div> - -</body> -</html> diff --git a/trunk/doc/SUPPORTED_DRIVERS b/trunk/doc/SUPPORTED_DRIVERS deleted file mode 100644 index b47a1dc..0000000 --- a/trunk/doc/SUPPORTED_DRIVERS +++ /dev/null @@ -1,24 +0,0 @@ -The following list is a short summary of user experiences with certain -network drivers. - -The version prefixed with k is the driver version of the specific -kernel, the version prefixed with d is the driver version. Versions -suffixed with p are patched with a patch supplied with ifplugd. - -Driver | Version | Support ----------+----------------------+------------------------------------------------ -eepro100 | k2.4.19 | works fine, even with -a -e100 | k2.4.20 | works fine, even with -a -8139too | k2.4.19 | the machine may lock up, doesn't work with -a -8139too | k2.4.20 or d0.9.26 | works, doesn't work with -a -8139too | k2.4.20p or d0.9.26p | works, even with -a -de4x5 | k2.4.18 | Fails completely -tulip | k2.4.18 | works; does it work with -a??? -3c59x | k2.4.19 and .20 | Works, even with -a -hostap | d0.0.3 | Works, even with -a - -Please help me to extend this list and send me -(mzvscyhtq [at] itaparica.org) more information about your -experience with drivers not included in the list above yet. - -$Id: SUPPORTED_DRIVERS 1.4 Sat, 01 Feb 2003 02:36:25 +0100 lennart $ diff --git a/trunk/doc/style.css b/trunk/doc/style.css deleted file mode 100644 index 85c060c..0000000 --- a/trunk/doc/style.css +++ /dev/null @@ -1,29 +0,0 @@ -/* $Id: style.css 8 2003-07-05 15:14:33Z lennart $ */ - -/*** - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - ***/ - -body { color: black; background-color: white; margin: 0.5cm; } -a:link, a:visited { color: #900000; } -p { margin-left: 0.5cm; margin-right: 0.5cm; } -div.news-date { margin-left: 0.5cm; font-size: 80%; color: #4f0000; } -p.news-text { margin-left: 1cm; } -ul { margin-left: 0.5cm; } -h1 { color: #00009F; } -h2 { color: #00009F; } -h3 { color: #00004F; margin-left: 0.5cm; } diff --git a/trunk/ifplugd.spec.in b/trunk/ifplugd.spec.in deleted file mode 100644 index 848d49d..0000000 --- a/trunk/ifplugd.spec.in +++ /dev/null @@ -1,67 +0,0 @@ -%define debug_package %{nil} - -Summary: Detect and perform actions when an ethernet cable is (un)plugged. -Name: ifplugd -Version: @PACKAGE_VERSION@ -Release: 1 -Copyright: GPL -Group: Networking/Daemons -URL: http://www.stud.uni-hamburg.de/users/lennart/projects/ifplugd/ -Source: %{name}-%{version}.tar.gz -Packager: Diego Santa Cruz <Diego.SantaCruz@epfl.ch> -BuildRoot: %{_tmppath}/%{name}-%{version}-root -BuildPrereq: libdaemon-devel - -%description -ifplugd is a Linux daemon which will automatically configure your -ethernet device when a cable is plugged in and automatically -unconfigure it if the cable is pulled. This is useful on laptops with -network adapters onboard , since it will only configure the interface -when a cable is really connected. - -ifplugd is a rather simplistic approach to this target since it relies -on your distribution's native interface configuration system. - -%prep -%setup -q -%build -%configure -make - -%install -[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" -mkdir -p "$RPM_BUILD_ROOT"/usr/sbin -make DESTDIR=$RPM_BUILD_ROOT PREFIX=%{prefix} install - -%clean -[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" - -%post -/sbin/chkconfig --add ifplugd - -%preun -/sbin/chkconfig --del ifplugd - -%files -%defattr(755,root,root) -%doc LICENSE README -%doc doc/README.html doc/style.css -%{_sbindir}/ifplugd -%{_sbindir}/ifstatus -%{_mandir}/man?/ifplugd* -%{_mandir}/man?/ifstatus* -%{_sysconfdir}/init.d/ifplugd -%config %{_sysconfdir}/ifplugd/ifplugd.conf -%config %{_sysconfdir}/ifplugd/ifplugd.action - -%changelog - -* Mon Jul 21 2003 Lennart Poettering 0.16 -- Modified slightly to be auto generated by autoconf - -* Wed Jul 16 2003 Diego Santa Cruz <Diego.SantaCruz@epfl.ch> 0.15 -- Updated to version 0.15 -- Make it depend on libdaemon - -* Thu Jan 9 2003 Asgeir Nilsen <rpmspec@asgeirnilsen.com> 0.11-2 -- Minor adjustments and init file patch diff --git a/trunk/man/Makefile.am b/trunk/man/Makefile.am deleted file mode 100644 index 742e3bf..0000000 --- a/trunk/man/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -man_MANS = ifplugd.8 ifplugd.conf.5 ifstatus.8 - -noinst_DATA = ifplugd.8.xml ifplugd.conf.5.xml ifstatus.8.xml - -EXTRA_DIST = $(man_MANS) ifplugd.8.xml.in ifplugd.conf.5.xml.in ifstatus.8.xml.in man.css man.xsl - -CLEANFILES = ifplugd.8.xml ifplugd.conf.5.xml ifstatus.8.xml - -ifplugd.8.xml: ifplugd.8.xml.in Makefile - sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@sbindir\@,$(sbindir),g' -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@ - -ifplugd.conf.5.xml: ifplugd.conf.5.xml.in Makefile - sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@sbindir\@,$(sbindir),g' -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@ - -ifstatus.8.xml: ifstatus.8.xml.in Makefile - sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@sbindir\@,$(sbindir),g' -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@ - -if USE_XMLTOMAN - -CLEANFILES += $(man_MANS) - -ifplugd.8: ifplugd.8.xml Makefile - xmltoman $< > $@ - -ifplugd.conf.5: ifplugd.conf.5.xml Makefile - xmltoman $< > $@ - -ifstatus.8: ifstatus.8.xml Makefile - xmltoman $< > $@ - -endif - diff --git a/trunk/man/ifplugd.8.xml.in b/trunk/man/ifplugd.8.xml.in deleted file mode 100644 index d259608..0000000 --- a/trunk/man/ifplugd.8.xml.in +++ /dev/null @@ -1,283 +0,0 @@ -<?xml version="1.0" standalone='no'?> -<!DOCTYPE manpage SYSTEM "man.dtd"> -<?xml-stylesheet type="text/xsl" href="man.xsl" ?> - -<!-- $Id$ --> - -<!-- - This file is part of ifplugd. - - ifplugd is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your - option) any later version. - - ifplugd is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with ifplugd; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ---> - - <manpage name="ifplugd" section="8" desc="A link detection daemon for ethernet devices"> - - <synopsis> - <cmd>ifplugd [<arg>options</arg>]</cmd> - </synopsis> - - <description> - <p>ifplugd is a daemon which will automatically configure your - ethernet device when a cable is plugged in and automatically - unconfigure it if the cable is pulled. This is useful on - laptops with on-board network adapters, since it will only - configure the interface when a cable is really connected.</p> - - <p>It uses your distribution's native ifup/ifdown programs, but - can be configured to do anything you wish when the state of - the interface changes. It may ignore short unplugged whiles - (<opt>-d</opt> option) or plugged whiles (<opt>-u</opt> - option).</p> - - <p>ifplugd may be used in "compatibility mode" by specifying -F - on the command line. Than ifplugd will treat network drivers - which do not support link beat querying as always online.</p> - </description> - - <options> - - <option> - <p><opt>-a | --no-auto</opt></p> - <optdesc><p> - Do not enable interface automatically (default: off) - </p></optdesc> - </option> - - <option> - <p><opt>-n | --no-daemon</opt></p> - <optdesc><p> - Do not daemonize (for debugging) (default: off) - </p></optdesc> - </option> - - <option> - <p><opt>-s | --no-syslog</opt></p> - <optdesc><p> - Do not use syslog, use stdout instead (for debugging) (default: off). - </p></optdesc> - </option> - - <option> - <p><opt>-b | --no-beep</opt></p> - <optdesc><p> - Do not beep (off) - </p></optdesc> - </option> - - <option> - <p><opt>-f | --ignore-fail</opt></p> - <optdesc><p> - Ignore detection failure, retry instead. Failure is treated as "no link". (default: off) - </p></optdesc> - </option> - - <option> - <p><opt>-F | --ignore-fail-positive</opt></p> - <optdesc><p> - Ignore detection failure, retry instead. Failure is treated as "link detected". (default: off) - </p></optdesc> - </option> - - <option> - <p><opt>-i | --iface=</opt> <arg>IFACE</arg></p> - <optdesc><p> - Specify ethernet interface (default: eth0) - </p></optdesc> - </option> - - <option> - <p><opt>-r | --run=</opt> <arg>EXEC</arg></p> - <optdesc><p> - Specify program to execute when link status changes (default: <file>@sysconfdir@/ifplugd/ifplugd.action</file>) - </p></optdesc> - </option> - - <option> - <p><opt>-I | --ignore-retval</opt></p> - <optdesc><p> - Don't exit on nonzeor return value of program execute don link change. (default: off) - </p></optdesc> - </option> - - <option> - <p><opt>-t | --poll-time=</opt> <arg>SECS</arg></p> - <optdesc><p> - Specify poll time in seconds (default: 1) - </p></optdesc> - </option> - - <option> - <p><opt>-u | --delay-up=</opt> <arg>SECS</arg></p> - <optdesc><p> - Specify delay for configuring interface (default: 0) - </p></optdesc> - </option> - - <option> - <p><opt>-d | --delay-down=</opt> <arg>SECS</arg></p> - <optdesc><p> - Specify delay for deconfiguring interface (default: 5) - </p></optdesc> - </option> - - <option> - <p><opt>-m | --api-mode=</opt> <arg>MODE</arg></p> <optdesc><p> - Force a specific link beat detection ioctl() API. Possible - values are auto, wlan, ethtool, mii, and priv for automatic - detection, wireless extension, SIOCETHTOOL, SIOCGMIIREG - resp. SIOCPRIV. Only the first character of the argument is - relevant, case insensitive. (default: auto) </p></optdesc> - </option> - - <option> - <p><opt>-q | --no-shutdown</opt></p> - <optdesc><p> - Don't call the script for network shutdown on deamon quit (default: off) - </p></optdesc> - </option> - - <option> - <p><opt>-w | --wait-on-fork</opt></p> - - <optdesc><p> When daemonizing, wait until the background - process finished with the initial link beat detection. When - this is enabled, the parent process will return the link - status on exit. 1 means link beat detected, 2 stands for link - beat not detected, everything else is an error. - </p></optdesc> - </option> - - <option> - <p><opt>-x | --extra-arg=</opt> <arg>ARG</arg></p> - <optdesc><p> - Specify an extra argument to be passed to the action script. - </p></optdesc> - </option> - - <option> - <p><opt>-M | --monitor</opt></p> - <optdesc><p> - Don't fail when the network interface is not available, instead use NETLINK to monitor device avaibility. The is useful for PCMCIA devices and similar. - </p></optdesc> - </option> - - <option> - <p><opt>-h | --help</opt></p> - <optdesc><p> - Show help - </p></optdesc> - </option> - - <option> - <p><opt>-k | --kill</opt></p> - <optdesc><p> - Kill a running daemon (Specify -i to select the daemon instance to kill) - </p></optdesc> - </option> - - <option> - <p><opt>-c | --check-running</opt></p> - <optdesc><p> - Check if a daemon is running for a given network interface. Sets the return value to 0 if a daemon is already running or to 255 if not. - </p></optdesc> - </option> - - <option> - <p><opt>-v | --version</opt></p> - <optdesc><p> - Show version - </p></optdesc> - </option> - - <option> - <p><opt>-S | --supend</opt></p> <optdesc><p> Suspend a running - daemon. The daemon will no longer check the link status until - it is resumed (-R) again. (Specify -i to select the daemon instance - to suspend.) </p></optdesc> - </option> - - <option> - <p><opt>-R | --resume</opt></p> <optdesc><p> Resume a suspended - daemon. (Specify -i to select the daemon instance - to resume.) </p></optdesc> - </option> - - <option> - <p><opt>-z | --info</opt></p> <optdesc><p>Request that a - running daemon shall write its status information to - syslog. (Specify -i to select the daemon instance to send the - request to.) </p></optdesc> - </option> - - </options> - - <section name="Files"> - - <p><file>@sysconfdir@/ifplugd/ifplugd.conf</file>: this file is sourced - by the init script <file>@sysconfdir@/init.d/ifplugd</file> and - contains the interface to be monitored and the options to be - used.</p> - - <p><file>@sysconfdir@/ifplugd/ifplugd.action</file>: this is the script - which will be called by the daemon whenever the state of the - interface changes. It takes two areguments: the first is the interface - name (eg. eth0), the second either "up" or "down". </p> - - <p><file>/var/run/ifplugd.<iface>.pid</file>: the pid file - for ifplugd.</p> - - </section> - - <section name="Environment"> - <p>The action script will be called with two environment variables set:</p> - - <p><arg>IFPLUGD_PREVIOUS</arg> The previous link status. Either - "up", "down", "error" or "disabled". The former values should be - obvious, the latter is set on daemon startup.</p> - - <p><arg>IFPLUGD_CURRENT</arg> The current link status. See above - for possible values.</p> - - </section> - - <section name="Signals"> - <p><arg>SIGINT, SIGTERM</arg> ifplugd will quit, possibly running the shutdown script. This is issued by passing -k to ifplugd.</p> - <p><arg>SIGQUIT</arg> ifplugd will quit, the shutdown script is never run.</p> - <p><arg>SIGHUP</arg> ifplugd will write its status information to syslog. This is issued by -z.</p> - <p><arg>SIGUSR1</arg> ifplugd will go to suspend mode. (-S)</p> - <p><arg>SIGUSR2</arg> ifplugd will resume from suspend mode. (-R)</p> - </section> - - <section name="Author"> - <p>ifplugd was written by Lennart Poettering - <@PACKAGE_BUGREPORT@>. ifplugd is available - at <url - href="@PACKAGE_URL@"/> - </p> - </section> - - <section name="See also"> - <p> - <manref name="ifplugd.conf" section="5"/>, <manref name="ifup" section="8"/>, <manref name="interfaces" - section="5"/>, <manref name="ifconfig" section="8"/> - </p> - </section> - - <section name="Comments"> - <p>This man page was written using <manref name="xmltoman" section="1" - href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p> - </section> - - </manpage> diff --git a/trunk/man/ifplugd.conf.5.xml.in b/trunk/man/ifplugd.conf.5.xml.in deleted file mode 100644 index 563a489..0000000 --- a/trunk/man/ifplugd.conf.5.xml.in +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" standalone='no'?> -<!DOCTYPE manpage SYSTEM "man.dtd"> -<?xml-stylesheet type="text/xsl" href="man.xsl" ?> - -<!-- $Id$ --> - -<!-- - This file is part of ifplugd. - - ifplugd is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your - option) any later version. - - ifplugd is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with ifplugd; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ---> - - <manpage name="ifplugd.conf" section="5" desc="ifplugd configuration file"> - - <synopsis> - <cmd>@sysconfdir@/ifplugd/ifplugd.conf</cmd> - </synopsis> - - <description> - <p>ifplugd.conf is the configuration file for ifplugd. It is a - shell script that is sourced by the init script starting - the daemon. It shall be used to set environment variables which - are interpreted by the init script:</p> - </description> - - <options> - - <option> - <p><opt>INTERFACES</opt></p> <optdesc><p>Specifies the - ethernet interfaces to monitor. It has to contain a space - seperated list of network interfaces names. Most users will - probably use "eth0" here, however you may add additional - interfaces for monitoring more than one device. A special - value is supported as well: "auto" will enable a more or less - working auto detection of available network devices. This - won't make you happy when using network module auto loading, - since it cannot detect currently unloaded network - devices.</p></optdesc> - </option> - - <option> - <p><opt>ARGS</opt></p> <optdesc><p>Additional command line - arguments for ifplugd invocation. See <manref name="ifplugd" - section="8"/> for further information.</p></optdesc> - </option> - - - <option> - <p><opt>ARGS_</opt><arg>iface</arg></p> - - <optdesc><p>If specified for an interface this variable takes precedence over ARGS. This may be useful if more than one network device is present.</p></optdesc> - </option> - </options> - - <section name="See also"> - <p> - <manref name="ifplugd" section="8"/> - </p> - </section> - - <section name="Comments"> - <p>This man page was written using <manref name="xmltoman" section="1" - href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p> - </section> - - </manpage> diff --git a/trunk/man/ifstatus.8.xml.in b/trunk/man/ifstatus.8.xml.in deleted file mode 100644 index 61b246a..0000000 --- a/trunk/man/ifstatus.8.xml.in +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE manpage SYSTEM "man.dtd"> -<?xml-stylesheet type="text/xsl" href="man.xsl" ?> - -<!-- $Id$ --> - -<!-- - This file is part of ifplugd. - - ifplugd is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your - option) any later version. - - ifplugd is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with ifplugd; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ---> - - <manpage name="ifstatus" section="8" desc="A link beat detection tool"> - - <synopsis> - <cmd>ifstatus [<arg>options</arg>] [<arg>INTERFACE</arg>]</cmd> - </synopsis> - - <description> - <p>ifstatus is an utility which may be used to detect the link - status of a local Linux ethernet device, much in the same way - mii-diag, mii-tool and ethtool work. In fact it supports all - three different APIs these three tools use. Thus, it provides - maximal compatibility. The newest API (ethtool) is used first, - than the next older (mii-diag) and at last the oldest - (mii-tool). It may be used in shell script since it returns the - current status as return value. It is especially useful to - detect the available APIs on the used network driver. (Option - <opt>-v</opt>)</p> - </description> - - <options> - - <p>You may speicify an ethernet device on the command - line. Otherwise ifstatus will check for eth0..eth9 - automatically.</p> - - <option> - <p><opt>-a | --auto</opt></p> - <optdesc><p> - Enable interface automatically before querying (default: off) - </p></optdesc> - </option> - - - <option> - <p><opt>-h | --help</opt></p> - <optdesc><p> - Show help - </p></optdesc> - </option> - - <option> - <p><opt>-q | --quiet</opt></p> <optdesc><p>Decrease verbosity - by one. If the verbosity is < 0, no text will be shown, - only the return value is relevant; if the verbosity is = 0, a - terse status will be shown; If the verbosity is > 0, - detailed information about the used API is returned. (By - default the verbosity is 0)</p></optdesc> - </option> - - <option> - <p><opt>-v | --verbose</opt></p> - <optdesc><p> - Increase verbosity by one. See option <opt>-q</opt>. - </p></optdesc> - </option> - - <option> - <p><opt>-V | --version</opt></p> - <optdesc><p> - Show version - </p></optdesc> - </option> - - </options> - - <section name="Return values"> - <p><arg>0</arg> Success</p> - <p><arg>1</arg> Failure</p> - <p><arg>2</arg> Link beat detected (only available when an interface is specified)</p> - <p><arg>3</arg> Unplugged (same here)</p> - </section> - - <section name="Author"> - <p>ifplugd was written by Lennart Poettering - <@PACKAGE_BUGREPORT@>. ifplugd is available - at <url - href="@PACKAGE_URL@"/> - </p> - </section> - - <section name="See also"> - <p> - <manref name="mii-diag" section="8"/>, <manref name="mii-tool" - section="8"/>, <manref name="ethtool" section="8"/> - </p> - </section> - - <section name="Comments"> - <p>This man page was written using <manref name="xml2man" section="1" - href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p> - </section> - - </manpage> diff --git a/trunk/man/man.css b/trunk/man/man.css deleted file mode 100644 index 0892e4f..0000000 --- a/trunk/man/man.css +++ /dev/null @@ -1,30 +0,0 @@ -/* $Id$ */ - -/*** - This file is part of ifplugd. - - ifplugd is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your - option) any later version. - - ifplugd is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with ifplugd; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -***/ - -body { color: black; background-color: white; margin: 0.5cm; } -a:link, a:visited { color: #900000; } -h1 { text-transform:uppercase; font-size: 18pt; color: #00009F; } -p { margin-left:1cm; margin-right:1cm; } -.cmd { font-family:monospace; } -.file { font-family:monospace; } -.arg { text-transform:uppercase; font-family:monospace; font-style: italic; } -.opt { font-family:monospace; font-weight: bold; } -.manref { font-family:monospace; } -.option .optdesc { margin-left:2cm; } diff --git a/trunk/man/man.xsl b/trunk/man/man.xsl deleted file mode 100644 index e633de1..0000000 --- a/trunk/man/man.xsl +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> - -<!-- - This file is part of ifplugd. - - ifplugd is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your - option) any later version. - - ifplugd is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with ifplugd; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ---> - -<xsl:template match="/manpage"> - <xsl:text disable-output-escaping="yes"> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - </xsl:text> - <html> - - <head> - <title> - <xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>) - </title> - <link rel="stylesheet" type="text/css" href="man.css"/> - </head> - <body> - <h1>Name</h1> - <p><xsl:value-of select="@name"/> - <xsl:if test="string-length(@desc) > 0"> - - <xsl:value-of select="@desc"/> - </xsl:if> - </p> - <xsl:apply-templates /> - </body> - </html> -</xsl:template> - -<xsl:template match="p"> - <p> - <xsl:apply-templates/> - </p> -</xsl:template> - -<xsl:template match="cmd"> - <p class="cmd"> - <xsl:apply-templates/> - </p> -</xsl:template> - -<xsl:template match="arg"> - <span class="arg"><xsl:apply-templates/></span> -</xsl:template> - -<xsl:template match="opt"> - <span class="opt"><xsl:apply-templates/></span> -</xsl:template> - -<xsl:template match="file"> - <span class="file"><xsl:apply-templates/></span> -</xsl:template> - -<xsl:template match="optdesc"> - <div class="optdesc"> - <xsl:apply-templates/> - </div> -</xsl:template> - -<xsl:template match="synopsis"> - <h1>Synopsis</h1> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="seealso"> - <h1>Synopsis</h1> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="description"> - <h1>Description</h1> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="options"> - <h1>Options</h1> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="section"> - <h1><xsl:value-of select="@name"/></h1> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="option"> - <div class="option"><xsl:apply-templates/></div> -</xsl:template> - -<xsl:template match="manref"> - <xsl:choose> - <xsl:when test="string-length(@href) > 0"> - <a class="manref"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</a> - </xsl:when> - <xsl:otherwise> - <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -<xsl:template match="url"> - <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a> -</xsl:template> - -</xsl:stylesheet> diff --git a/trunk/patches/8139too.c.0.9.26.patch b/trunk/patches/8139too.c.0.9.26.patch deleted file mode 100644 index 3979a33..0000000 --- a/trunk/patches/8139too.c.0.9.26.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 8139too.c.dist Thu Oct 31 23:45:04 2002 -+++ 8139too.c Thu Oct 31 23:45:46 2002 -@@ -2449,8 +2449,8 @@ - int rc = 0; - int phy = tp->phys[0] & 0x3f; - -- if (!netif_running(dev)) -- return -EINVAL; -+// if (!netif_running(dev)) -+// return -EINVAL; - - if (cmd != SIOCETHTOOL) { - /* With SIOCETHTOOL, this would corrupt the pointer. */ diff --git a/trunk/patches/Makefile.am b/trunk/patches/Makefile.am deleted file mode 100644 index 0650e7a..0000000 --- a/trunk/patches/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -EXTRA_DIST = 8139too.c.0.9.26.patch - diff --git a/trunk/src/Makefile.am b/trunk/src/Makefile.am deleted file mode 100644 index 63b0f6a..0000000 --- a/trunk/src/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# $Id$ - -# This file is part of ifplugd. -# -# ifplugd is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# ifplugd is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with ifplugd; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -AM_CFLAGS = -DSYSCONFDIR="\"$(sysconfdir)\"" - -sbin_PROGRAMS = ifplugd ifstatus - -ifplugd_SOURCES = ifplugd.c \ - interface.c interface.h \ - ethtool-kernel.h ethtool-local.h \ - wireless.h wireless.15.h \ - ifmonitor.h ifmonitor.c \ - nlapi.h nlapi.c \ - svn-revision.h - -ifstatus_SOURCES = ifstatus.c \ - interface.c interface.h \ - ethtool-kernel.h ethtool-local.h \ - wireless.h wireless.15.h \ - svn-revision.h - -MAINTAINERCLEANFILES = -BUILT_SOURCES = - -if USE_SUBVERSION -MAINTAINERCLEANFILES += svn-revision.h -BUILT_SOURCES += svn-revision.h -endif - -ifstatus.$(OBJEXT): svn-revision.h -ifplugd.$(OBJEXT): svn-revision.h - -if USE_SUBVERSION -svn-revision.h: Makefile - if test -d "$(top_srcdir)/.svn" ; then \ - if REV=`svn info "$(top_srcdir)" | grep ^Revision | cut -f2 -d" "` 2> /dev/null ; then \ - echo -e "#ifndef foosvnrevisionhfoo\n#define foosvnrevisionhfoo\n#define SVN_REVISION \"$$REV\"\n#endif" > $@ ; \ - fi \ - fi - -svnkeywords: - rm -f svn-revision.h - svn propset svn:keywords Id *.c *.h Makefile.am - -.PHONY: svnkeywords -endif - diff --git a/trunk/src/ethtool-kernel.h b/trunk/src/ethtool-kernel.h deleted file mode 100644 index a4af66c..0000000 --- a/trunk/src/ethtool-kernel.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * ethtool.h: Defines for Linux ethtool. - * - * Copyright (C) 1998 David S. Miller (davem@redhat.com) - * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com> - * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) - * Portions Copyright 2002 Intel (eli.kupermann@intel.com, - * christopher.leech@intel.com, - * scott.feldman@intel.com) - */ - -#ifndef _LINUX_ETHTOOL_H -#define _LINUX_ETHTOOL_H - - -/* This should work for both 32 and 64 bit userland. */ -struct ethtool_cmd { - u32 cmd; - u32 supported; /* Features this interface supports */ - u32 advertising; /* Features this interface advertises */ - u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ - u8 duplex; /* Duplex, half or full */ - u8 port; /* Which connector port */ - u8 phy_address; - u8 transceiver; /* Which tranceiver to use */ - u8 autoneg; /* Enable or disable autonegotiation */ - u32 maxtxpkt; /* Tx pkts before generating tx int */ - u32 maxrxpkt; /* Rx pkts before generating rx int */ - u32 reserved[4]; -}; - -#define ETHTOOL_BUSINFO_LEN 32 -/* these strings are set to whatever the driver author decides... */ -struct ethtool_drvinfo { - u32 cmd; - char driver[32]; /* driver short name, "tulip", "eepro100" */ - char version[32]; /* driver version string */ - char fw_version[32]; /* firmware version string, if applicable */ - char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ - /* For PCI devices, use pci_dev->slot_name. */ - char reserved1[32]; - char reserved2[20]; - u32 testinfo_len; - u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ - u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ -}; - -#define SOPASS_MAX 6 -/* wake-on-lan settings */ -struct ethtool_wolinfo { - u32 cmd; - u32 supported; - u32 wolopts; - u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ -}; - -/* for passing single values */ -struct ethtool_value { - u32 cmd; - u32 data; -}; - -/* for passing big chunks of data */ -struct ethtool_regs { - u32 cmd; - u32 version; /* driver-specific, indicates different chips/revs */ - u32 len; /* bytes */ - u8 data[0]; -}; - -/* for passing EEPROM chunks */ -struct ethtool_eeprom { - u32 cmd; - u32 magic; - u32 offset; /* in bytes */ - u32 len; /* in bytes */ - u8 data[0]; -}; - -/* for configuring coalescing parameters of chip */ -struct ethtool_coalesce { - u32 cmd; /* ETHTOOL_{G,S}COALESCE */ - - /* How many usecs to delay an RX interrupt after - * a packet arrives. If 0, only rx_max_coalesced_frames - * is used. - */ - u32 rx_coalesce_usecs; - - /* How many packets to delay an RX interrupt after - * a packet arrives. If 0, only rx_coalesce_usecs is - * used. It is illegal to set both usecs and max frames - * to zero as this would cause RX interrupts to never be - * generated. - */ - u32 rx_max_coalesced_frames; - - /* Same as above two parameters, except that these values - * apply while an IRQ is being services by the host. Not - * all cards support this feature and the values are ignored - * in that case. - */ - u32 rx_coalesce_usecs_irq; - u32 rx_max_coalesced_frames_irq; - - /* How many usecs to delay a TX interrupt after - * a packet is sent. If 0, only tx_max_coalesced_frames - * is used. - */ - u32 tx_coalesce_usecs; - - /* How many packets to delay a TX interrupt after - * a packet is sent. If 0, only tx_coalesce_usecs is - * used. It is illegal to set both usecs and max frames - * to zero as this would cause TX interrupts to never be - * generated. - */ - u32 tx_max_coalesced_frames; - - /* Same as above two parameters, except that these values - * apply while an IRQ is being services by the host. Not - * all cards support this feature and the values are ignored - * in that case. - */ - u32 tx_coalesce_usecs_irq; - u32 tx_max_coalesced_frames_irq; - - /* How many usecs to delay in-memory statistics - * block updates. Some drivers do not have an in-memory - * statistic block, and in such cases this value is ignored. - * This value must not be zero. - */ - u32 stats_block_coalesce_usecs; - - /* Adaptive RX/TX coalescing is an algorithm implemented by - * some drivers to improve latency under low packet rates and - * improve throughput under high packet rates. Some drivers - * only implement one of RX or TX adaptive coalescing. Anything - * not implemented by the driver causes these values to be - * silently ignored. - */ - u32 use_adaptive_rx_coalesce; - u32 use_adaptive_tx_coalesce; - - /* When the packet rate (measured in packets per second) - * is below pkt_rate_low, the {rx,tx}_*_low parameters are - * used. - */ - u32 pkt_rate_low; - u32 rx_coalesce_usecs_low; - u32 rx_max_coalesced_frames_low; - u32 tx_coalesce_usecs_low; - u32 tx_max_coalesced_frames_low; - - /* When the packet rate is below pkt_rate_high but above - * pkt_rate_low (both measured in packets per second) the - * normal {rx,tx}_* coalescing parameters are used. - */ - - /* When the packet rate is (measured in packets per second) - * is above pkt_rate_high, the {rx,tx}_*_high parameters are - * used. - */ - u32 pkt_rate_high; - u32 rx_coalesce_usecs_high; - u32 rx_max_coalesced_frames_high; - u32 tx_coalesce_usecs_high; - u32 tx_max_coalesced_frames_high; - - /* How often to do adaptive coalescing packet rate sampling, - * measured in seconds. Must not be zero. - */ - u32 rate_sample_interval; -}; - -/* for configuring RX/TX ring parameters */ -struct ethtool_ringparam { - u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ - - /* Read only attributes. These indicate the maximum number - * of pending RX/TX ring entries the driver will allow the - * user to set. - */ - u32 rx_max_pending; - u32 rx_mini_max_pending; - u32 rx_jumbo_max_pending; - u32 tx_max_pending; - - /* Values changeable by the user. The valid values are - * in the range 1 to the "*_max_pending" counterpart above. - */ - u32 rx_pending; - u32 rx_mini_pending; - u32 rx_jumbo_pending; - u32 tx_pending; -}; - -/* for configuring link flow control parameters */ -struct ethtool_pauseparam { - u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ - - /* If the link is being auto-negotiated (via ethtool_cmd.autoneg - * being true) the user may set 'autonet' here non-zero to have the - * pause parameters be auto-negotiated too. In such a case, the - * {rx,tx}_pause values below determine what capabilities are - * advertised. - * - * If 'autoneg' is zero or the link is not being auto-negotiated, - * then {rx,tx}_pause force the driver to use/not-use pause - * flow control. - */ - u32 autoneg; - u32 rx_pause; - u32 tx_pause; -}; - -#define ETH_GSTRING_LEN 32 -enum ethtool_stringset { - ETH_SS_TEST = 0, - ETH_SS_STATS, -}; - -/* for passing string sets for data tagging */ -struct ethtool_gstrings { - u32 cmd; /* ETHTOOL_GSTRINGS */ - u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ - u32 len; /* number of strings in the string set */ - u8 data[0]; -}; - -enum ethtool_test_flags { - ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ - ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ -}; - -/* for requesting NIC test and getting results*/ -struct ethtool_test { - u32 cmd; /* ETHTOOL_TEST */ - u32 flags; /* ETH_TEST_FL_xxx */ - u32 reserved; - u32 len; /* result length, in number of u64 elements */ - u64 data[0]; -}; - -/* CMDs currently supported */ -#define ETHTOOL_GSET 0x00000001 /* Get settings. */ -#define ETHTOOL_SSET 0x00000002 /* Set settings, privileged. */ -#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ -#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers, privileged. */ -#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ -#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options, priv. */ -#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ -#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */ -#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv. */ -#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ -#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ -#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data, priv. */ -#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ -#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config, priv. */ -#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ -#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */ -#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ -#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters, priv. */ -#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ -#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ -#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ -#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ -#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable - * (ethtool_value) */ -#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable - * (ethtool_value), priv. */ -#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */ -#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ -#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ - -/* compatibility with older code */ -#define SPARC_ETH_GSET ETHTOOL_GSET -#define SPARC_ETH_SSET ETHTOOL_SSET - -/* Indicates what features are supported by the interface. */ -#define SUPPORTED_10baseT_Half (1 << 0) -#define SUPPORTED_10baseT_Full (1 << 1) -#define SUPPORTED_100baseT_Half (1 << 2) -#define SUPPORTED_100baseT_Full (1 << 3) -#define SUPPORTED_1000baseT_Half (1 << 4) -#define SUPPORTED_1000baseT_Full (1 << 5) -#define SUPPORTED_Autoneg (1 << 6) -#define SUPPORTED_TP (1 << 7) -#define SUPPORTED_AUI (1 << 8) -#define SUPPORTED_MII (1 << 9) -#define SUPPORTED_FIBRE (1 << 10) -#define SUPPORTED_BNC (1 << 11) - -/* Indicates what features are advertised by the interface. */ -#define ADVERTISED_10baseT_Half (1 << 0) -#define ADVERTISED_10baseT_Full (1 << 1) -#define ADVERTISED_100baseT_Half (1 << 2) -#define ADVERTISED_100baseT_Full (1 << 3) -#define ADVERTISED_1000baseT_Half (1 << 4) -#define ADVERTISED_1000baseT_Full (1 << 5) -#define ADVERTISED_Autoneg (1 << 6) -#define ADVERTISED_TP (1 << 7) -#define ADVERTISED_AUI (1 << 8) -#define ADVERTISED_MII (1 << 9) -#define ADVERTISED_FIBRE (1 << 10) -#define ADVERTISED_BNC (1 << 11) - -/* The following are all involved in forcing a particular link - * mode for the device for setting things. When getting the - * devices settings, these indicate the current mode and whether - * it was foced up into this mode or autonegotiated. - */ - -/* The forced speed, 10Mb, 100Mb, gigabit. */ -#define SPEED_10 10 -#define SPEED_100 100 -#define SPEED_1000 1000 - -/* Duplex, half or full. */ -#define DUPLEX_HALF 0x00 -#define DUPLEX_FULL 0x01 - -/* Which connector port. */ -#define PORT_TP 0x00 -#define PORT_AUI 0x01 -#define PORT_MII 0x02 -#define PORT_FIBRE 0x03 -#define PORT_BNC 0x04 - -/* Which tranceiver to use. */ -#define XCVR_INTERNAL 0x00 -#define XCVR_EXTERNAL 0x01 -#define XCVR_DUMMY1 0x02 -#define XCVR_DUMMY2 0x03 -#define XCVR_DUMMY3 0x04 - -/* Enable or disable autonegotiation. If this is set to enable, - * the forced link modes above are completely ignored. - */ -#define AUTONEG_DISABLE 0x00 -#define AUTONEG_ENABLE 0x01 - -/* Wake-On-Lan options. */ -#define WAKE_PHY (1 << 0) -#define WAKE_UCAST (1 << 1) -#define WAKE_MCAST (1 << 2) -#define WAKE_BCAST (1 << 3) -#define WAKE_ARP (1 << 4) -#define WAKE_MAGIC (1 << 5) -#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ - -#endif /* _LINUX_ETHTOOL_H */ diff --git a/trunk/src/ethtool-local.h b/trunk/src/ethtool-local.h deleted file mode 100644 index 19a1cf9..0000000 --- a/trunk/src/ethtool-local.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef fooethtoollocalhfoo -#define fooethtoollocalhfoo - -/* $Id: ethtool-local.h 1.2 Wed, 23 Oct 2002 20:49:08 +0200 lennart $ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -typedef unsigned long long u64; -typedef __uint32_t u32; -typedef __uint16_t u16; -typedef __uint8_t u8; - -#include "ethtool-kernel.h" - -#endif - diff --git a/trunk/src/ifmonitor.c b/trunk/src/ifmonitor.c deleted file mode 100644 index 83e9bb8..0000000 --- a/trunk/src/ifmonitor.c +++ /dev/null @@ -1,78 +0,0 @@ -/* $Id$ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <stdio.h> -#include <sys/socket.h> -#include <linux/types.h> -#include <linux/netlink.h> -#include <linux/rtnetlink.h> -#include <linux/if.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include <libdaemon/dlog.h> - -#include "nlapi.h" - -static int callback(struct nlmsghdr *n, void *u) { - int (*cb)(int b, int index, unsigned short type, const char *name) = u; - - if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) { - struct rtattr *a; - struct ifinfomsg *i; - char ifname[IFNAMSIZ+1]; - int la; - - i = NLMSG_DATA(n); - - if (n->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg))) { - daemon_log(LOG_ERR, "NETLINK: Packet too small or truncated! (2)\n"); - return -1; - } - - memset(&ifname, 0, sizeof(ifname)); - - a = (void*) i + NLMSG_ALIGN(sizeof(struct ifinfomsg)); - la = NLMSG_PAYLOAD(n, sizeof(struct ifinfomsg)); - - while (RTA_OK(a, la)) { - - if(a->rta_type == IFLA_IFNAME) { - int l = RTA_PAYLOAD(a); - if (l > IFNAMSIZ) - l = IFNAMSIZ; - strncpy(ifname, RTA_DATA(a), l); - } - - a = RTA_NEXT(a, la); - } - - if (cb(n->nlmsg_type == RTM_NEWLINK, i->ifi_index, i->ifi_type, ifname[0] ? ifname : NULL) < 0) - return -1; - } - - - return 0; -} - -int ifmonitor_init(int (*cb) (int b, int index, unsigned short type, const char *name)) { - return nlapi_register(callback, cb); -} diff --git a/trunk/src/ifmonitor.h b/trunk/src/ifmonitor.h deleted file mode 100644 index ada8855..0000000 --- a/trunk/src/ifmonitor.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef fooifmonitorhfoo -#define fooifmonitorhfoo - -/* $Id: ifplugd.c 1.12 Sat, 01 Feb 2003 03:00:07 +0100 lennart $ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -int ifmonitor_init(int (*cb) (int b, int index, unsigned short type, const char *name)); - -#endif diff --git a/trunk/src/ifplugd.c b/trunk/src/ifplugd.c deleted file mode 100644 index 18c883b..0000000 --- a/trunk/src/ifplugd.c +++ /dev/null @@ -1,904 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* $Id$ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#define _GNU_SOURCE - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <signal.h> -#include <unistd.h> -#include <sys/wait.h> -#include <errno.h> -#include <sys/stat.h> -#include <getopt.h> -#include <stdarg.h> -#include <syslog.h> -#include <fcntl.h> -#include <linux/kd.h> -#include <sys/ioctl.h> -#include <limits.h> -#include <net/if.h> -#include <linux/sockios.h> -#include <sys/types.h> -#include <ctype.h> -#include <sys/time.h> -#include <time.h> - -#include <libdaemon/dlog.h> -#include <libdaemon/dpid.h> -#include <libdaemon/dsignal.h> -#include <libdaemon/dfork.h> - -#include "ethtool-local.h" -#include "interface.h" -#include "nlapi.h" -#include "ifmonitor.h" -#include "svn-revision.h" - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#define VARRUN "/var/run" -#define IFPLUGD_ENV_PREVIOUS "IFPLUGD_PREVIOUS" -#define IFPLUGD_ENV_CURRENT "IFPLUGD_CURRENT" - -int interface_auto_up = 1, - interface_do_message = 1; - -char *interface = NULL; -char *run = SYSCONFDIR"/ifplugd/ifplugd.action"; -char *extra_arg = NULL; - -int polltime = 1, - delay_up = 0, - delay_down = 5; - -int daemonize = 1, - use_beep = 1, - no_shutdown_script = 0, - wait_on_fork = 0, - use_syslog = 1, - ignore_retval = 0, - initial_down = 0, - use_ifmonitor = 0; - -int disabled = 0; - -interface_status_t failure_status = IFSTATUS_ERR; - -enum { API_AUTO, API_ETHTOOL, API_MII, API_PRIVATE, API_WLAN } api_mode = API_AUTO; - -interface_status_t (*detect_beat_func)(int, char*); -interface_status_t (*cached_detect_beat_func)(int, char*) = NULL; - -// 0: high, 1: low, 2: very low -void beep(int b) { - int fd = -1, argp; - - if (!use_beep) - return; - - if ((fd = open("/dev/tty1", O_WRONLY)) < 0) { - use_beep = 0; - daemon_log(LOG_WARNING, "Could not open /dev/tty, cannot beep."); - goto finish; - } - - switch (b) { - case 0: argp = (100<<16) + 0x637; break; - case 1: argp = (100<<16) + 0x937; break; - default: argp = (100<<16) + 0x1237; break; - } - - if (ioctl(fd, KDMKTONE, argp) != 0) { - use_beep = 0; - daemon_log(LOG_WARNING, "Beep failure, disabled."); - goto finish; - } - - usleep((argp >> 16)*1000); - -finish: - - if (fd >= 0) - close(fd); - - return; -} - -const char *pid_file_proc() { - static char fn[PATH_MAX]; - snprintf(fn, sizeof(fn), "%s/ifplugd.%s.pid", VARRUN, interface); - return fn; -} - -int action(interface_status_t status) { - pid_t pid; - int _pipe[2]; - unsigned n = 0; - static char buf[256]; - char *arg = (status == IFSTATUS_UP ? "up" : "down"); - int sigfd, r; - fd_set rfds; - - daemon_log(LOG_INFO, "Executing '%s %s %s'.", run, interface, arg); - - if (pipe(_pipe) < 0) { - daemon_log(LOG_ERR, "pipe() failed: %s", strerror(errno)); - return -1; - } - - if ((pid = fork()) < 0) { - daemon_log(LOG_ERR, "fork() failed: %s", strerror(errno)); - return -1; - - } else if (pid == 0) { - dup2(_pipe[1], 1); - dup2(_pipe[1], 2); - - if (_pipe[0] > 2) - close(_pipe[0]); - - if (_pipe[1] > 2) - close(_pipe[1]); - - umask(0022); // Set up a sane umask - - execl(run, run, interface, arg, extra_arg, 0); - - _exit(EXIT_FAILURE); - } - - close(_pipe[1]); - - FD_ZERO(&rfds); - FD_SET(_pipe[0], &rfds); - FD_SET(sigfd = daemon_signal_fd(), &rfds); - - n = 0; - - for (;;) { - fd_set wrfds = rfds; - - if (select(FD_SETSIZE, &wrfds, NULL, NULL, NULL) < 0) { - - if (errno == EINTR) - continue; - - break; - } - - - if (FD_ISSET(_pipe[0], &wrfds)) { - char c; - - if (read(_pipe[0], &c, 1) != 1) - break; - - buf[n] = c; - - if (c == '\n' || n >= sizeof(buf) - 2) { - if (c != '\n') n++; - buf[n] = 0; - - if (buf[0]) - daemon_log(LOG_WARNING, "client: %s", buf); - - n = 0; - } else - n++; - } - - if (FD_ISSET(sigfd, &wrfds)) { - int sig; - - if ((sig = daemon_signal_next()) < 0) { - daemon_log(LOG_ERR, "daemon_signal_next(): %s", strerror(errno)); - break; - } - - if (sig != SIGCHLD) { - daemon_log(LOG_WARNING, "Killing child."); - kill(pid, SIGTERM); - } - - break; - } - - } - - if (n > 0) { - buf[n] = 0; - daemon_log(LOG_WARNING, "client: %s", buf); - } - - waitpid(pid, &r, 0); - - close(_pipe[0]); - - if (!WIFEXITED(r) || WEXITSTATUS(r) != 0) { - if (status == IFSTATUS_UP) - beep(2); - daemon_log(LOG_ERR, "Program execution failed, return value is %i.", WEXITSTATUS(r)); - - return ignore_retval ? 0 : -1; - } else { - if (status == IFSTATUS_UP) - beep(0); - - daemon_log(LOG_INFO, "Program executed successfully."); - return 0; - } -} - -interface_status_t detect_beat_auto(int fd, char *iface) { - interface_status_t status; - - if (cached_detect_beat_func && (status = cached_detect_beat_func(fd, iface)) != IFSTATUS_ERR) - return status; - - if ((status = interface_detect_beat_mii(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_mii; - daemon_log(LOG_INFO, "Using detection mode: SIOCGMIIPHY"); - return status; - } - - if ((status = interface_detect_beat_ethtool(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_ethtool; - daemon_log(LOG_INFO, "Using detection mode: SIOCETHTOOL"); - return status; - } - - if ((status = interface_detect_beat_wlan(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_wlan; - daemon_log(LOG_INFO, "Using detection mode: wireless extension"); - return status; - } - - if ((status = interface_detect_beat_priv(fd, iface)) != IFSTATUS_ERR) { - cached_detect_beat_func = interface_detect_beat_priv; - daemon_log(LOG_INFO, "Using detection mode: SIOCDEVPRIVATE"); - return status; - } - - return IFSTATUS_ERR; -} - -char *strstatus(interface_status_t s) { - switch(s) { - case IFSTATUS_UP: return "up"; - case IFSTATUS_DOWN: return "down"; - case IFSTATUS_ERR: return "error"; - default: return "disabled"; - } -} - -interface_status_t detect_beat(int fd, char*iface) { - interface_status_t status; - static interface_status_t last_status = (interface_status_t) -1; - - if (disabled) - return IFSTATUS_DOWN; - - if ((status = detect_beat_func(fd, iface)) == IFSTATUS_ERR) - status = failure_status; - - if (status == IFSTATUS_ERR && detect_beat_func == detect_beat_auto) - daemon_log(LOG_INFO, "Failed to detect plug status of %s", interface); - - if (status != last_status) { - setenv(IFPLUGD_ENV_PREVIOUS, strstatus(last_status), 1); - setenv(IFPLUGD_ENV_CURRENT, strstatus(status), 1); - last_status = status; - } - - return status; -} - -int welcome_iface(int fd, char *iface) { - struct ifreq ifr; - struct ethtool_drvinfo drvinfo; - char txt[256]; - - if (interface_auto_up) - interface_up(fd, iface); - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); - - if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) - snprintf(txt, sizeof(txt)-1, "Using interface %s", iface); - else - snprintf(txt, sizeof(txt)-1, "Using interface %s/%02X:%02X:%02X:%02X:%02X:%02X", iface, ifr.ifr_hwaddr.sa_data[0] & 0xFF, ifr.ifr_hwaddr.sa_data[1] & 0xFF, ifr.ifr_hwaddr.sa_data[2] & 0xFF, ifr.ifr_hwaddr.sa_data[3] & 0xFF, ifr.ifr_hwaddr.sa_data[4] & 0xFF, ifr.ifr_hwaddr.sa_data[5] & 0xFF); - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); - - drvinfo.cmd = ETHTOOL_GDRVINFO; - ifr.ifr_data = (caddr_t) &drvinfo; - - if (ioctl(fd, SIOCETHTOOL, &ifr) != -1) - daemon_log(LOG_INFO, "%s with driver <%s> (version: %s)", txt, drvinfo.driver, drvinfo.version); - else - daemon_log(LOG_INFO, "%s", txt); - - cached_detect_beat_func = NULL; - - return 0; -} - -int ifmonitor_cb(int b, int index, unsigned short type, const char *name) { - if (!name) - return 0; - - if (!strcmp(name, interface)) - disabled = !b; - - return 0; -} - -int is_iface_available(int s, char *p) { - struct ifreq req; - int r; - - memset(&req, 0, sizeof(req)); - strncpy(req.ifr_name, p, IFNAMSIZ); - - if ((r = ioctl(s, SIOCGIFINDEX, &req)) < 0 && errno != ENODEV) { - daemon_log(LOG_ERR, "SIOCGIFINDEX failed: %s\n", strerror(errno)); - return -1; - } - return r >= 0 && req.ifr_ifindex >= 0; -} - -void work(void) { - interface_status_t status; - int fd = -1; - fd_set fds; - int sigfd; - time_t t = 0; - int send_retval = 1; - int paused = 0; - static char log_ident[256]; - - snprintf(log_ident, sizeof(log_ident), "ifplugd(%s)", interface); - - daemon_log_ident = log_ident; - - daemon_log(LOG_INFO, "ifplugd "VERSION" initializing%s.", use_ifmonitor ? ", using NETLINK device monitoring" : ""); - - - if (daemon_pid_file_create() < 0) { - daemon_log(LOG_ERR, "Could not create PID file %s.", daemon_pid_file_proc()); - goto finish; - } - - if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2, -1) < 0) { - daemon_log(LOG_ERR, "Could not register signal handler: %s", strerror(errno)); - goto finish; - } - - switch (api_mode) { - case API_ETHTOOL: detect_beat_func = interface_detect_beat_ethtool; break; - case API_MII: detect_beat_func = interface_detect_beat_mii; break; - case API_PRIVATE: detect_beat_func = interface_detect_beat_priv; break; - case API_WLAN: detect_beat_func = interface_detect_beat_wlan;break; - - default: - detect_beat_func = detect_beat_auto; - interface_do_message = 0; - break; - } - - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - daemon_log(LOG_ERR, "socket(): %s", strerror(errno)); - goto finish; - } - - if (use_ifmonitor) { - int b; - if ((b = is_iface_available(fd, interface)) < 0) { - daemon_log(LOG_ERR, "Failed to check interface availabilty!"); - goto finish; - } - - disabled = !b; - - if (nlapi_open(RTMGRP_LINK) < 0) - goto finish; - - if (ifmonitor_init(ifmonitor_cb) < 0) - goto finish; - } else - disabled = 0; - - if (!disabled) { - if (welcome_iface(fd, interface) < 0) - goto finish; - } - - if ((status = detect_beat(fd, interface)) == IFSTATUS_ERR) - goto finish; - - daemon_log(LOG_INFO, "Initialization complete, link beat %sdetected%s.", status == IFSTATUS_UP ? "" : "not ", use_ifmonitor ? (disabled ? ", interface disabled" : ", interface enabled") : ""); - beep(status == IFSTATUS_UP ? 0 : 1); - - if (status == IFSTATUS_UP || initial_down) - if (action(status) < 0) - goto finish; - - if (daemonize && wait_on_fork) { - char c = status == IFSTATUS_UP ? 2 : (status == IFSTATUS_DOWN ? 3 : 1); - daemon_retval_send(c); - send_retval = 0; - } - - FD_ZERO(&fds); - FD_SET(sigfd = daemon_signal_fd(), &fds); - - if (use_ifmonitor) - FD_SET(nlapi_fd, &fds); - - for (;;) { - interface_status_t s; - fd_set qfds = fds; - int d; - struct timeval tv = { polltime, 0 }; - - if (select(FD_SETSIZE, &qfds, NULL, NULL, &tv) < 0) { - if (errno == EINTR) - continue; - - daemon_log(LOG_ERR, "select(): %s", strerror(errno)); - goto finish; - } - - //daemon_log(LOG_INFO, "select()"); - - d = disabled; - s = status; - - if (use_ifmonitor) { - - if (FD_ISSET(nlapi_fd, &qfds)) { - if (nlapi_work(0) < 0) - goto finish; - } - - if (d && !disabled) { - daemon_log(LOG_INFO, "Interface enabled"); - welcome_iface(fd, interface); - status = IFSTATUS_DOWN; - } - - if (!d && disabled) { - daemon_log(LOG_INFO, "Interface disabled"); - status = IFSTATUS_DOWN; - } - } - - - if (!paused && !disabled) { - //daemon_log(LOG_INFO, "detect"); - if ((status = detect_beat(fd, interface)) == IFSTATUS_ERR) { - if (!use_ifmonitor) - goto finish; - - status = IFSTATUS_DOWN; - } - } - - if (status != s) { - daemon_log(LOG_INFO, "Link beat %s.", status == IFSTATUS_DOWN ? "lost" : "detected"); - beep(status == IFSTATUS_UP ? 0 : 1); - - if (t) - t = 0; - else { - t = time(NULL); - - if (status == IFSTATUS_UP) - t += delay_up; - - if (status == IFSTATUS_DOWN) - t += delay_down; - } - } - - if (FD_ISSET(sigfd, &qfds)) { - int sig; - - if ((sig = daemon_signal_next()) < 0) { - daemon_log(LOG_ERR, "daemon_signal_next(): %s", strerror(errno)); - goto finish; - } - - switch (sig) { - - case SIGINT: - case SIGTERM: - goto cleanup; - - case SIGQUIT: - goto finish; - - case SIGCHLD: - break; - - case SIGHUP: - daemon_log(LOG_INFO, "SIGHUP: %s, link detected on %s: %s", paused ? "Suspended" : "Running", interface, status == IFSTATUS_DOWN ? "no" : "yes"); - - if (use_ifmonitor) - daemon_log(LOG_INFO, "SIGHUP: Interface %s", disabled ? "disabled" : "enabled"); - break; - - case SIGUSR1: - daemon_log(LOG_INFO, "SIGUSR1: Daemon suspended (#%i)", ++paused); - break; - - case SIGUSR2: - if (paused > 0) { - daemon_log(LOG_INFO, "SIGUSR2: Daemon resumed (#%i)", paused); - paused --; - } - - break; - - default: - daemon_log(LOG_INFO, "Ignoring unknown signal %s", strsignal(sig)); - break; - } - } - - if (t && t < time(NULL)) { - t = 0; - - if (action(status) < 0) - goto finish; - } - } - -cleanup: - if (!no_shutdown_script && status == IFSTATUS_UP) { - setenv(IFPLUGD_ENV_PREVIOUS, strstatus(status), 1); - setenv(IFPLUGD_ENV_CURRENT, strstatus(-1), 1); - action(IFSTATUS_DOWN); - beep(1); - } - -finish: - - if (fd >= 0) - close(fd); - - if (use_ifmonitor) - nlapi_close(); - - if (send_retval && daemonize && wait_on_fork) - daemon_retval_send(1); - - daemon_pid_file_remove(); - daemon_signal_done(); - - daemon_log(LOG_INFO, "Exiting."); -} - -void usage(char *p) { - char *m; - - switch (api_mode) { - case API_ETHTOOL: m = "ethtool"; break; - case API_MII: m = "mii"; break; - case API_PRIVATE: m = "priv"; break; - case API_WLAN: m = "wlan"; break; - default: m = "auto"; - } - - if (strrchr(p, '/')) - p = strchr(p, '/')+1; - - printf("%s -- Network Interface Plug Detection Daemon\n\n" - "Usage: %s [options]\n\n" - "Options:\n" - " -a --no-auto Do not enable interface automatically (%s)\n" - " -n --no-daemon Do not daemonize (for debugging) (%s)\n" - " -s --no-syslog Do not use syslog, use stderr instead (for debugging) (%s)\n" - " -b --no-beep Do not beep (%s)\n" - " -f --ignore-fail Ignore detection failure, retry instead (failure is treated as DOWN) (%s)\n" - " -F --ignore-fail-positive Ignore detection failure, retry instead (failure is treated as UP) (%s)\n" - " -i --iface=IFACE Specify ethernet interface (%s)\n" - " -r --run=EXEC Specify program to execute (%s)\n" - " -I --ignore-retval Don't exit on nonzero return value of program executed (%s)\n" - " -t --poll-time=SECS Specify poll time in seconds (%i)\n" - " -u --delay-up=SECS Specify delay for configuring interface (%i)\n" - " -d --delay-down=SECS Specify delay for deconfiguring interface (%i)\n" - " -m --api-mode=MODE Force API mode (mii, priv, ethtool, wlan, auto) (%s)\n" - " -q --no-shutdown Don't run script on daemon quit (%s)\n" - " -l --initial-down Run \"down\" script on startup if now cable is detected (%s)\n" - " -w --wait-on-fork Wait until daemon fork finished (%s)\n" - " -x --extra-arg Specify an extra argument for action script\n" - " -M --monitor Use interface monitoring (%s)\n" - " -h --help Show this help\n" - " -k --kill Kill a running daemon\n" - " -c --check-running Check if a daemon is currently running\n" - " -v --version Show version\n" - " -S --suspend Suspend running daemon\n" - " -R --resume Resume running daemon\n" - " -z --info Write status of running daemon to syslog\n", - p, p, - !interface_auto_up ? "on" : "off", - !daemonize ? "on" : "off", - !use_syslog ? "on" : "off", - !use_beep ? "on" : "off", - failure_status == IFSTATUS_DOWN ? "on" : "off", - failure_status == IFSTATUS_UP ? "on" : "off", - interface, - run, - ignore_retval ? "on" : "off", - polltime, - delay_up, - delay_down, - m, - no_shutdown_script ? "on" : "off", - initial_down ? "on" : "off", - wait_on_fork ? "on" : "off", - use_ifmonitor ? "on" : "off"); -} - -void parse_args(int argc, char *argv[]) { - static struct option long_options[] = { - {"no-auto", no_argument, 0, 'a'}, - {"no-daemon", no_argument, 0, 'n'}, - {"no-syslog", no_argument, 0, 's'}, - {"no-beep", no_argument, 0, 'b'}, - {"ignore-fail", no_argument, 0, 'f'}, - {"ignore-fail-positive", no_argument, 0, 'F'}, - {"ignore-retval", no_argument, 0, 'I'}, - {"iface", required_argument, 0, 'i'}, - {"run", required_argument, 0, 'r'}, - {"poll-time", required_argument, 0, 't'}, - {"delay-up", required_argument, 0, 'u'}, - {"delay-down", required_argument, 0, 'd'}, - {"api-mode", required_argument, 0, 'm'}, - {"wait-on-fork", no_argument, 0, 'w'}, - {"no-shutdown", no_argument, 0, 'q'}, - {"help", no_argument, 0, 'h'}, - {"kill", no_argument, 0, 'k'}, - {"check-running", no_argument, 0, 'c'}, - {"version", no_argument, 0, 'v'}, - {"extra-arg", required_argument, 0, 'x'}, - {"suspend", no_argument, 0, 'S'}, - {"resume", no_argument, 0, 'R'}, - {"info", no_argument, 0, 'z'}, - {"inital-down", no_argument, 0, 'l'}, - {"monitor", no_argument, 0, 'M'}, - {0, 0, 0, 0} - }; - int option_index = 0; - int help = 0, _kill = 0, _check = 0, _version = 0, _suspend = 0, _resume = 0, _info = 0; - - for (;;) { - int c; - - if ((c = getopt_long(argc, argv, "asni:r:t:u:d:hkbfFvm:qwx:cISRzlM", long_options, &option_index)) < 0) - break; - - switch (c) { - case 'a' : - interface_auto_up = !interface_auto_up; - break; - case 's' : - use_syslog = !use_syslog; - break; - case 'n' : - daemonize = !daemonize; - break; - case 'i' : - if (interface) - free(interface); - interface = strdup(optarg); - break; - case 'r': - run = strdup(optarg); - break; - case 'I': - ignore_retval = !ignore_retval; - break; - case 't': - polltime = atoi(optarg); - if (polltime < 0) polltime = 0; - break; - case 'u': - delay_up = atoi(optarg); - break; - case 'd': - delay_down = atoi(optarg); - break; - case 'h': - help = 1; - break; - case 'k': - _kill = 1; - break; - case 'c': - _check = 1; - break; - case 'v': - _version = 1; - break; - case 'b': - use_beep = !use_beep; - break; - case 'f': - failure_status = IFSTATUS_DOWN; - break; - case 'F': - failure_status = IFSTATUS_UP; - break; - case 'm': - switch (tolower(optarg[0])) { - case 'e': api_mode = API_ETHTOOL; break; - case 'm': api_mode = API_MII; break; - case 'p': api_mode = API_PRIVATE; break; - case 'w': api_mode = API_WLAN; break; - case 'a': api_mode = API_AUTO; break; - default: - daemon_log(LOG_ERR, "Unknown API mode: %s\n", optarg); - exit(2); - } - break; - case 'q': - no_shutdown_script = !no_shutdown_script; - break; - case 'l': - initial_down = !initial_down; - break; - case 'w': - wait_on_fork = !wait_on_fork; - break; - case 'x': - extra_arg = strdup(optarg); - break; - case 'S': - _suspend = 1; - break; - case 'R': - _resume = 1; - break; - case 'z': - _info = 1; - break; - case 'M': - use_ifmonitor = !use_ifmonitor; - break; - default: - daemon_log(LOG_ERR, "Unknown parameter.\n"); - exit(1); - } - } - - - if (!interface) - interface = strdup("eth0"); - - if (!use_syslog) - daemon_log_use = DAEMON_LOG_STDERR; - - - if (help) { - usage(argv[0]); - exit(0); - } - - if (_kill || _resume || _suspend || _info) { - if (daemon_pid_file_kill(_kill ? SIGINT : (_resume ? SIGUSR2 : (_info ? SIGHUP : SIGUSR1))) < 0) { - daemon_log(LOG_ERR, "Failed to kill daemon. (%s)", strerror(errno)); - exit(6); - } - - exit(0); - } - - if (_version) { - -#ifdef SVN_REVISION - printf("ifplugd "VERSION" (SVN: "SVN_REVISION")\n"); -#else - printf("ifplugd "VERSION"\n"); -#endif - - exit(0); - } - - if (_check) { - pid_t pid = daemon_pid_file_is_running(); - - if (pid == (pid_t) -1) - printf("ifplugd not running.\n"); - else - printf("ifplugd process for device %s running as pid %u.\n", interface, pid); - - exit(pid == 0 ? 255 : 0); - } - -} - -static volatile int alarmed = 0; - -void sigalrm() { - alarmed = 1; -} - -int main(int argc, char* argv[]) { - - daemon_pid_file_proc = pid_file_proc; - - if ((daemon_log_ident = strrchr(argv[0], '/'))) - daemon_log_ident++; - else - daemon_log_ident = argv[0]; - - parse_args(argc, argv); - - if (geteuid() != 0) { - daemon_log(LOG_ERR, "Sorry, you need to be root to run this binary."); - return 2; - } - - if (daemon_pid_file_is_running() >= 0) { - daemon_log(LOG_ERR, "Sorry, there is already an instance of ifplugd for %s running.", interface); - return 4; - } - - if (daemonize) { - pid_t pid; - - if (wait_on_fork) - if (daemon_retval_init() < 0) { - daemon_log(LOG_ERR, "Sorry, could not create pipe: %s", strerror(errno)); - return 4; - } - - if ((pid = daemon_fork()) < 0) - return 3; - - if (pid) { - int c = 0; - - // Parent process - - if (wait_on_fork) - if ((c = daemon_retval_wait(60)) < 0) { - daemon_log(LOG_WARNING, "Killing background process."); - kill(pid, SIGTERM); - } - - - return c; - } - } - - // Let's go - work(); - return 0; -} diff --git a/trunk/src/ifstatus.c b/trunk/src/ifstatus.c deleted file mode 100644 index 655d16f..0000000 --- a/trunk/src/ifstatus.c +++ /dev/null @@ -1,221 +0,0 @@ -/* $Id: ifstatus.c 1.3 Wed, 13 Nov 2002 22:37:54 +0100 lennart $ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <stdio.h> -#include <errno.h> -#include <string.h> -#include <unistd.h> -#include <getopt.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <net/if.h> - -#include <libdaemon/dlog.h> - -#include "interface.h" -#include "svn-revision.h" - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -int interface_auto_up = 0, interface_do_message = 0; - -int verbose = 0; -char *interface = NULL; - -int handle(char *iface) { - int fd, r = 0; - interface_status_t s; - - if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) - return -1; - - if (verbose > 0) { - printf("%s:\n", iface); - - if ((s = interface_detect_beat_ethtool(fd, iface)) == IFSTATUS_ERR) - printf(" SIOCETHTOOL failed (%s)\n", strerror(errno)); - else - printf(" SIOCETHTOOL: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); - - if ((s = interface_detect_beat_mii(fd, iface)) == IFSTATUS_ERR) - printf(" SIOCGMIIPHY failed (%s)\n", strerror(errno)); - else - printf(" SIOCGMIIPHY: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); - - if ((s = interface_detect_beat_priv(fd, iface)) == IFSTATUS_ERR) - printf(" SIOCDEVPRIVATE failed (%s)\n", strerror(errno)); - else - printf(" SIOCDEVPRIVATE: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); - - if ((s = interface_detect_beat_wlan(fd, iface)) == IFSTATUS_ERR) - printf(" Wireless failed.\n"); - else - printf(" Wireless: %s\n", s == IFSTATUS_UP ? "link beat detected" : "unplugged"); - - } else { - - if ((s = interface_detect_beat_mii(fd, iface)) == IFSTATUS_ERR) - if ((s = interface_detect_beat_ethtool(fd, iface)) == IFSTATUS_ERR) - if ((s = interface_detect_beat_wlan(fd, iface)) == IFSTATUS_ERR) - s = interface_detect_beat_priv(fd, iface); - - switch(s) { - case IFSTATUS_UP: - if (!verbose) - printf("%s: link beat detected\n", iface); - r = 1; - break; - - case IFSTATUS_DOWN: - if (!verbose) - printf("%s: unplugged\n", iface); - r = 2; - break; - - default: - if (!verbose) - printf("%s: not supported\n", iface); - - r = -1; - break; - } - } - - - close(fd); - return r; -} - -void usage(char *p) { - if (strrchr(p, '/')) - p = strchr(p, '/')+1; - - printf("%s [options] [INTERFACE]\n" - " -a --auto Enable interface automatically (%s)\n" - " -q --quiet Quiet behaviour (%s)\n" - " -v --verbose Enable verbosity (%s)\n" - " -h --help Show this help\n" - " -V --version Show version number\n", - p, interface_auto_up ? "on" : "off", verbose < 0 ? "on" : "off", verbose > 0 ? "on" : "off"); -} - - -void parse(int argc, char *argv[]) { - static struct option long_options[] = { - {"auto", no_argument, 0, 'a'}, - {"quiet", no_argument, 0, 'q'}, - {"verbose", no_argument, 0, 'v'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {0, 0, 0, 0} - }; - int option_index = 0; - int help = 0; - - for (;;) { - int c; - - if ((c = getopt_long(argc, argv, "avhqV", long_options, &option_index)) < 0) - break; - - switch (c) { - case 'a' : - interface_auto_up = !interface_auto_up; - break; - case 'v': - verbose++; - break; - case 'q': - verbose--; - break; - case 'h': - help = 1; - break; - case 'V': -#ifdef SVN_REVISION - printf("ifstatus "VERSION" (SVN: "SVN_REVISION")\n"); -#else - printf("ifstatus "VERSION"\n"); -#endif - exit(0); - default: - fprintf(stderr, "Unknown parameter.\n"); - exit(1); - - } - } - - if (help) { - usage(argv[0]); - exit(0); - } - - if (optind < argc) - interface = argv[optind]; -} - - -int main(int argc, char *argv[]) { - parse(argc, argv); - - if (interface) { - int r; - - if ((r = handle(interface)) < 0) { - if (verbose == 0) - fprintf(stderr, "Failure (%s)\n", strerror(errno)); - return 1; - } - - return r+1; - - } else { - FILE *f; - char ln[256]; - - if (!(f = fopen("/proc/net/dev", "r"))) { - fprintf(stderr, "Failed to open /proc/net/dev: %s\n", strerror(errno)); - return 1; - } - - fgets(ln, sizeof(ln), f); - fgets(ln, sizeof(ln), f); - - while (fgets(ln, sizeof(ln), f)) { - char *p, *e; - - p = ln+strspn(ln, " \t"); - if (!(e = strchr(p, ':'))) { - fprintf(stderr, "Parse failure in /proc/net/dev.\n"); - fclose(f); - return 1; - } - - *e = 0; - handle(p); - } - - fclose(f); - } - - return 0; -} diff --git a/trunk/src/interface.c b/trunk/src/interface.c deleted file mode 100644 index 38525cd..0000000 --- a/trunk/src/interface.c +++ /dev/null @@ -1,280 +0,0 @@ -/* $Id$ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <linux/sockios.h> -#include <linux/if_ether.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <linux/if.h> -#include <syslog.h> -#include <string.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include <assert.h> - -#include "ethtool-local.h" -#include "interface.h" -#include "wireless.h" - -#include <libdaemon/dlog.h> - -void interface_up(int fd, char *iface) { - struct ifreq ifr; - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); - - if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Warning: Could not get interface flags."); - - return; - } - - if ((ifr.ifr_flags & IFF_UP) == IFF_UP) - return; - - if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Warning: Could not get interface address."); - } else if (ifr.ifr_addr.sa_family != AF_INET) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Warning: The interface is not IP-based."); - } else { - ((struct sockaddr_in *)(&ifr.ifr_addr))->sin_addr.s_addr = INADDR_ANY; - if (ioctl(fd, SIOCSIFADDR, &ifr) < 0) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Warning: Could not set interface address."); - } - } - - if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Warning: Could not get interface flags."); - - return; - } - - ifr.ifr_flags |= IFF_UP; - - if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) - if (interface_do_message) - daemon_log(LOG_WARNING, "Warning: Could not set interface flags."); -} - -interface_status_t interface_detect_beat_mii(int fd, char *iface) { - struct ifreq ifr; - - if (interface_auto_up) - interface_up(fd, iface); - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); - - if (ioctl(fd, SIOCGMIIPHY, &ifr) == -1) { - if (interface_do_message) - daemon_log(LOG_ERR, "SIOCGMIIPHY failed: %s", strerror(errno)); - - return IFSTATUS_ERR; - } - - ((unsigned short*) &ifr.ifr_data)[1] = 1; - - if (ioctl(fd, SIOCGMIIREG, &ifr) == -1) { - if (interface_do_message) - daemon_log(LOG_ERR, "SIOCGMIIREG failed: %s", strerror(errno)); - - return IFSTATUS_ERR; - } - - return (((unsigned short*) &ifr.ifr_data)[3] & 0x0016) == 0x0004 ? IFSTATUS_UP : IFSTATUS_DOWN; -} - -interface_status_t interface_detect_beat_priv(int fd, char *iface) { - struct ifreq ifr; - - if (interface_auto_up) - interface_up(fd, iface); - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); - - if (ioctl(fd, SIOCDEVPRIVATE, &ifr) == -1) { - if (interface_do_message) - daemon_log(LOG_ERR, "SIOCDEVPRIVATE failed: %s", strerror(errno)); - - return IFSTATUS_ERR; - } - - ((unsigned short*) &ifr.ifr_data)[1] = 1; - - if (ioctl(fd, SIOCDEVPRIVATE+1, &ifr) == -1) { - if (interface_do_message) - daemon_log(LOG_ERR, "SIOCDEVPRIVATE+1 failed: %s", strerror(errno)); - - return IFSTATUS_ERR; - } - - return (((unsigned short*) &ifr.ifr_data)[3] & 0x0016) == 0x0004 ? IFSTATUS_UP : IFSTATUS_DOWN; -} - -interface_status_t interface_detect_beat_ethtool(int fd, char *iface) { - - struct ifreq ifr; - struct ethtool_value edata; - - if (interface_auto_up) - interface_up(fd, iface); - - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); - - edata.cmd = ETHTOOL_GLINK; - ifr.ifr_data = (caddr_t) &edata; - - if (ioctl(fd, SIOCETHTOOL, &ifr) == -1) { - if (interface_do_message) - daemon_log(LOG_ERR, "ETHTOOL_GLINK failed: %s", strerror(errno)); - - return IFSTATUS_ERR; - } - - return edata.data ? IFSTATUS_UP : IFSTATUS_DOWN; -} - - -static int get_wlan_qual_old(char *iface) { - FILE *f; - char buf[256]; - char *bp; - int l, q = -1; - - l = strlen(iface); - - if (!(f = fopen("/proc/net/wireless", "r"))) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Failed to open /proc/net/wireless: %s",strerror(errno)); - - return -1; - } - - while (fgets(buf, sizeof(buf)-1, f)) { - bp = buf; - - while (*bp && isspace(*bp)) - bp++; - - if(!strncmp(bp, iface, l) && bp[l]==':') { - - /* skip device name */ - if (!(bp = strchr(bp,' '))) - break; - - bp++; - - /* skip status */ - if (!(bp = strchr(bp,' '))) - break; - - q = atoi(bp); - break; - }; - } - - fclose(f); - - if (q < 0) { - if (interface_do_message) - daemon_log(LOG_ERR, "Failed to find interface in /proc/net/wireless"); - } - - return q; -} - -static int get_wlan_qual_new(int fd, char *iface) { - struct iwreq req; - struct iw_statistics q; - - memset(&req, 0, sizeof(req)); - strncpy(req.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); - - req.u.data.pointer = (caddr_t) &q; - req.u.data.length = sizeof(q); - req.u.data.flags = 1; - - if (ioctl(fd, SIOCGIWSTATS, &req) < 0) { - if (interface_do_message) - daemon_log(LOG_ERR, "Failed to get interface quality: %s\n", strerror(errno)); - return -1; - } - - return q.qual.qual; -} - - -static int is_assoc_ap(uint8_t mac[ETH_ALEN]) { - int b, j; - b = 1; - - for (j = 1; j < ETH_ALEN; j++) - if (mac[j] != mac[0]) { - b = 0; - break; - } - - return !b || (mac[0] != 0xFF && mac[0] != 0x44 && mac[0] != 0x00); -} - -interface_status_t interface_detect_beat_wlan(int fd, char *iface) { - uint8_t mac[6]; - int q; - struct iwreq req; - - if (interface_auto_up) - interface_up(fd, iface); - - memset(&req, 0, sizeof(req)); - strncpy(req.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); - - if (ioctl(fd, SIOCGIWAP, &req) < 0) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Failed to get AP address: %s",strerror(errno)); - return IFSTATUS_ERR; - } - - memcpy(mac, &(req.u.ap_addr.sa_data), ETH_ALEN); - - if (!is_assoc_ap(mac)) - return IFSTATUS_DOWN; - - if ((q = get_wlan_qual_new(fd, iface)) < 0) - if ((q = get_wlan_qual_old(iface)) < 0) { - if (interface_do_message) - daemon_log(LOG_WARNING, "Failed to get wireless link quality."); - return IFSTATUS_ERR; - } - - return q > 0 ? IFSTATUS_UP : IFSTATUS_DOWN; -} - diff --git a/trunk/src/interface.h b/trunk/src/interface.h deleted file mode 100644 index d1f3826..0000000 --- a/trunk/src/interface.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef foointerfacehfoo -#define foointerfacehfoo - -/* $Id: interface.h 1.2 Wed, 23 Oct 2002 20:49:08 +0200 lennart $ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -int interface_auto_up; -int interface_do_message; - -typedef enum { IFSTATUS_UP, IFSTATUS_DOWN, IFSTATUS_ERR } interface_status_t; - -void interface_up(int fd, char *iface); - -interface_status_t interface_detect_beat_mii(int fd, char *iface); -interface_status_t interface_detect_beat_priv(int fd, char *iface); -interface_status_t interface_detect_beat_ethtool(int fd, char *iface); -interface_status_t interface_detect_beat_wlan(int fd, char *iface); - -#endif diff --git a/trunk/src/nlapi.c b/trunk/src/nlapi.c deleted file mode 100644 index 3fd0ed6..0000000 --- a/trunk/src/nlapi.c +++ /dev/null @@ -1,130 +0,0 @@ -/* $Id$ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <assert.h> -#include <stdlib.h> - -#include <libdaemon/dlog.h> - -#include "nlapi.h" - -int nlapi_fd = -1; - -struct callback_info { - nlapi_callback_t callback; - void *userdata; - struct callback_info * next; -}; - -struct callback_info *callbacks = NULL; - -int nlapi_open(uint32_t groups) { - struct sockaddr_nl addr; - - if ((nlapi_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) { - daemon_log(LOG_ERR, "socket(PF_NETLINK): %s\n", strerror(errno)); - return -1; - } - - memset(&addr, 0, sizeof(addr)); - addr.nl_family = AF_NETLINK; - addr.nl_groups = groups; - addr.nl_pid = getpid(); - - if (bind(nlapi_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - close(nlapi_fd); - daemon_log(LOG_ERR, "bind(): %s\n", strerror(errno)); - return -1; - } - - return 0; -} - -int nlapi_work(int block) { - - assert(nlapi_fd >= 0); - - for (;;) { - int bytes; - char replybuf[1024]; - struct nlmsghdr *p = (struct nlmsghdr *) replybuf; - - if ((bytes = recv(nlapi_fd, &replybuf, sizeof(replybuf), block ? 0 : MSG_DONTWAIT)) < 0) { - - if (errno == EAGAIN || errno == EINTR) - return 0; - - daemon_log(LOG_ERR, "NLAPI: recv(): %s\n", strerror(errno)); - return -1; - } - - for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) { - struct callback_info *c; - - if (!NLMSG_OK(p, bytes) || bytes < sizeof(struct nlmsghdr) || bytes < p->nlmsg_len) { - daemon_log(LOG_ERR, "NLAPI: Packet too small or truncated!\n"); - return -1; - } - - for (c = callbacks; c; c = c->next) - if (c->callback(p, c->userdata) < 0) - return -1; - } - - if (block) - break; - } - - return 0; -} - -void nlapi_close(void) { - if (nlapi_fd >= 0) - close(nlapi_fd); - nlapi_fd = -1; - - while (callbacks) { - struct callback_info *c = callbacks; - callbacks = callbacks->next; - free(c); - } -} - -int nlapi_register(int (*callback) (struct nlmsghdr *n, void *u), void *u) { - struct callback_info *c; - - assert(callback); - - if (!(c = malloc(sizeof(struct callback_info)))) { - daemon_log(LOG_ERR, "NLAPI: Not enough memory.\n"); - return -1; - } - - c->callback = callback; - c->userdata = u; - - c->next = callbacks; - callbacks = c; - return 0; -} diff --git a/trunk/src/nlapi.h b/trunk/src/nlapi.h deleted file mode 100644 index b810e20..0000000 --- a/trunk/src/nlapi.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef foonlapihfoo -#define foonlapihfoo - -/* $Id: ifplugd.c 1.12 Sat, 01 Feb 2003 03:00:07 +0100 lennart $ */ - -/* - * This file is part of ifplugd. - * - * ifplugd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ifplugd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ifplugd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <stdint.h> -#include <sys/socket.h> -#include <linux/types.h> -#include <linux/netlink.h> -#include <linux/rtnetlink.h> - -typedef int (*nlapi_callback_t) (struct nlmsghdr *n, void *u); - -extern int nlapi_fd; - -int nlapi_open(uint32_t groups); -void nlapi_close(void); -int nlapi_work(int block); -int nlapi_register(nlapi_callback_t cb, void *u); - -#endif diff --git a/trunk/src/wireless.15.h b/trunk/src/wireless.15.h deleted file mode 100644 index bacf44b..0000000 --- a/trunk/src/wireless.15.h +++ /dev/null @@ -1,698 +0,0 @@ -/* - * This file define a set of standard wireless extensions - * - * Version : 15 12.7.02 - * - * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> - * Copyright (c) 1997-2002 Jean Tourrilhes, All Rights Reserved. - */ - -#ifndef _LINUX_WIRELESS_H -#define _LINUX_WIRELESS_H - -/************************** DOCUMENTATION **************************/ -/* - * Initial APIs (1996 -> onward) : - * ----------------------------- - * Basically, the wireless extensions are for now a set of standard ioctl - * call + /proc/net/wireless - * - * The entry /proc/net/wireless give statistics and information on the - * driver. - * This is better than having each driver having its entry because - * its centralised and we may remove the driver module safely. - * - * Ioctl are used to configure the driver and issue commands. This is - * better than command line options of insmod because we may want to - * change dynamically (while the driver is running) some parameters. - * - * The ioctl mechanimsm are copied from standard devices ioctl. - * We have the list of command plus a structure descibing the - * data exchanged... - * Note that to add these ioctl, I was obliged to modify : - * # net/core/dev.c (two place + add include) - * # net/ipv4/af_inet.c (one place + add include) - * - * /proc/net/wireless is a copy of /proc/net/dev. - * We have a structure for data passed from the driver to /proc/net/wireless - * Too add this, I've modified : - * # net/core/dev.c (two other places) - * # include/linux/netdevice.h (one place) - * # include/linux/proc_fs.h (one place) - * - * New driver API (2002 -> onward) : - * ------------------------------- - * This file is only concerned with the user space API and common definitions. - * The new driver API is defined and documented in : - * # include/net/iw_handler.h - * - * Note as well that /proc/net/wireless implementation has now moved in : - * # include/linux/wireless.c - * - * Wireless Events (2002 -> onward) : - * -------------------------------- - * Events are defined at the end of this file, and implemented in : - * # include/linux/wireless.c - * - * Other comments : - * -------------- - * Do not add here things that are redundant with other mechanisms - * (drivers init, ifconfig, /proc/net/dev, ...) and with are not - * wireless specific. - * - * These wireless extensions are not magic : each driver has to provide - * support for them... - * - * IMPORTANT NOTE : As everything in the kernel, this is very much a - * work in progress. Contact me if you have ideas of improvements... - */ - -/***************************** INCLUDES *****************************/ - -#include <linux/types.h> /* for "caddr_t" et al */ -#include <linux/socket.h> /* for "struct sockaddr" et al */ -#include <linux/if.h> /* for IFNAMSIZ and co... */ - -/***************************** VERSION *****************************/ -/* - * This constant is used to know the availability of the wireless - * extensions and to know which version of wireless extensions it is - * (there is some stuff that will be added in the future...) - * I just plan to increment with each new version. - */ -#define WIRELESS_EXT 15 - -/* - * Changes : - * - * V2 to V3 - * -------- - * Alan Cox start some incompatibles changes. I've integrated a bit more. - * - Encryption renamed to Encode to avoid US regulation problems - * - Frequency changed from float to struct to avoid problems on old 386 - * - * V3 to V4 - * -------- - * - Add sensitivity - * - * V4 to V5 - * -------- - * - Missing encoding definitions in range - * - Access points stuff - * - * V5 to V6 - * -------- - * - 802.11 support (ESSID ioctls) - * - * V6 to V7 - * -------- - * - define IW_ESSID_MAX_SIZE and IW_MAX_AP - * - * V7 to V8 - * -------- - * - Changed my e-mail address - * - More 802.11 support (nickname, rate, rts, frag) - * - List index in frequencies - * - * V8 to V9 - * -------- - * - Support for 'mode of operation' (ad-hoc, managed...) - * - Support for unicast and multicast power saving - * - Change encoding to support larger tokens (>64 bits) - * - Updated iw_params (disable, flags) and use it for NWID - * - Extracted iw_point from iwreq for clarity - * - * V9 to V10 - * --------- - * - Add PM capability to range structure - * - Add PM modifier : MAX/MIN/RELATIVE - * - Add encoding option : IW_ENCODE_NOKEY - * - Add TxPower ioctls (work like TxRate) - * - * V10 to V11 - * ---------- - * - Add WE version in range (help backward/forward compatibility) - * - Add retry ioctls (work like PM) - * - * V11 to V12 - * ---------- - * - Add SIOCSIWSTATS to get /proc/net/wireless programatically - * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space - * - Add new statistics (frag, retry, beacon) - * - Add average quality (for user space calibration) - * - * V12 to V13 - * ---------- - * - Document creation of new driver API. - * - Extract union iwreq_data from struct iwreq (for new driver API). - * - Rename SIOCSIWNAME as SIOCSIWCOMMIT - * - * V13 to V14 - * ---------- - * - Wireless Events support : define struct iw_event - * - Define additional specific event numbers - * - Add "addr" and "param" fields in union iwreq_data - * - AP scanning stuff (SIOCSIWSCAN and friends) - * - * V14 to V15 - * ---------- - * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg - * - Make struct iw_freq signed (both m & e), add explicit padding - * - Add IWEVCUSTOM for driver specific event/scanning token - * - Add IW_MAX_GET_SPY for driver returning a lot of addresses - * - Add IW_TXPOW_RANGE for range of Tx Powers - * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points - * - Add IW_MODE_MONITOR for passive monitor - */ - -/**************************** CONSTANTS ****************************/ - -/* -------------------------- IOCTL LIST -------------------------- */ - -/* Wireless Identification */ -#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ -#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ -/* SIOCGIWNAME is used to verify the presence of Wireless Extensions. - * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"... - * Don't put the name of your driver there, it's useless. */ - -/* Basic operations */ -#define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */ -#define SIOCGIWNWID 0x8B03 /* get network id (the cell) */ -#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ -#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ -#define SIOCSIWMODE 0x8B06 /* set operation mode */ -#define SIOCGIWMODE 0x8B07 /* get operation mode */ -#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ -#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ - -/* Informative stuff */ -#define SIOCSIWRANGE 0x8B0A /* Unused */ -#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ -#define SIOCSIWPRIV 0x8B0C /* Unused */ -#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ -#define SIOCSIWSTATS 0x8B0E /* Unused */ -#define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */ -/* SIOCGIWSTATS is strictly used between user space and the kernel, and - * is never passed to the driver (i.e. the driver will never see it). */ - -/* Mobile IP support (statistics per MAC address) */ -#define SIOCSIWSPY 0x8B10 /* set spy addresses */ -#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ - -/* Access Point manipulation */ -#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */ -#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */ -#define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */ -#define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */ -#define SIOCGIWSCAN 0x8B19 /* get scanning results */ - -/* 802.11 specific support */ -#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ -#define SIOCGIWESSID 0x8B1B /* get ESSID */ -#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */ -#define SIOCGIWNICKN 0x8B1D /* get node name/nickname */ -/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit - * within the 'iwreq' structure, so we need to use the 'data' member to - * point to a string in user space, like it is done for RANGE... */ - -/* Other parameters useful in 802.11 and some other devices */ -#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */ -#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ -#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */ -#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ -#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ -#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ -#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ -#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ -#define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */ -#define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */ - -/* Encoding stuff (scrambling, hardware security, WEP...) */ -#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ -#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ -/* Power saving stuff (power management, unicast and multicast) */ -#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ -#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ - -/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ - -/* These 16 ioctl are wireless device private. - * Each driver is free to use them for whatever purpose it chooses, - * however the driver *must* export the description of those ioctls - * with SIOCGIWPRIV and *must* use arguments as defined below. - * If you don't follow those rules, DaveM is going to hate you (reason : - * it make mixed 32/64bit operation impossible). - */ -#define SIOCIWFIRSTPRIV 0x8BE0 -#define SIOCIWLASTPRIV 0x8BFF -/* Previously, we were using SIOCDEVPRIVATE, but we now have our - * separate range because of collisions with other tools such as - * 'mii-tool'. - * We now have 32 commands, so a bit more space ;-). - * Also, all 'odd' commands are only usable by root and don't return the - * content of ifr/iwr to user (but you are not obliged to use the set/get - * convention, just use every other two command). - * And I repeat : you are not obliged to use them with iwspy, but you - * must be compliant with it. - */ - -/* ------------------------- IOCTL STUFF ------------------------- */ - -/* The first and the last (range) */ -#define SIOCIWFIRST 0x8B00 -#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ - -/* Even : get (world access), odd : set (root access) */ -#define IW_IS_SET(cmd) (!((cmd) & 0x1)) -#define IW_IS_GET(cmd) ((cmd) & 0x1) - -/* ----------------------- WIRELESS EVENTS ----------------------- */ -/* Those are *NOT* ioctls, do not issue request on them !!! */ -/* Most events use the same identifier as ioctl requests */ - -#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ -#define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ -#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ -#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ -#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ - -#define IWEVFIRST 0x8C00 - -/* ------------------------- PRIVATE INFO ------------------------- */ -/* - * The following is used with SIOCGIWPRIV. It allow a driver to define - * the interface (name, type of data) for its private ioctl. - * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV - */ - -#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */ -#define IW_PRIV_TYPE_NONE 0x0000 -#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */ -#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */ -#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */ -#define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */ -#define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */ - -#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed nuber of args */ - -#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */ - -/* - * Note : if the number of args is fixed and the size < 16 octets, - * instead of passing a pointer we will put args in the iwreq struct... - */ - -/* ----------------------- OTHER CONSTANTS ----------------------- */ - -/* Maximum frequencies in the range struct */ -#define IW_MAX_FREQUENCIES 16 -/* Note : if you have something like 80 frequencies, - * don't increase this constant and don't fill the frequency list. - * The user will be able to set by channel anyway... */ - -/* Maximum bit rates in the range struct */ -#define IW_MAX_BITRATES 8 - -/* Maximum tx powers in the range struct */ -#define IW_MAX_TXPOWER 8 -/* Note : if you more than 8 TXPowers, just set the max and min or - * a few of them in the struct iw_range. */ - -/* Maximum of address that you may set with SPY */ -#define IW_MAX_SPY 8 /* set */ -#define IW_MAX_GET_SPY 64 /* get */ - -/* Maximum of address that you may get in the - list of access points in range */ -#define IW_MAX_AP 8 - -/* Maximum size of the ESSID and NICKN strings */ -#define IW_ESSID_MAX_SIZE 32 - -/* Modes of operation */ -#define IW_MODE_AUTO 0 /* Let the driver decides */ -#define IW_MODE_ADHOC 1 /* Single cell network */ -#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ -#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ -#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ -#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ -#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ - -/* Maximum number of size of encoding token available - * they are listed in the range structure */ -#define IW_MAX_ENCODING_SIZES 8 - -/* Maximum size of the encoding token in bytes */ -#define IW_ENCODING_TOKEN_MAX 32 /* 256 bits (for now) */ - -/* Flags for encoding (along with the token) */ -#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ -#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */ -#define IW_ENCODE_MODE 0xF000 /* Modes defined below */ -#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ -#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ -#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ -#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ -#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */ - -/* Power management flags available (along with the value, if any) */ -#define IW_POWER_ON 0x0000 /* No details... */ -#define IW_POWER_TYPE 0xF000 /* Type of parameter */ -#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ -#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ -#define IW_POWER_MODE 0x0F00 /* Power Management mode */ -#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ -#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ -#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ -#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ -#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ -#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ -#define IW_POWER_MIN 0x0001 /* Value is a minimum */ -#define IW_POWER_MAX 0x0002 /* Value is a maximum */ -#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ - -/* Transmit Power flags available */ -#define IW_TXPOW_TYPE 0x00FF /* Type of value */ -#define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ -#define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ -#define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */ - -/* Retry limits and lifetime flags available */ -#define IW_RETRY_ON 0x0000 /* No details... */ -#define IW_RETRY_TYPE 0xF000 /* Type of parameter */ -#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ -#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ -#define IW_RETRY_MODIFIER 0x000F /* Modify a parameter */ -#define IW_RETRY_MIN 0x0001 /* Value is a minimum */ -#define IW_RETRY_MAX 0x0002 /* Value is a maximum */ -#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ - -/* Scanning request flags */ -#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ -#define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */ -#define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */ -#define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */ -#define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */ -#define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ -#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ -#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ -#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ -/* Maximum size of returned data */ -#define IW_SCAN_MAX_DATA 4096 /* In bytes */ - -/* Max number of char in custom event - use multiple of them if needed */ -#define IW_CUSTOM_MAX 256 /* In bytes */ - -/****************************** TYPES ******************************/ - -/* --------------------------- SUBTYPES --------------------------- */ -/* - * Generic format for most parameters that fit in an int - */ -struct iw_param -{ - __s32 value; /* The value of the parameter itself */ - __u8 fixed; /* Hardware should not use auto select */ - __u8 disabled; /* Disable the feature */ - __u16 flags; /* Various specifc flags (if any) */ -}; - -/* - * For all data larger than 16 octets, we need to use a - * pointer to memory allocated in user space. - */ -struct iw_point -{ - caddr_t pointer; /* Pointer to the data (in user space) */ - __u16 length; /* number of fields or size in bytes */ - __u16 flags; /* Optional params */ -}; - -/* - * A frequency - * For numbers lower than 10^9, we encode the number in 'm' and - * set 'e' to 0 - * For number greater than 10^9, we divide it by the lowest power - * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... - * The power of 10 is in 'e', the result of the division is in 'm'. - */ -struct iw_freq -{ - __s32 m; /* Mantissa */ - __s16 e; /* Exponent */ - __u8 i; /* List index (when in range struct) */ - __u8 pad; /* Unused - just for alignement */ -}; - -/* - * Quality of the link - */ -struct iw_quality -{ - __u8 qual; /* link quality (%retries, SNR, - %missed beacons or better...) */ - __u8 level; /* signal level (dBm) */ - __u8 noise; /* noise level (dBm) */ - __u8 updated; /* Flags to know if updated */ -}; - -/* - * Packet discarded in the wireless adapter due to - * "wireless" specific problems... - * Note : the list of counter and statistics in net_device_stats - * is already pretty exhaustive, and you should use that first. - * This is only additional stats... - */ -struct iw_discarded -{ - __u32 nwid; /* Rx : Wrong nwid/essid */ - __u32 code; /* Rx : Unable to code/decode (WEP) */ - __u32 fragment; /* Rx : Can't perform MAC reassembly */ - __u32 retries; /* Tx : Max MAC retries num reached */ - __u32 misc; /* Others cases */ -}; - -/* - * Packet/Time period missed in the wireless adapter due to - * "wireless" specific problems... - */ -struct iw_missed -{ - __u32 beacon; /* Missed beacons/superframe */ -}; - -/* ------------------------ WIRELESS STATS ------------------------ */ -/* - * Wireless statistics (used for /proc/net/wireless) - */ -struct iw_statistics -{ - __u16 status; /* Status - * - device dependent for now */ - - struct iw_quality qual; /* Quality of the link - * (instant/mean/max) */ - struct iw_discarded discard; /* Packet discarded counts */ - struct iw_missed miss; /* Packet missed counts */ -}; - -/* ------------------------ IOCTL REQUEST ------------------------ */ -/* - * This structure defines the payload of an ioctl, and is used - * below. - * - * Note that this structure should fit on the memory footprint - * of iwreq (which is the same as ifreq), which mean a max size of - * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... - * You should check this when increasing the structures defined - * above in this file... - */ -union iwreq_data -{ - /* Config - generic */ - char name[IFNAMSIZ]; - /* Name : used to verify the presence of wireless extensions. - * Name of the protocol/provider... */ - - struct iw_point essid; /* Extended network name */ - struct iw_param nwid; /* network id (or domain - the cell) */ - struct iw_freq freq; /* frequency or channel : - * 0-1000 = channel - * > 1000 = frequency in Hz */ - - struct iw_param sens; /* signal level threshold */ - struct iw_param bitrate; /* default bit rate */ - struct iw_param txpower; /* default transmit power */ - struct iw_param rts; /* RTS threshold threshold */ - struct iw_param frag; /* Fragmentation threshold */ - __u32 mode; /* Operation mode */ - struct iw_param retry; /* Retry limits & lifetime */ - - struct iw_point encoding; /* Encoding stuff : tokens */ - struct iw_param power; /* PM duration/timeout */ - struct iw_quality qual; /* Quality part of statistics */ - - struct sockaddr ap_addr; /* Access point address */ - struct sockaddr addr; /* Destination address (hw) */ - - struct iw_param param; /* Other small parameters */ - struct iw_point data; /* Other large parameters */ -}; - -/* - * The structure to exchange data for ioctl. - * This structure is the same as 'struct ifreq', but (re)defined for - * convenience... - * Do I need to remind you about structure size (32 octets) ? - */ -struct iwreq -{ - union - { - char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ - } ifr_ifrn; - - /* Data part (defined just above) */ - union iwreq_data u; -}; - -/* -------------------------- IOCTL DATA -------------------------- */ -/* - * For those ioctl which want to exchange mode data that what could - * fit in the above structure... - */ - -/* - * Range of parameters - */ - -struct iw_range -{ - /* Informative stuff (to choose between different interface) */ - __u32 throughput; /* To give an idea... */ - /* In theory this value should be the maximum benchmarked - * TCP/IP throughput, because with most of these devices the - * bit rate is meaningless (overhead an co) to estimate how - * fast the connection will go and pick the fastest one. - * I suggest people to play with Netperf or any benchmark... - */ - - /* NWID (or domain id) */ - __u32 min_nwid; /* Minimal NWID we are able to set */ - __u32 max_nwid; /* Maximal NWID we are able to set */ - - /* Frequency */ - __u16 num_channels; /* Number of channels [0; num - 1] */ - __u8 num_frequency; /* Number of entry in the list */ - struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ - /* Note : this frequency list doesn't need to fit channel numbers */ - - /* signal level threshold range */ - __s32 sensitivity; - - /* Quality of link & SNR stuff */ - struct iw_quality max_qual; /* Quality of the link */ - - /* Rates */ - __u8 num_bitrates; /* Number of entries in the list */ - __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ - - /* RTS threshold */ - __s32 min_rts; /* Minimal RTS threshold */ - __s32 max_rts; /* Maximal RTS threshold */ - - /* Frag threshold */ - __s32 min_frag; /* Minimal frag threshold */ - __s32 max_frag; /* Maximal frag threshold */ - - /* Power Management duration & timeout */ - __s32 min_pmp; /* Minimal PM period */ - __s32 max_pmp; /* Maximal PM period */ - __s32 min_pmt; /* Minimal PM timeout */ - __s32 max_pmt; /* Maximal PM timeout */ - __u16 pmp_flags; /* How to decode max/min PM period */ - __u16 pmt_flags; /* How to decode max/min PM timeout */ - __u16 pm_capa; /* What PM options are supported */ - - /* Encoder stuff */ - __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ - __u8 num_encoding_sizes; /* Number of entry in the list */ - __u8 max_encoding_tokens; /* Max number of tokens */ - - /* Transmit power */ - __u16 txpower_capa; /* What options are supported */ - __u8 num_txpower; /* Number of entries in the list */ - __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */ - - /* Wireless Extension version info */ - __u8 we_version_compiled; /* Must be WIRELESS_EXT */ - __u8 we_version_source; /* Last update of source */ - - /* Retry limits and lifetime */ - __u16 retry_capa; /* What retry options are supported */ - __u16 retry_flags; /* How to decode max/min retry limit */ - __u16 r_time_flags; /* How to decode max/min retry life */ - __s32 min_retry; /* Minimal number of retries */ - __s32 max_retry; /* Maximal number of retries */ - __s32 min_r_time; /* Minimal retry lifetime */ - __s32 max_r_time; /* Maximal retry lifetime */ - - /* Average quality of link & SNR */ - struct iw_quality avg_qual; /* Quality of the link */ - /* This should contain the average/typical values of the quality - * indicator. This should be the threshold between a "good" and - * a "bad" link (example : monitor going from green to orange). - * Currently, user space apps like quality monitors don't have any - * way to calibrate the measurement. With this, they can split - * the range between 0 and max_qual in different quality level - * (using a geometric subdivision centered on the average). - * I expect that people doing the user space apps will feedback - * us on which value we need to put in each driver... - */ -}; - -/* - * Private ioctl interface information - */ - -struct iw_priv_args -{ - __u32 cmd; /* Number of the ioctl to issue */ - __u16 set_args; /* Type and number of args */ - __u16 get_args; /* Type and number of args */ - char name[IFNAMSIZ]; /* Name of the extension */ -}; - -/* ----------------------- WIRELESS EVENTS ----------------------- */ -/* - * Wireless events are carried through the rtnetlink socket to user - * space. They are encapsulated in the IFLA_WIRELESS field of - * a RTM_NEWLINK message. - */ - -/* - * A Wireless Event. Contains basically the same data as the ioctl... - */ -struct iw_event -{ - __u16 len; /* Real lenght of this stuff */ - __u16 cmd; /* Wireless IOCTL */ - union iwreq_data u; /* IOCTL fixed payload */ -}; - -/* Size of the Event prefix (including padding and alignement junk) */ -#define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data)) -/* Size of the various events */ -#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) -#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) -#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) -#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point)) -#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) -#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) -#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) - -/* Note : in the case of iw_point, the extra data will come at the - * end of the event */ - -#endif /* _LINUX_WIRELESS_H */ diff --git a/trunk/src/wireless.h b/trunk/src/wireless.h deleted file mode 100644 index 0a4ef2e..0000000 --- a/trunk/src/wireless.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef foowirelesshfoo -#define foowirelesshfoo - -/* $Id$ */ - -/* - * This file is part of waproamd. - * - * waproamd is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * waproamd is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with waproamd; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <linux/if.h> -#include "wireless.15.h" - -#endif |