Date: Mon, 18 Mar 2002 18:22:10 +0000
I first learned that David
Hicks had written an autobiography
when I saw some press coverage of there being an attempt by the Australian
Government to ban the sale of it, so I asked my sister if she could get me a
copy for my birthday before any ban happened. The book doesn't appear to be
available on Amazon.
I sat down and tried to read it almost immediately, but at the time found his
writing style to be rather inarticulate, so I put the book down for a month or
so. When I next had a platelet donation to make, I took it along with me, and
forced myself to read it for duration of the donation.
On the second reading, I managed to engage with the book, and from that point
on, once I made it through his early years in that initial forced reading
session, it ended up being quite enthralling. I plugged my way through the 456
pages in a bit over a month I guess.
We'll never truly know the full story of David Hicks, because I'm sure that
unless there's some sort of inquiry (and even then, there's multiple country's
governments involved), the full story won't come out.
I was always sympathetic to Hicks' plight, since I don't believe that anyone
should be held without due process let alone for anywhere near as long as he
was.
Certainly, the way the book reads, Hicks comes across as a very young, naive,
but principled individual. Like many Australians, he got the travel bug, and by
way of it, got to interact with some different cultures, which awakened a
hunger for social justice in him (at least that's my interpretation of his
portrayal).
I guess I have a different mental image of torture than Hicks did, because I
didn't really find any incidences of what I'd consider torture in his
story. There was plenty of despicable, inhumane treatment though, so I can see
how the line might get blurry, particularly if you're the one experiencing it.
Specifically on the (mis)treatment of the detainees: it was pretty bad, based
on the book. I'm surprised there haven't been more whistle blowers that have
come out. I can't believe that the many soldiers who were stationed there could
treat detainees the way Hicks says they were treated and then can look
themselves in the mirror. The ICRC seemed well apprised of the
detainees conditions (since they seemed to have the most access to them of any
non-military people). I don't know what confidentiality is imposed on them in
return for that access, though.
The fact that he's able to string a sentence together at all after the
treatment he describes for the length of time he received it, I think is pretty
amazing. I couldn't imagine having to endure what he says he went through.
I did feel quite appalled by my own country's complete disregard for his
plight, and similarly in the way the US Government treated these detainees for
as long as they did. Given there are still 171 detainees in Guantanamo today,
it makes me wonder what the conditions and treatment are like there now. It
certainly seems to have fallen out of the mainstream press.
Overall, not the most well written book, but a fascinating and shocking account
of what happened to one person. I think Hicks should be congratulated for the
courage to relive his experiences to get them down on paper, and Random House
should also be congratulated for publishing his work, which I'm sure put them
under some political pressure.
I have no idea how well the book has sold, or how widely it has been read, but
I certainly recommend it.
since I was travelling in the pre-ultimate week for a few days, there was no
report about my RC bugs fixing activities. so here we go with an overview
covering two weeks:
Some of my recent time has been devoted to making our boot media more Mac friendly, which has entailed rather a lot of rebooting. This would have been fine, if tedious, except that some number of boots would fall over with either a clearly impossible kernel panic or userspace segfaulting in places that made no sense. Something was clearly wrong. Crashes that shouldn't happen are generally an indication of memory corruption. The question is how that corruption is being triggered. Hunting that down wasn't terribly easy.00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ * 001568a0 ff ff ff ff ff ff ff ff ff ff ff ff 84 00 00 00 ................ 001568b0 00 20 a7 ac 46 00 00 00 00 00 00 00 00 00 06 01 . ..F........... 001568c0 c2 0b 0c 00 ff ff ff ff ff ff ff ff ff ff ff ff ................ 001568d0 ff ff 0a 04 f0 03 82 0d 40 00 00 00 ff ff ff ff ........@....... 001568e0 ff ff 00 21 00 36 9a 80 ff ff ff ff ff ff 00 7e ...!.6.........~ 001568f0 00 09 43 48 41 2d 47 75 65 73 74 01 04 02 04 0b ..CHA-Guest..... 00156900 16 32 08 0c 12 18 24 30 48 60 6c 2d 1a 0e 18 1a .2....$0H l-.... 00156910 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00156920 00 00 00 00 00 00 00 dd 09 00 10 18 02 00 10 01 ................ 00156930 00 00 dd 1e 00 90 4c 33 0e 18 1a ff ff 00 00 00 ......L3........ 00156940 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00156950 00 00 bd ea f8 b3 ff ff ff ff ff ff ff ff ff ff ................ 00156960 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ * 022fb000That's a lot of 0xffs (around 31MB of them) with one small section that contains an 802.11 probe packet with the SSID of the hospital across the road from my house. Apple support network booting off wireless networks. It seems that the firmware brought up the wireless card, associated with this network (it's the only public one nearby) and then left the card DMAing packets into RAM. The read-only page attribute only applies to CPU-initiated accesses, so it could do this without triggering a page fault. It also explained why it was so random - whether memory corruption occurred would depend on whether a packet appeared between that memory being used by the OS and the kernel reinitialising the wireless card. It certainly explains why I couldn't reproduce it when I left the machine repeatedly rebooting on the bus home.
We're now 2.5 months in 2012 and I'm indeed getting closer of my first
big goal of the year : the 80km run of Paris Ecotrail.
The race takes place next Saturday, March 24th, with a start at 12:00
in the South-West of Paris area (close to our place). The race is
mostly a trail race in woods and forests in the neighbourhood of
Paris, going up and down in our small hills and valleys, passing along
pools and lakes and indeed showing the natural beauties we have less
than 20km away from center Paris.
The race ends at the Eiffel Tower. And they really mean it! The race
ends at Eiffel Tower's *first floor* after climbing the steps
there. Those of you who have been there can imagine the surprise of
tourists from all over the world when hundreds of "road warriors"
wearing water backpacks, head lamps and looking a bit tired come and
climb the Old Lady's stairs.
So, in case you happen to be touring in Paris on the week-end of March 24-25, just
pop up at Eiffel Tower around 10-11pm (yes, at night) and try to spot
a bubulle crawling up there to reach the finish line..:-)
To prepare this, I already ran 538km in 2012, mostly done either with
my daily commute runs...or with week-end long runs (up to 37km on
march 4th, and many others above 20km).
I ran two half-marathons as well: one in February, where I nearly
broke my record, finishing it in 1h37'45" even though this is a quite
though race with two hills. I was very in shape that day and was lucky
to run with a friend setting the pace for me, which helps a
lot. Another half-marathon last Sunday in Rambouillet was also a good
race, though I was secretly hoping to break my record there (the race
is flat, much more than the former one). I had however to slow down
from a 4'35"/km pace to 4'50"/km in order to preserve my
condition. And, finally, I completed the race in 1h39'53".
So, two half-marathons in less than 1h40 again. That sounds promising
for the Ecotrail (even if there nothing similar between a flat half-marathon
and a hilly ultra-trail) and also for the next marathon, in June.
I'll keep you posted about the Ecotrail race but I can announce in
advance that I'll be using the Runtastic app on my brand new Android
phone, and people will be able to follow my race live here. And
you'll even be able to cheer at /me..:-)
Next running update on Sunday 25th to give you the outcome....
I've been experimenting with a new packaging tool/workflow based on
marking certain commits on my integration branch for export as quilt
patches. In this post I'll walk though converting the package nauty to
this workflow.
% echo ':debpatch: upstream..master' > debian/source/git-patches
% git add debian/source/git-patches && git commit -m'add control file for gitpkg quilt export'
% git config gitpkg.deb-export-hook /usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
This says that all commits reachable from master but not from
upstream should be checked for possible export as quilt patches. % git archive --prefix=nauty/ build (cd /tmp ; tar xvf -)
More conventional git-buildpackage style packaging would not need this step.% git am /tmp/nauty/debian/patches/feature/shlib.diff
% git debpatch +export HEAD
git debpatch list outputs the following
afb2c20 feature/shlib
Export: true
makefile.in 241 +++++++++++++++++++++++++++++++++--------------------------
1 files changed, 136 insertions(+), 105 deletions(-)
The first line is the subject line of the patch, followed by any
notes from debpatch (in this case, just 'Export: true'), followed
by a diffstat. If more patches were marked, this would be repeated
for each one.
In this case I notice subject line is kindof cryptic and decide to amend.
git commit --amend
git debpatch list still shows the same thing, which highlights a
fundemental aspect of git notes: they attach to commits. And I just
made a new commit, so
git debpatch -export afb2c20
git debpatch +export HEAD
git debpatch list looks ok, so we try git debpatch export as
a dry run. In debian/patches we have
0001-makefile.in-Support-building-a-shared-library-and-st.patch
series
That looks good. Now we are not going to commit this, since one of
our overall goal is to avoid commiting patches.
To clean up the export, rm -rf debian/patchesgitpkg master exports a source package, and because I enabled the
appropriate hook, I have the following
% tar tvf ../deb-packages/nauty/nauty_2.4r2-1.debian.tar.gz grep debian/patches
drwxr-xr-x 0/0 0 2012-03-13 23:08 debian/patches/
-rw-r--r-- 0/0 143 2012-03-13 23:08 debian/patches/series
-rw-r--r-- 0/0 14399 2012-03-13 23:08 debian/patches/0001-makefile.in-Support-building-a-shared-library-and-st.patch
Note that these patches are exported straight from git.git push
git debpatch push
During the last week, I created ghc-heap-view, a library to investigate the actual memory representation of Haskell values. It is inspired by vacuum and the GHCi debugger, but goes beyond them by allowing the user to look inside thunks and functions and see what other values they refer to. Let me demonstrate it by running the included demo:
ghc-heap-view-demo
Here are a four different lists, where the first three are already evaluated.> l = [1,2,3]and is now found at 0x00000000006d1750/2 (where the /2 is the pointer tag information) and fully evaluated:
ConsClosure info = StgInfoTable ptrs = 2, nptrs = 0, tipe = CONSTR_STATIC, srtlen = 1 ,
ptrArgs = [0x00000000006d16e0/1,0x00000000006d1730/2],
dataArgs = [], descr = "ghc-prim:GHC.Types.:"
The second one, l2, is locally defined
> let l2 = 4:land now found at 0x00007fdce19fe4b0/2. See how the cons-cell references l!
ConsClosure info = StgInfoTable ptrs = 2, nptrs = 0, tipe = CONSTR_2_0, srtlen = 1 ,
ptrArgs = [0x00000000006dca50/1,0x00000000006d1750/2],
dataArgs = [],
descr = "ghc-prim:GHC.Types.:"
And the binding
> args <- map length fmap getArgsevaluates to the one , global empty list at 0x00000000006db640/1:
ConsClosure info = StgInfoTable ptrs = 0, nptrs = 0, tipe = CONSTR_NOCAF_STATIC, srtlen = 0 ,
ptrArgs = [],
dataArgs = [],
descr = "ghc-prim:GHC.Types.[]"
And now we have, at 0x00007fdce19fe4c8, the concatenation of them, but unevaluated:
> let x = l ++ l2 ++ argsThe thunk keeps a reference to l2 and args, but not l, as that is at a static address, unless you are running this in GHCi:
ThunkClosure info = StgInfoTable ptrs = 2, nptrs = 0, tipe = THUNK_2_0, srtlen = 1 ,
ptrArgs = [0x00007fdce19fe4b0/2,0x00000000006db640/1],
dataArgs = []
Now to some more closure types. m and m' locally bound of type the unboxed type Int#, with values 42 resp. 23.
> let f = \x n -> take (I# m + I# x) n ++ args t = f m' l2So here is (0x00007fdce1937d50/2), referencing its free variables args and 42:
FunClosure info = StgInfoTable ptrs = 1, nptrs = 1, tipe = FUN_1_1, srtlen = 65553 ,
ptrArgs = [0x00000000006db640/1],
dataArgs = [42]
And t is a thunk that applies f (also referenced here) to an unboxed value (23) and l2:
ThunkClosure info = StgInfoTable ptrs = 2, nptrs = 1, tipe = THUNK, srtlen = 0 ,
ptrArgs = [0x00007fdce19fe4b0/2,0x00007fdce1937d50/2],
dataArgs = [23]
Lastly, here is the standard example for self reference:
> let x = id (:) () xThis is what x (0x00007fdce1947940) looks like, at least without -O:
ThunkClosure info = StgInfoTable ptrs = 0, nptrs = 0, tipe = THUNK, srtlen = 1 ,
ptrArgs = [],
dataArgs = []
So it is unevaluated. Let us evaluate it using seq. Now we have, still at 0x00007fdce1947940:
IndClosure info = StgInfoTable ptrs = 1, nptrs = 0, tipe = BLACKHOLE, srtlen = 0 ,
indirectee = 0x00007fdce194cc98/2
The thunk was replaced by an indirection. If we look at the target, 0x00007fdce194cc98/2, we see that it is a newly created cons-cell referencing the original location of x:
ConsClosure info = StgInfoTable ptrs = 2, nptrs = 0, tipe = CONSTR_2_0, srtlen = 1 ,
ptrArgs = [0x00000000006db620/1,0x00007fdce1947940],
dataArgs = [],
descr = "ghc-prim:GHC.Types.:"
After running the garbage collector (performGC), we find that the address of x is now 0x00007fdce19f30d0/2 and that the self-reference is without indirections:
ConsClosure info = StgInfoTable ptrs = 2, nptrs = 0, tipe = CONSTR_2_0, srtlen = 1 ,
ptrArgs = [0x00000000006db620/1,0x00007fdce19f30d0/2],
dataArgs = [],
descr = "ghc-prim:GHC.Types.:"
Future plans
The output of ghc-heap-view is not really pretty yet; even the indentation in this blog post was added manually by me, so this really needs a pretty printer providing a nicer, possibly more compact representation, including something like what vacuum provides. Maybe vacuum can be ported to use this library, and also include the thunk s and function s references in the output. Maybe also the GHCi debugger can be extended to show more information about unevaluated expressions using this. Internally, the library is not very polished yet either. It only handles those closures types that I have seen so far, and is likely to break horribly if run in a threaded or debugging enabled runtime.
How it works
Obviously, this is not standard Haskell 98 code, but rather deep trickery involving the GHC API and some C code. Initially I tried to use the API that vacuum and the GHCi debugger rely on, which is an operation
unpackClosure# :: a -> (# Addr#, Array# b, ByteArray# #)which takes any Haskell value and returns the address to its info table, the pointers and the non-pointer-data in the closure. Unfortunately, it was not complete in that it was meant only for data closures and will for other closure types, e.g. thunks, return no data and no pointers (as can be seen in the code). So I implemented my own version of this operation:
foreign import prim "slurpClosurezh" slurpClosure# :: Any -> (# Addr#, ByteArray#, Array# b #)where the returned ByteArray# contains the complete closure, including extra information fields such as the arity of a function. The Array# is again the list of pointers in the closure. At first glance, this is a duplication, as the pointers are of course also contained in the ByteArray#. But as soon as the GHC runtime reigns again, a garbage collector run can happen, the referenced values will move somewhere else, and the words that once were pointers in the ByteArray# become useless. But the corresponding entries in the Array# are updated by the garbage collector, as it knows that these are pointers, and not just words. This way, we get both a faithful copy of the closure on the heap and useful references to the contained data. Here is a demonstration of this effect:
$ ghci -XMagicHash -package ghc-heap-view GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. [..] Loading package ghc-7.4.1 ... linking ... done. Loading package ghc-heap-view-0.1 ... linking ... done. Prelude> let a = [1,2,3,4]; b = 5:a Prelude> :m + GHC.HeapView Prelude GHC.HeapView> rawHeapData <- getClosureRaw b Prelude GHC.HeapView> rawHeapData (0x000000004080d658,[1082185320,140040739366568,140040739365928],[0x00007f5dc68626a8,0x00007f5dc6862428]) Prelude GHC.HeapView> System.Mem.performGC Prelude GHC.HeapView> rawHeapData (0x000000004080d658,[1082185320,140040739366568,140040739365928],[0x00007f5dc41b3ad8,0x00007f5dc41b3b28])The function rawHeapData is a thin wrapper around slurpClosure# which turns the primitive array in normal lists. Note that the second component of the triple is unchanged, but the third is updated by the garbage collector. Of course this means that the Show instance for the data type that ghc-heap-view uses to reference values is not referential transparent either. The foreign function import above is of type prim , i.e. does not call a C function but rather a Cmm function. Cmm is a reduced C that GHC uses internally to compile the Haskell code to, and most primitive operations are implemented in this language although I do quickly call regular C from my Cmm code to do the more complicated stuff, mainly figuring out what words of the closure are pointers. The knowledgeable reader might notice that I am passing a boxed value of type Any to the foreign function. This is currently not possible with foreign prim functions, and to actually use that code, you need the patch in GHC ticket #5931. But you can use ghc-heap-view without that as well (and the Cabal package will by default use that path), using the following hack to obtain the pointer to a Haskell value on the Heap as an unboxed type that can pass to the primitive operation:
foreign import prim "slurpClosurezh" slurpClosure'# :: Word# -> (# Addr#, ByteArray#, Array# b #) data Ptr' a = Ptr' a aToWord# :: Any -> Word# aToWord# a = case Ptr' a of mb@(Ptr' _) -> case unsafeCoerce# mb :: Word of W# addr -> addr slurpClosure# :: Any -> (# Addr#, ByteArray#, Array# b #) slurpClosure# a = slurpClosure'# (aToWord# a)This works because a Word and a Ptr' have the same closure layout, only differing in the fact that one stores an a, and the other stores a Word#. Once we obtained the raw representation of the closure, we do the parsing in Haskell. Using the info table and the raw closure, we have enough information to tell which words have to be replaced by the appropriate pointer (which might already have been updated by the garbage collector) in the pointers list. This work was supported by a scholarship from the Deutsche Telekom Stiftung.
For a while now the git repository used for packaging WebKitGTK+ has been broken. Broken as in nobody was able to clone it. In addition to that, the packaging workflow had been changing over time, from a track-upstream-git/patches applied one to a import-orig-only/patches-not-applied one.
After spending some more time trying to unbreak the repository for the third time I decided it might be a good time for a clean up. I created a new repository, imported all upstream versions for series 1.2.x (which is in squeeze), 1.6.x (unstable), and 1.7.x (experimental). I also imported packaging-related commis for those versions using git format-patch and black magic.
One of the good things about doing this move, and which should make hacking the WebKitGTK+ debian package more pleasant and accessible can be seen here:
kov@goiaba ~/s/debian-webkit> du -sh webkit/.git webkit.old/.git
27M webkit/.git
1.6G webkit.old/.git
If you care about the old repository, it s on git.webkit.org still, named old-webkit.git. Enjoy!
Recently I accidentally flooded Planet Debian with my blog feed. This was an accident caused by some of my older blog entries not having valid "Date:" headers. (I use chronicle which parses simple text files to build a blog, and if there is no Date: header present in entries it uses the CTIME of the file(s).)
So why did my CTIMEs get lost? Short version I had a drive failure and a PSU failure which lead to me rebuilding a few things and cloning a fresh copy of my blog to ~/hg/blog/.
My host is now once again OK, but during the pain the on-board sound started to die. Horribly crackly and sounding bad. I figure the PSU might have caused some collateral damage, but so far thats the only sign I see.
I disabled the on-board sound and ordered a cheap USB sound device which now provides me with perfect sound under the Squeeze release of Debian GNU/Linux.
In the past I've ranted about GNU/Linux sound. So I think it is only fair to say this time things worked perfectly - I plugged in the device, it was visible in the output of dmesg, and /proc/asound/cards and suddenly everything just worked. Playing music (mpd + sonata) worked immediately, and when I decided to try playing a movie with xine just for fun sound was mixed appropriately - such that I could hear both "song" + "movie" at the same time. Woo.
(I'm not sure if I should try using pulse-audio, or similar black magic. Right now I've just got ALSA running.)
Anyway as part of the re-deployment of my desktop I generated and pass-phrased a new SSH key, and then deployed that with my slaughter tool. My various websites all run under their own UID on my remote host, and a reverse-proxy redirects connections. So far example I have a Unix "s-stolen" user for the site stolen-souls.com, a s-tasteful user for the site tasteful.xxx, etc. (Right now I cannot remember why I gave each "webserver user" an "s-" prefix, but it made sense at the time!)
Anyway once I'd fixed up SSH keys I went on a spree of tidying up and built a bunch of meta-packages to make it a little more straightforward to re-deploy hosts in the future. I'm quite pleased with the way those turned out to be useful.
Finally I decided to do something radical. I installed the bluetile window manager, which allows you to toggle between "tiling" and "normal" modes. This is my first foray into tiling window managers, but it seems to be going well. I've got the hang of resizing via the keyboard and tweaked a couple of virtual desktops so I can work well both at home and on my work machine. (I suspect I will eventually migrate to awesome, or similar, this is very much a deliberate "ease myself into it" step.)
ObQuote: "Being Swedish, the walk from the bathroom to her room didn't need to be a modest one. " - Cashback.
We in Debian-IN team where maintaining ttf-indic-fonts a set of fonts for all
Indian language fonts from various origin. This package used to build around 7
to 10 binary package of different Indian language. The source package ttf-indic-fonts
was itself a mess. It was a native package it was mixing all fonts with active
upstream and inactive upstream together which was hard to maintain. Last April
I transitioned this package from old packaging style (which version I don't remember)
to dh7 standard. At the same time bubulle asked me it would be great if I
can rename the package to Fonts team new packaging policy
Even though I was just beginning with Debian packaging I dared to propose a draft
:) Well it was in May and now its March 2012 almost one year over and We have
successfully finished the transition and Kartik
uploaded all packages to Debian. Now Debian-IN team maintains 62 packages and
me? Yeah my package count jumped from 12 to 38! Almost close to close to number
of packages Kartik is maintaining :)
Please do the testing report any bugs! Cya
We in Debian-IN team where maintaining ttf-indic-fonts a set of fonts for all
Indian language fonts from various origin. This package used to build around 7
to 10 binary package of different Indian language. The source package ttf-indic-fonts
was itself a mess. It was a native package it was mixing all fonts with active
upstream and inactive upstream together which was hard to maintain. Last April
I transitioned this package from old packaging style (which version I don't remember)
to dh7 standard. At the same time bubulle asked me it would be great if I
can rename the package to Fonts team new packaging policy
Even though I was just beginning with Debian packaging I dared to propose a draft
:) Well it was in May and now its March 2012 almost one year over and We have
successfully finished the transition and Kartik
uploaded all packages to Debian. Now Debian-IN team maintains 62 packages and
me? Yeah my package count jumped from 12 to 38! Almost close to close to number
of packages Kartik is maintaining :)
Please do the testing report any bugs! Cya
Having monitoring for dualstack connectivity in place helps a lot. Unfortunately in most cases we are running also services we want to offer dualstacked. In the past we just monitored in those cases IPv4 only or created a separate check for the same service on IPv6. This is a bit messy and I was looking for something to check services via IPv4 and IPv6. Digging my most boring search engine doesn t help much here. So I was talking with some people more involved into the core Icinga/Nagios stuff. Seems there is actually the best solution to use check_multi.
As we have the command definition for check_multi_icinga already in place, I created a check_smtp_dualstack.cmd for monitoring a dualstacked SMTP service
command[ IPv4 ] = check_smtp -4 -H $HOSTADDRESS$
command[ IPv6 ] = check_smtp -6 -H $HOSTADDRESS6$
state [ CRITICAL ] = COUNT(CRITICAL) > 1
state [ WARNING ] = COUNT(WARNING) > 0 COUNT(CRITICAL) > 0
state [ UNKNOWN ] = COUNT(UNKNOWN) > 1
A simple SMTP service definition does the trick (don t forget address6 in host definition)
define service
use generic-service ; Name of service template to use
host_name localhost
service_description SMTP
check_command check_multi_icinga! check_smtp_dualstack.cmd !'-r 1+2+4+8
Okay .. that looks nice, but only at the first view. Imagining what we are actually running as service checks, it seems we just need for every unique service check a new cmd-file for check_multi as I didn t found a way to generalize the whole stuff yet.
Does anybody know a way to pass commands for check_multi via service definitions? Something like:
define service
[...]
check_command check_multi_icinga! check_general_dualstack.cmd !'check_smtp -p 666 ! -r 1+2+4+8
[...]
Since some ages we are deploying IPv6 in our network and also for some selected services. Some days ago we discovered, that anybody has enabled accidentally a router advertisement daemon in a network where this shouldn t happen. As result of this, IPv6 enabled systems got (additional) IPv6 adresses and some services where using this new learned addresses as source address when sending out replies.
Maybe this doesn t sound so harmful on the first view. But some services rely on a correct source address when getting a reply for a request (for example dns resolver library).
To be aware of the issue, that a service maybe available via IPv4 but not via IPv6 or vica versa, a dualstacked monitoring needs to be in place for dualstacked services. Looking into the issue, I stumbled upon Michael Friedrichs HowTo about Dualstacked monitoring with Icinga.
Luckily we have the full software stack in place on Squeeze (with squeeze-backport). As icinga and nagios-plugins was in installed already, I just needed to fetch check_multi.
aptitude install -t squeeze-backports nagios-plugin-check-multi Now a new check command is needed, I created the following:
define command
command_name check_multi_icinga
command_line /usr/lib/nagios/plugins/check_multi \
-f /etc/check_multi/$ARG1$ $ARG2$ $ARG3$ $ARG4$ \
-s objects_cache=/var/cache/icinga/objects.cache \
-s status_dat=/var/cache/icinga/status.dat \
-s HOSTADDRESS=$HOSTADDRESS$ -s HOSTADDRESS6=$HOSTADDRESS6$
For monitoring connectivity I created check_host_alive_dualstack.cmd
command[ IPv4 ] = check_ping -4 -H $HOSTADDRESS$ -w 5000.0,100% -c 5000.0,100% -p 5
command[ IPv6 ] = check_ping -6 -H $HOSTADDRESS6$ -w 5000.0,100% -c 5000.0,100% -p 5
state [ CRITICAL ] = COUNT(CRITICAL) > 1
state [ WARNING ] = COUNT(WARNING) > 0 COUNT(CRITICAL) > 0
state [ UNKNOWN ] = COUNT(UNKNOWN) > 1
Now we just need to replace the check-host-alive command and add a value for address6 on the host as the following
define host
use generic-host ; Name of host template to use
host_name localhost
alias localhost
address 127.0.0.1
address6 ::1
check_command check_multi_icinga! check_host_alive_dualstack.cmd !'-r 1+2+4+8
Reloading icinga should you show something like this:
Now we have general connectivity of our dualstacked systems monitored.
I followed Gregor s evolution within Debian because I used to be somewhat active in the Perl team. His case is exemplar because it shows that you don t need to be an IT professional to join Debian and to make a difference. His QA page is impressive with hundreds of packages maintained and hundreds of non-maintainer uploads too.
While he started out slowly, I remember meeting him at Debconf 7 in Edinburgh and after that he really got more implicated. Again a case of someone joining for technical reasons but getting more involved and staying there for social reasons! Subscribe to my newsletter to get my monthly summary of the Debian/Ubuntu news and to not miss further interviews. You can also follow along on Identi.ca, Google+, Twitter and Facebook.
2 comments Liked this article? Click here. My blog is Flattr-enabled.
One of the best way to
add SNMP support to an application is the use of AgentX protocol:
an application can act as a subagent and handle requests from a
master agent using AgentX protocol. The most widespread
implementation for such a task is the one from Net-SNMP.
TL;DR: An application asynchronously leveraging Net-SNMP AgentX
implementation has many opportunities to get stuck when the master
agent becomes temporarily unavailable. A mostly efficient workaround
is to dedicate a master agent for AgentX and delegate MIB handling to
a subagent.
run_alarms()
function which will call agentx_check_session():
/* * check a session validity for connectivity to the master agent. If * not functioning, close and start attempts to reopen the session */ void agentx_check_session(unsigned int clientreg, void *clientarg) /* [...] */ DEBUGMSGTL(("agentx/subagent", "checking status of session %p\n", ss)); if (!agentx_send_ping(ss)) snmp_log(LOG_WARNING, "AgentX master agent failed to respond to ping. Attempting to re-register.\n"); /* * master agent disappeared? Try and re-register. * close first, just to be sure . */ agentx_unregister_callbacks(ss); agentx_close_session(ss, AGENTX_CLOSE_TIMEOUT); /* [...] */ if (main_session != NULL) /* [...] */ main_session = NULL; agentx_reopen_session(0, NULL); else snmp_close(main_session); main_session = NULL; else DEBUGMSGTL(("agentx/subagent", "session %p responded to ping\n", ss));
agentx_synch_response():
agentx_send_ping()agentx_open_session()agentx_reopen_session()agentx_close_session()agentx_register()agentx_unregister()agentx_register_index()agentx_unregister_index()agentx_add_agentcaps()agentx_remove_agentcaps()agentx_synch_response() will synchronously wait for an answer
from the master agent. Your event-based program will just sit here
doing nothing while this happens. For example, keepalived may be
unable to send VRRP probes resulting in some serious havoc in your cluster.
Functions prefixed by agentx_ are not part of NetSNMP API and could
therefore be rewritten to do their work asynchronously. Unfortunately,
talk is cheap. Moreover, there exists
other deep paths that will block a subagent. For example, the
low-level connection to the master agent (using TCP or a Unix socket,
but not with UDP) will use a blocking connect() call. It seems quite
difficult to fix this.
Here are some (partial) workarounds:
agentx_check_session() less often. The default interval is
15 seconds. Disabling it completely or using a very high value is
not advised because this function is the only way to reestablish a
connection to the master agent when it is, for example,
restarted. Here is how to change the delay to 120 seconds:
netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 120);
agentx_check_session() if we know the master agent is
alive. For example, if it just sent us a new request, no need to
ping it. I have written a
patch implementing such a workaround. The ABI is left
untouched, therefore, you only need to recompile Net-SNMP libraries.
static int snmp_setup_session_cb(int majorID, int minorID, void *serverarg, void *clientarg) netsnmp_session *sess = serverarg; sess->timeout = ONE_SEC / 3; sess->retries = 0; return 0; void some_init_function() /* [...] */ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT, snmp_setup_session_cb, NULL); /* [...] */
snmpd is also an event-based
program and, trust me, there are a lot of places where it will become
unresponsive. Here are two examples:
pass or the pass_persist directive, Net-SNMP
will block until the delegated command outputs a complete line.
/* var_extensible_pass() in agent/mibgroup/ucd-snmp/pass.c */ /* * valid call. Exec and get output */ if ((fd = get_exec_output(passthru)) != -1) file = fdopen(fd, "r"); if (fgets(buf, sizeof(buf), file) == NULL) fclose(file); wait_on_exec(passthru); /* [...] */ continue; /* [...] */ fclose(file); wait_on_exec(passthru); /* [...] */
DISMAN-PING-MIB implementation will just hang while pinging the
remote host. If the host is down and you have requested 5 probes
with a timeout of 1 second, snmpd will be unresponsive for 5
seconds. A similar problem exists with DISMAN-TRACEROUTE-MIB.
It is quite easy to turn snmpd into a subagent: just use -X
flag. We should also disable unwanted MIB modules for each agent with
-I flag. For the minimal master agent, we only enable some
modules. All other modules3 will be served by snmpd acting
as a subagent.
$ MODS="snmp_mib,sysORTable,usmConf,usmStats,usmUser,vacm_conf,vacm_context,vacm_vars" $ snmpd -Lsd -Lf /dev/null -u snmp -g snmp \ > -C -c /etc/snmp/snmpd.master.conf \ > -p /var/run/snmpd.master.pid \ > -I $MODS $ snmpd -Lsd -Lf /dev/null -u snmp -g snmp \ > -p /var/run/snmpd.pid -X \ > -I -$MODS
/etc/snmp/snmpd.master.conf, as well as master agentx
directive. Other directives (like pass, pass_persist, load,
sysname, ) in /etc/snmp/snmpd.conf.
The minimal master agent is very unlikely to block and while the
ground cause is still here, it is now very much mitigated. You may
extend this solution by splicing snmpd into several subagents: one
handling safe modules, one handling pass and pass_persist stuff
and a last one for unsafe modules (like DISMAN-PING-MIB).
agentx_reopen_session() will call agentx_close_session()
and agentx_open_session(). agentx_register() and
the following functions will be called by those
two functions.
NETSNMP_DS_AGENT_AGENTX_TIMEOUT and NETSNMP_DS_AGENT_AGENTX_RETRIES
variables are only used by the master agent, not by a subagent.
snmpd -Dmib_init -H to get the list of modules. You
may want to add smux module to the master agent.
Next.