From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 22 13:52:18 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71004176; Sun, 22 Mar 2015 13:52:18 +0000 (UTC) Received: from cyrus.watson.org (cyrus.watson.org [198.74.231.69]) by mx1.freebsd.org (Postfix) with ESMTP id 2704B23C; Sun, 22 Mar 2015 13:52:18 +0000 (UTC) Received: from [10.0.1.17] (host81-156-92-60.range81-156.btcentralplus.com [81.156.92.60]) by cyrus.watson.org (Postfix) with ESMTPSA id 93F1D46B2A; Sun, 22 Mar 2015 09:52:10 -0400 (EDT) Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: Self introduciton of Hao Sun and thoughts on LibNetstat From: "Robert N. M. Watson" In-Reply-To: Date: Sun, 22 Mar 2015 13:52:07 +0000 Message-Id: <826E80C6-55BE-4690-B35B-14670EE482AD@FreeBSD.org> References: To: Hao Sun X-Mailer: Apple Mail (2.2070.6) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: Gabor Pali , freebsd-hackers@freebsd.org 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: Sun, 22 Mar 2015 13:52:18 -0000 Tuning in slightly late: I=E2=80=99m not sure if the bsnmp=E2=80=99s = plugins might also want to learn about libnetstat and friends? Robert > On 22 Mar 2015, at 12:09, Hao Sun wrote: >=20 > Hi G=C3=A1bor, >=20 > Thanks a lot for the relpy. Your comments provide me a lot of valuable = information, and now I'm getting clearer about what the target is and = what need I do in the future.=20 >=20 > Following your guidance, I've cloned the FreeBSD mirror from GitHub = and will get down to have an initial scratch with the latest version. = Yeah, 6 years passed by, a lot have been changed and updated during that = period. Also I had a glance over the existing user-space code and get = cleared about the basic code strcture and abstratactions of the previous = version. Now I think it's time to propose my ideas about the project and = write the proposal. >=20 > However there is one more quesiton. On the project's wiki page = (https://wiki.freebsd.org/LibNetstat = ) , I think the target for GSoC = 2015 is to finish the tasks haven't been done in the following table. = But accroding to your comments in the emails, it seems like I need to = start the job from scratch. Thus the question is should I keep the = existing code and add new features to the previous version or just start = the project from the very beginning? >=20 > =20 > >=20 > Thanks, > Hao >=20 >=20 > 2015-03-21 16:57 GMT+08:00 Gabor Pali >: > [Please CC me in your replies, I am not on freebsd-hackers.] >=20 > Hi Hao, >=20 > 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 = project. >=20 > 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. >=20 > > 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. >=20 > 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). >=20 > > I read the project description carefully and have done the following = jobs > > since the monitoring organisations were published. >=20 > I think those are indeed good first steps in order to get involved. >=20 > > 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? >=20 > 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. >=20 > 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: >=20 > https://github.com/freebsd/freebsd = >=20 > > 2. I plan to run some demo codes to have an insight into the current = version > > of LibNetstat. Do we have demo codes or test cases which could help = me > > get familir with the code? >=20 > 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. >=20 > 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. >=20 > > 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? >=20 > Most of the userspace code can be found here: >=20 > = https://p4web.freebsd.org/@md=3Dd&cd=3D//depot/projects/soc2009/pgj_libsta= t/src/lib/&c=3DhL4@//depot/projects/soc2009/pgj_libstat/src/lib/libnetstat= /?ac=3D83 = >=20 > 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. >=20 > 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: >=20 > https://github.com/freebsd/freebsd/tree/master/lib/libmemstat = > https://github.com/freebsd/freebsd/tree/master/lib/libprocstat = >=20 > Cheers, > G=C3=A1bor >=20