From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 21 08:57:28 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DFE6DEFA; Sat, 21 Mar 2015 08:57:28 +0000 (UTC) Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9FD76B53; Sat, 21 Mar 2015 08:57:28 +0000 (UTC) Received: by oifl3 with SMTP id l3so78400445oif.0; Sat, 21 Mar 2015 01:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=9DTS65mhCOnA7N5S8O0KxU2klmGyS2Bsrtmz+St/gjs=; b=FuIxMfDWeWoK22oxf/6vz5Qwfdn744YRcW373Pu1D6UaKGyA3gJfGUT5LCITwe25JZ 7fwy8wbbbnpH66igri+xcLuCtmrFeUpVcrk4O9t5OHOL7Hkf22Jpzc08YiFIt2DLWFDg gfzDBBe/5kGWzHSmI0ryEYlFTqs71iwroAZTT92xm6PB0wOi1NyukJK95+uGKPUuhkpf IBOMFTYmwmxu9lFS8JCNTESt/X5r9+i5cUN74XAQ5NFlF2J6LbNAV5qFbTJJdIVc3zC4 usLZs5/7OndzaQ9ThXIWR9jQ/IOtSGrBTeE3paRR2HIP7LRffKnOfaErXnhOCkdvDvkP +bMw== MIME-Version: 1.0 X-Received: by 10.60.83.233 with SMTP id t9mr63222597oey.73.1426928247973; Sat, 21 Mar 2015 01:57:27 -0700 (PDT) Sender: pali.gabor@gmail.com Received: by 10.182.135.35 with HTTP; Sat, 21 Mar 2015 01:57:27 -0700 (PDT) In-Reply-To: References: Date: Sat, 21 Mar 2015 09:57:27 +0100 X-Google-Sender-Auth: Jv-EzPGFw8FXAqAsxresJrx7Kiw Message-ID: Subject: Re: Self introduciton of Hao Sun and thoughts on LibNetstat From: Gabor Pali To: Hao Sun Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Robert Watson X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Mar 2015 08:57:29 -0000 [Please CC me in your replies, I am not on freebsd-hackers.] Hi Hao, 2015-03-19 1:53 GMT+01:00 Hao Sun : > I saw the project introduction of LibNetstat on > FreeBSD=E2=80=99s GSoC 15=E2=80=99 homepage and was attracted by the proj= ect. Thank you for contacting us, it is always good to see fresh people around who would like to contribute to the Project, especially as part of the Google Summer of Code program. > I think the LibNetstat would be fitful for me because I have related rich > project experiences on C, namely the FontDesigner project in the lab, the > face recognition plugin in Muticoreware and other course projects. I believe this project is mostly about refactoring the netstat(1) utility into a library and make the utility its client. This could come with many advantages, such as other programs could easily access the services it would offer and this would also help with accessing all the networking-related statistics in an platform-independent way, even through the network. The goal of the project is to come up with an API and ABI that is convenient to use and captures all the concepts that are currently used in netstat(1). > I read the project description carefully and have done the following jobs > since the monitoring organisations were published. I think those are indeed good first steps in order to get involved. > 1. Check out the code from //depot/projects/soc2009/pgj_libstat/. As the = p4 > introduction article shows, maybe I need a FreeBSD.org account to get > access into our depot. Thus would you please offer helps to create an > account? Please note that project you are talking about was done almost 6 years ago. Things can change a lot even in a year, so you may find yourself starting again from scratch (which may be equally either good or bad news for you). One of those changes is that Perforce has shifted out of the focus in the recent years, students have started to use the Project's Subversion repositories for their works, or I believe, now they can even choose to work with git, through GitHub. So, I guess you would only need a GitHub account and you are ready to fork the Git mirror of the FreeBSD src repository there: https://github.com/freebsd/freebsd > 2. I plan to run some demo codes to have an insight into the current vers= ion > of LibNetstat. Do we have demo codes or test cases which could help me > get familir with the code? It is also keep in mind that the original libnetstat code was written and kept updated until 2011, which assumes an older base system (and kernel) version of FreeBSD. Again, many changes might have changed (and I am sure they have indeed changed) in the recent years, like the kernel now has nice atomic counters for networking statistics (thanks to Gleb Smirnoff) which was one of the blocker issues when I stopped working on the project. Of course, if you would like to study the code that we wrote and you have questions about it, I am happy answer them -- note that you can access all the sources through the P4DB web, you do not have to check out anything. However, please also note I am not officially a src committer so my comments may not be as precise as for example, Robert's. I have gained some experienced in working with the networking parts of the FreeBSD kernel and I have a few years of experience in hacking on various projects ranging from computer games to compilers, but that is not my area of expertise therefore I may not be up-to-date enough on the subject. > 3. After Step #2, I want to read some existing modules, for instance, > routing abstractions. I believe this step would help me get clear how to > make the original interface less ABI-sensitive. So do you have any > suggestions where to start this step? Most of the userspace code can be found here: https://p4web.freebsd.org/@md=3Dd&cd=3D//depot/projects/soc2009/pgj_libstat= /src/lib/&c=3DhL4@//depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/?= ac=3D83 They may have related kernel-side changes, but for the first stab, I think that is what you may want to see. "netstat.h" and "netstat_internal.h" may tell you more about the abstractions I created. Feel free to dump them, and start from scratch, perhaps I would do them differently myself if I started to work on this project today. For further reference, you can also study the sister libraries of libnetstat, libprocstat and libmemstat. They are probably much more up-to-date with the current state of the development: https://github.com/freebsd/freebsd/tree/master/lib/libmemstat https://github.com/freebsd/freebsd/tree/master/lib/libprocstat Cheers, G=C3=A1bor