Samba and the French Cafe Technique

To the London LinuxWorld today, which seemed miniscule after the San Francisco one only a few weeks ago. I was surprised at just how small it was, given the importance of Linux to the UK, and the importance of the UK to Linux, but it was still interesting.

On the train I was listening to podcasts, as I often do now while travelling. That has been the biggest impact of the iPod for me personally: the fact that I no longer consider waiting time and travelling time as wasted time, even if I’m driving or walking and couldn’t easily read a book. I spend much more time on my iPod listening to speech than I do to music…

Anyway, one of the interviews I listened to was with Jeremy Allison, a key developer of Samba. For those who don’t know, Samba is free software which shares files and printers over a network using Microsoft’s protocols, meaning that Windows machines can communicate with Macs, Linux & Unix boxes and a variety of other devices that use Samba under the hood. It’s a very important piece of software, and I’ve been using it for about 11 years.

Of course, Microsoft don’t publish the details of their protocols. If they had their way, then Windows machines would only be able to talk to other Windows machines. So Andrew Tridgell, the creator of Samba, has to work out what they’re doing through a variety of cunning techniques. He wrote a nice article about how he does it. I particularly liked his description of what he calls ‘The French Cafe Technique’:

Imagine you wanted to learn French, and there were no books, courses etc
available to teach you. You might decide to learn by flying to France and
sitting in a French Cafe and just listening to the conversations around you.
You take copious notes on what the customers say to the waiter and what food
arrives. That way you eventually learn the words for “bread”, “coffee”
etc.

We use the same technique to learn about protocol additions that Microsoft
makes. We use a network sniffer to listen in on conversations between
Microsoft clients and servers and over time we learn the “words” for “file
size”, “datestamp” as we observe what is sent for each query.

Now one problem with the “French Cafe” technique is that you can only learn
words that the customers use. What if you want to learn other words? Say for
example you want to learn to swear in French? You would try ordering something
at the cafe, then stepping on the waiters toe or poking him in the eye when he
gives you your order. As you are being kicked out you take copious notes on
the words he uses.

The equivalent of “swear words” in a network protocol are “error packets”.
When implementing Samba we need to know how to respond to error conditions. To
work this out we write a program that deliberately accesses a file that
doesn’t exist, or uses a buffer that is too small or accesses a file we don’t
own. Then we watch what error code is returned for each condition, and take
notes.

Got Something To Say:

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

*

© Copyright Quentin Stafford-Fraser