Linux - KernelThis forum is for all discussion relating to the Linux kernel.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

Hi, I have written a network driver and it is sending and receiving packets, and I can use wget to download something from the internet, but when I try to run a webserver or telnetd and initiate the TCP session from another computer, it does not work.

I want to check if the packets sent from the other computer are being passed up the layers correctly. I know they are reaching the device driver because I printk them there. I know they are being passed up using "netif_rx".

Could someone please tell me what the other functions are which handle packets so I can add printk's through out the kernel to check they are being passed correctly?

"netif_rx" looks like it calls "skb_queue_tail" to queue up the packet for the upper layers. Where would I find the functions that next deal with the skb?

For completeness, I am running uClinux on a Nios II, but any ideas are appreciated!

I'd try first with ping. Both from the kernel in question and to the kernel in question. If ping works correctly, it's something at the higher layers, so it may be worth it to add printk to net/ipv4/ip_input.c ip_rcv function and ipv4/tcp_ipv4.c in tcp_v4_rcv. Of couse, if the packets reach both functions, it will be just the beginning. On the other hand, if ping doesn't work, it may be something below the routing level. Are you sure they are added to the queue by netif_rx?

The testing procedure I am currently doing is:
- Both computers are connected directly
- My PC is 10.42.43.1 and the Nios 10.42.43.10
- They can ping each other reliably.
- I start Boa (webserver) on the Nios
- From my PC, I can wget the home page and text files (~500bytes) from the Nios, the TCP sessions are successful
I have added printk's to ip_input.c and tcp_ipv4.c on the Nios. For the successful "HTTP GET" packets I can see that the skb gets passed up from "netif_rx" to "ip_rcv" and then to "tcp_v4_do_rcv" where "sk->sk_state == TCP_ESTABLISHED".

- From my PC, I try to wget an image (~20kbytes) from the Nios. Now, the PC keeps resending "HTTP GET" requests but the Nios does not reply.
I now see these "HTTP GET" packets are being correctly passed up by "netif_rx", then "ip_rcv", then "tcp_v4_rcv" but are dropped in "tcp_v4_do_rcv"

to my driver and edited my boa.conf file and now have the basic web server running. I start the server (boa) in uClinux by typing "boa &". When I go to cgi, html, text or css files in firefox they display correctly, but some images do not.

I have a set of images which I am testing with (just screenshots and logos from my desktop). There are two images (one .jpg one .png) which consistently work in Firefox. There are three images which consistently do not work in firefox.(two .pngs one .jpg)

I can use "wget" to download the images that do not work in firefox, but the images that do work in firefox do not work in wget!!

I have a screenshot test.png for example, it works in firefox but not in wget. On the uClinux machine I run "cp test.png test2.png". test2.png now downloads in wget, but does not display in firefox!

At first I thought this was related to Boa, but if I run httpd instead of boa to host the pages, it shows the same behaviour.

Any help will be much appreciated as I have hit another brick wall in my development and I can't figure it out!

My boa.conf file is:

Quote:

# Boa v0.94 configuration file
# File format has changed little from 0.92
# version changes are noted in the comments
#
# The Boa configuration file is parsed with a lex/yacc or flex/bison
# generated parser. If it reports an error, the line number will be
# provided; it should be easy to spot. The syntax of each of these
# rules is very simple, and they can occur in any order. Where possible
# these directives mimic those of NCSA httpd 1.3; I saw no reason to
# introduce gratuitous differences.

# The "ServerRoot" is not in this configuration file. It can be compiled
# into the server (see defines.h) or specified on the command line with
# the -c option, for example:
#
# boa -c /usr

# Port: The port Boa runs on. The default port for http servers is 80.
# If it is less than 1024, the server must be started as root.

Port 80

# User: The name or UID the server should run as.
# Group: The group name or GID the server should run as.

User root
Group root

# ServerAdmin: The email address where server problems should be sent.
# Note: this is not currently used.

#ServerAdmin root@localhost

# ErrorLog: The location of the error log file. If this does not start
# with /, it is considered relative to the server root.
# Set to /dev/null if you don't want errors logged.

ErrorLog /var/log/boa/error_log

# AccessLog: The location of the access log file. If this does not
# start with /, it is considered relative to the server root.
# Comment out or set to /dev/null (less effective) to disable
# Access logging.

AccessLog /var/log/boa/access_log

# RefererLog: The location of the referer log file. If this does not
# start with /, it is considered relative to the server root.
# Comment out or set to /dev/null (less effective) to disable
# referer logging.

RefererLog /var/log/boa/referer_log

# AgentLog: The location of the agent log file. If this does not
# start with /, it is considered relative to the server root.
# Comment out or set to /dev/null (less effective) to disable
# User-Agent logging.

AgentLog /var/log/boa/agent_log

# VerboseCGILogs: this is just a logical switch.
# Comment out to disable.

#VerboseCGILogs

# ServerName: the name of this server that should be sent back to
# clients if different than that returned by gethostname -- often
# this is www.foo.bar.

ServerName uClinux

# DocumentRoot: The root directory of the HTML documents.

DocumentRoot /home/httpd

# ChRoot: Boa root '/' directory. This is useful to improve security of
# your system. Don't forget that ALL DIRECTORIES used by boa except logs
# must be in this directory. If you need cgi scripts, you must copy shared
# libraries to this directory (see ldconfig(8) for more info)

#Chroot /var

# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is recieved.

UserDir public_html

# DirectoryIndex: Name of the file to use as a pre-written HTML
# directory index. Please MAKE AND USE THESE FILES. On the
# fly creation of directory indexes can be _slow_.
#

DirectoryIndex index.html

#DirectoryMaker /usr/boa_indexer

# LocalCodepage: Local codepage. This is send to client in 'Content-Type:'
# header by default.

#LocalCodepage iso-8859-1

# Codepage: Load codepage conversion table from file. This table will be used
# on-the-fly conversion.

# CodepageByBrowser: Specify codepage by $USER_AGENT. This command is used for
# automatic codepage selection. You can use characters '*' and '?' in browser
# string. For example, "CodepageByBrowser Lynx/* us-ascii" will send for Lynx
# users all documents in us-ascii.

#CodepageByBrowser Lynx/* us-ascii

# KeepAliveMax: Number of KeepAlive requests to allow per connection
# Comment out, or set to 0 to disable keepalive processing

KeepAliveMax 100

# KeepAliveTimeout: seconds to wait before keepalive connection times out

KeepAliveTimeout 20

# MimeTypes: This is the file that is used to generate mime type pairs
# and Content-Type fields for boa.

MimeTypes /etc/mime.types

# DefaultType: MIME type used if the file extension is unknown, or there
# is no file extension.

# Uncomment the next line if you want .cgi files to execute from anywhere
#AddType application/x-httpd-cgi cgi

# Redirect, Alias, and ScriptAlias all have the same semantics -- they
# match the beginning of a request and take appropriate action. Use
# Redirect for other servers, Alias for the same server, and ScriptAlias
# to enable directories for script execution.

# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example: Redirect /bar http://elsewhere/feh/bar

Wget and firefox download files differently and the differences are quite subtle. I think you should make friends with Wireshark, if you haven't already. Run it, then download the on the files in question with wget and firefox. There are differences, for sure. The firefox trace should have some errors (http? or maybe tcp reset?) If you're unsure of what you see, post the essentials about the packets going. This will hopefully lead to an option in the server or in your driver.

BTW That checsumming part is worth checking. Are you sure this part is handled correctly? Please check three times.

I am currently researching and testing the checksum options to confirm I am using the right one.

I have been observing the differences in the wget and firefox packets when trying to request the same file. When I try to request a file which works in wget and not firefox, the only differences (apart from timestamps/checksums) in the "get" packets sent are: