Quagga 0.99.16 を NetBSD にインストール
結論
quagga-devel を入れる
経緯
お世話になってる quagga の pkgsrc が3月に更新されたので update かけようと思ったのだけど,
Version mismatch: 'quagga' quagga-0.98.6nb2 vs quagga-0.98.6nb3
make update しようとするとやっぱり脆弱性があるパッケージで怒られたりする.
Package quagga-0.98.6nb3 has a remote-denial-of-service vulnerability
quagga って既に 0.99 系なので,そっちが pkgsrc にないかどうか調べたら
This version, while tagged stable, is generally considered obsolete
and most users are better server by 0.99.x.
なんて酷い事が書いてあったりするので,手動でインストールすることにした.
インストール
tar xvzf かなんかで quagga-0.99.16.tar.gz を解凍して configure.
configure -h でオプションを見ると色々あるので --enable-vtysh --enable-snmp を指定したらいくつかエラーに.
--enable-vtysh
./configure で
configure: error: vtysh needs libreadline but was not found and usable on your system.
となる. pkgsrc で devel/readline は入っているのでライブラリのサーチパスの問題
#!/bin/sh ./update-autotools LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib" CPPFLAGS="-I/usr/pkg/include" \ ./configure --enable-vtysh --enable-snmp=/usr/pkg/sbin/snmpd --enable-pkgsrcrcdir=/etc/rc.d
こんなスクリプトを書いて実行. devel/automake が無いと ./update-autotools でコケる.
--enable-snmp
configure: error: --enable-snmp given, but cannot find support for SNMP
次はこのエラー. net/net-snmp のインストールと ./configure -h には書かれていないけど,--enable-snmp=/usr/pkg/sbin/snmpd として snmpd の位置を指定する必要があるようだ.
起動しない
コンフィグファイルが /usr/local/etc/ にあるのに, /etc/rc.d/zebra では {$PREFIX}/etc/ になっていて $PREFIX が空なので必要なファイルが読み込めずに失敗.手動で修正しても起動せず.
ログを見るとどうも pid ファイルの場所が悪いらしい
2010/05/04 04:11:35 ZEBRA: Can't create pid lock file /etc/zebra.pid (Permission denied), exiting
調べるとハードコードされたデフォルトの値らしいが,
% strings /usr/local/sbin/zebra | grep etc thread_fetch stream_getc /etc/zserv.api /etc/zebra.vty /etc/zebra.pid /usr/local/etc/zebra.conf
rc.d で指定しているはずなので調べるとオプションがついていない.
command_args="-d" socket_dir=/var/run/zebra pidfile="${socket_dir}/${name}.pid"
しかしこの rc.d で動いていたので,本来どこかで指定されていたのだろうが,わからないので command_args に引数をベタ書き.
command_args="-d -i $pidfile -u quagga -g quagga -f $required_files"
起動するようになった.
vtysh が動かない
動いたので喜んで今まで通り vtysh を実行すると
% sudo vtysh bgpd Exiting: failed to connect to any daemons.
telnet は使えるのでまあいいんだけど,どうも気持ちが悪い. ./configure オプションに --enable-vty-group があるので root とか wheel とか quagga とか色々試してみるけど上手くいかない. pkgsrc 版でもここは空白になっている.
Quagga configuration -------------------- quagga version : 0.99.16 host operating system : netbsdelf5.0.2 source code location : . compiler : gcc compiler flags : -Os -fno-omit-frame-pointer -g -std=gnu99 -Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual make : make includes : linker flags : -L/usr/pkg/lib -R/usr/pkg/lib -lresolv -lcrypt -lrt -ltermcap -lreadline -lm state file directory : /var/run config file directory : /usr/local/etc example directory : /usr/local/etc user to run as : quagga group to run as : quagga group for vty sockets : config file mask : 0600 log file mask : 0600
pkgsrc 上書き
どうしようもないので pkgsrc を使わせてもらう.
make clean で古いファイルを削除した後 patch ディレクトリをどかせておいて,Makefile を 0.99.16 用に書き換える.
% cvs diff ? patches_ ? work cvs diff: Diffing . Index: Makefile =================================================================== RCS file: /cvsroot/pkgsrc/net/quagga/Makefile,v retrieving revision 1.34 diff -r1.34 Makefile 4,5c4,5 < DISTNAME= quagga-0.98.6 < PKGREVISION= 3 --- > DISTNAME= quagga-0.99.16 > PKGREVISION= 0 cvs diff: Diffing files
このまま make するとチェックサムが合わなくて怒られるので
% make NO_CHECKSUM=yes
としてやると configure も make もうまく進んで make install もバッチリ.
そんなわけで無事インストールできました.
追記
quagga-devel に最新版があるみたい.前もそういやこれを使っていた気がするけど,-devel って開発者向けパッケージだと思い込んでスルーしてしまっていた...