# Network support for SO3

**URL:** <http://discourse.heig-vd.ch/t/network-support-for-so3/72>\
**Category:** SO3 Operating System\
**Created:** [February 27, 2020, 1:40pm UTC](http://discourse.heig-vd.ch/t/network-support-for-so3/72 "2020-02-27T13:40:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jquartier](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/j/f07891/32.png) [@jquartier](http://discourse.heig-vd.ch/u/jquartier)\
**Post date:** [February 27, 2020, 1:40pm UTC](http://discourse.heig-vd.ch/t/network-support-for-so3/72/1 "2020-02-27T13:40:00Z")

</div>

As part of my Bachelor final project, I will work on implementing network support.

---

<div class="post-metadata">

**Author:** ![jquartier](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/j/f07891/32.png) [@jquartier](http://discourse.heig-vd.ch/u/jquartier)\
**Post date:** [March 4, 2020, 2:35pm UTC](http://discourse.heig-vd.ch/t/network-support-for-so3/72/2 "2020-03-04T14:35:37Z")

</div>

I ported a driver for the smc911x nic(Based on u-boot driver) and configured the dts. This port enables me to send and receive raw ethernet packet.  
No parsing yet… I’m assessing LwIP for this purpose.

---

<div class="post-metadata">

**Author:** ![jquartier](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/j/f07891/32.png) [@jquartier](http://discourse.heig-vd.ch/u/jquartier)\
**Post date:** [March 25, 2020, 10:54pm UTC](http://discourse.heig-vd.ch/t/network-support-for-so3/72/3 "2020-03-25T22:54:58Z")

</div>

After many padding and endianess issues, LwIP now is able to send DHCP request over the network (and I think any other request, I couldn’t test). Packets are also handled over to LwIP but they are not parsed by it… Some more work to do.

Below you can see the raw packet sent by SO3 and a screenshoot of the packet captured by wireshark.

 ![image](https://discourse.heig-vd.ch/uploads/default/original/1X/01ebf49e595eb5ac8088c37c471fa0de4fb821a7.png)  
 ![image](https://discourse.heig-vd.ch/uploads/default/original/1X/a61deafed4924a985aa50757a1a7d25dc47c9c1c.png)

---

<div class="post-metadata">

**Author:** ![jquartier](http://discourse.heig-vd.ch/letter_avatar_proxy/v4/letter/j/f07891/32.png) [@jquartier](http://discourse.heig-vd.ch/u/jquartier)\
**Post date:** [April 10, 2020, 3:57pm UTC](http://discourse.heig-vd.ch/t/network-support-for-so3/72/4 "2020-04-10T15:57:53Z")

</div>

It will be easier for me to fully port LwIP into SO3 if semaphore wait (sem\_down in SO3) supports timeouts. For now I’m ignoring timouts which is not optimal and could lead to undocumented behavior.

Below you can find the prototype of the Linux funciton.

```
int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);

```

[http://man7.org/linux/man-pages/man3/sem\_wait.3.html](http://man7.org/linux/man-pages/man3/sem_wait.3.html)

---

<div class="post-metadata">

**Author:** ![rossierd](http://discourse.heig-vd.ch/user_avatar/discourse.heig-vd.ch/rossierd/32/4_2.png) [@rossierd](http://discourse.heig-vd.ch/u/rossierd)\
**Post date:** [April 23, 2020, 6:51am UTC](http://discourse.heig-vd.ch/t/network-support-for-so3/72/5 "2020-04-23T06:51:53Z")

</div>

Now, a new function called sem\_timeddown() has been implemented and available. The second argument is the max delay expressed in ns (relatively from now).  
The prototype is as follows:

> int sem\_timeddown(sem\_t \*sem, uint64\_t timeout)

The function returns 0 in case of success and -1 in case of timeout.
