Self introduciton of Hao Sun and thoughts on LibNetstat

Hao Sun sunhao2013 at gmail.com
Sun Mar 22 12:09:12 UTC 2015


Hi Gábor,

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.

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.

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?


[image: 内嵌图片 2]

Thanks,
Hao


2015-03-21 16:57 GMT+08:00 Gabor Pali <pgj at freebsd.org>:

> [Please CC me in your replies, I am not on freebsd-hackers.]
>
> Hi Hao,
>
> 2015-03-19 1:53 GMT+01:00 Hao Sun <sunhao2013 at gmail.com>:
> > I saw the project introduction of LibNetstat on
> > FreeBSD’s GSoC 15’ homepage and was attracted by the project.
>
> 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
> version
> > 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=d&cd=//depot/projects/soc2009/pgj_libstat/src/lib/&c=hL4@//depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/?ac=83
>
> 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ábor
>


More information about the freebsd-hackers mailing list