Psychologists agree that giving an ultimatum isn't exactly a good way to get someone else to do what you want, but it is the very best way to get the answers that you need. So first of all, I want to shout out Andre for putting me on this Andre DM me a little while back and told me I need to watch this show. And I feel multiple ways.  So the show in question is ultimatum and the premise is that couples meet at this house unified by their desire to figure out if their relationships are going to work and go to the next level or if they're going to trade partners with somebody else. So basically it's soft swinging, right? So one person, either the man or the woman in each relationship, issued an ultimatum and basically they feel like they want the relationship to go to the next level. And the other person is not ready for that next level, meaning marriage, right?  And honestly, I think the Black stories are the most interesting for multiple reasons, but particularly because I think they demonstrate how men, we are the problem. We are absolutely the problem. And I'm going to explain why.  And the comments are predictable. It's the deadbeat dad's fault. It's the man who abandoned her. It's the man who left her to raise these kids by herself. And just like I said, with the random man from Atlanta video, it takes two to tango. And I think it's about time we have a more high level, comprehensive conversation about what leads to children being raised poorly. And the reality, like I said in that clip, and like we talked about during the one hour conversation that premiered yesterday, is that your mother chose that man for better or worse. So she owns some of that responsibility. And unfortunately, in our community, there's this idea that our parents did us a favor by raising us, as opposed to the reality that they simply handle their responsibility. And I know in pop culture, we like to celebrate mothers, we like to celebrate good dads for doing their job as if those kids asked to be there. But the reality is those kids are your responsibility. They did not ask to be here. We did not ask to be here. So if you're only doing the best that you can, you don't deserve praise, because nobody told you to get pregnant. Nobody told you to impregnate whoever you did. So if you can't do the best that you can, it's okay to admit that you're a shith parent, because until we can start being honest with ourselves, we cannot improve. For equity's sake, since everybody thinks I'm a misogynist, I want to provide some balance. And my position with this show in particular is that it is these men's fault. The first couple I want to talk about is Lisa and Brian. So ironically, I'm familiar with Lisa. So the show was shot in Charlotte, North Carolina. I used to live in Charlotte, North Carolina. And I did a show with Lisa. She and I never actually had a conversation, but we were on the same show as a conversation series called the Situation Chip Circle. I think she ended up leaving the production prematurely. I think she might have done one or two episodes. But yeah, I don't remember seeing her often. However, what's ironic is that her and Brian's relationship started as a situation ship. You're here and you're going to be functioning as a single woman in a marriage because you're not putting forth as much effort as you want that man to put into making you feel as quote unquote powerful. And you making your man lose that. So I make sure I take more than enough effort to make sure he feels powerful. The irony is really, really there. And apparently her first ultimatum towards Brian was to turn their situation ship into a relationship. The second ultimatum was the show for him to marry her. Her daughter is currently 10. So Brian would also be a stepdad. And I imagine that's part of his hesitation with moving their relationship to the next level. According to the show, Brian is only 28 years old. His last name is Okeke. I'm Nigerian. I'm Igbo. That is an Igbo Nigerian name. So the fact that he is Nigerian, the fact that he is younger than Lisa, the fact that he's a young guy, good looking guy, getting his life moving probably means he's not as enthusiastic about long term relationship, let alone marriage. When we both walk out of here, we're going to be both single. We just love that, don't you? When you see that I'm dating other people, you know, you don't work on your reaction to things. You get upset. I don't have to tell you what you do. I don't feel like I get that upset.  I think she trapped him. The fact that she, number one, is older than him, number two, coerced their relationship away from the situation ship and made it serious. And now is trying to coerce him into marriage, kind of shows some of her pathology, but it gets, it gets so much, so much worse. Lisa came to us and informed us that she had taken a pregnancy test. That test came back positive. And this is why I blame Brian. So in episode two of the show, in front of God, the cashmates, the production staff, and the international Netflix audience, Lisa assaults Brian simply because her feelings were hurt because she saw him talking to another woman, which ironically she brought him on the show to do. If she was comfortable enough to do that publicly, and that publicly is an understatement, this is, this is publicly in all caps. I can only imagine what she's comfortable doing to and with him behind closed doors. But see, the reason I blame Brian is, and I talked about it in the last case study and a few others, some men have been socialized to be sadomasochistic. And to put that in simple terms, some men get off on choosing and quote, unquote, maintaining the most difficult and problematic woman that he can find. And some men have been tricked into believing that the potency of their masculinity is correlated with their ability to handle and tame these types of women.  They weren't caution signs, yellow flags when he met Lisa, when he began their situation ship, but he allowed it to progress. And now God and everybody is watching him being assaulted on international television by a woman in her feelings, after threatening him. So it wasn't that it came out of nowhere, it was heat of the moment. She told him she was going to do something. And he proceeds to follow outside and bicker and go back and forth like two women. We enable the problematic femininity that we love to complain about. And I've come across other brines in my comments. I'm sure there's some brines who are watching this video who are fans of the content who for whatever reason do not understand or do not realize that they are seeking out and attempting to tame wild stallions. And for some reason, they think it's a virtue. And later on, they want to bitch and moan about how she did him wrong, how she was abusive, how she did him wrong in court, how she hid the children and how she was vindictive and all that good stuff. But fail.  So just like I don't feel bad for single mothers who thought they could turn a thug into a house husband. I don't feel bad for men who think they can tame wild women. I don't feel bad for men who go after masculine, abusive, unruly, entitled women. I don't feel bad for you.  Because one of the things that stood out to me even before the assault, she had an air of entitlement in her dealings with him, even the scene prior when she left the group and chose to come sit with him as if she was his mother to supervise his dealings and supervise his conversations. Brothers, any woman who moves like that does not respect you. Brothers, any woman who moves like that thinks she owns you. At best, you're her son. At most, you're her property. Run. Our lady days were supposed to be actually the first week while filming. Clearly, mines did not come. And that's where my suspicion kicked in. And so I literally was in my hotel room and was like, I don't feel right. You know, I feel like I'm acting normal. I feel overly emotional about things. So I took a pregnancy test and here it is. That was true the first time that I found out. As you can see in my face, it was much of a surprise to me, right? I didn't know if she was a it was a joke or not. But you know, I guess I knew she wouldn't play around like that. But, you know, immediately within the first few seconds, I had to make the decision on whether or not, you know, this is something that I was really to accept and move forward with the next couple, the other black couple, obviously. Oh, because it's so clear. It's so obvious. It's so apparent that she don't like him like that. And this man, for whatever reason, and I think it's another aspect of this sadomasochism that I'm talking about, feels the need to want to marry her and create a life with her. He issued the ultimatum, brothers. If a woman, women who are raised on fairy tales and raised on love conquering all, if a woman is not enthusiastic about you walking her down the aisle, about you making an honest woman out of her, my brother, she does not want you.  But ultimately, it will fail. And there's no amount of proving, there's no amount of romance that will ever satiate her because you are not her him. I line my house with candles all the way down the hallway to the bedroom, lingerie laid out, teddy bear on the bed. I had Beyonce playing in the back. So to me, I went above and beyond. It was nice. Nice. The exact response that I got was, I mean, it's not quite like the TikTok video. That's the exact response I got. Trey apparently is a well put together dude. He graduated from USC in Columbia, South Carolina. He's probably in network with some people I know. And then Rhea, she works at Hooters. What's interesting about her character is that her character, unless she is an Oscar worthy actress, her character seems very vapid. It seems very hollow.  So I don't feel angry at her because I don't think she necessarily knows any better, which is why I'm angry at Trey. Because the reality is Trey doesn't actually love her. He loves what she can help him accomplish. And that might be husband and father status. And he has prematurely, obviously unwisely, stuck the first pretty face that he was able to pull in the wife position. And this is an uncomfortable number of brothers. And you see him where it's like, she don't like you like that, bro.  She might be the girl that he always wanted. And because now he has the money or now he has the looks, she decided to settle for him. But you spend enough time with him. And you could tell very quickly that she, she don't rate you like that, my bro. But you know, as men, we tend to have blinders on and it's more about what I want to accomplish as opposed to whether or not it makes sense. And in this case, he wants to get married. He wants to start having kids. She is unsure. She is unsure if she wants to get married. And she's unsure if she wants to have kids. Ironically, in further episodes of the show, they switch, you know, each person chooses another person from another couple to couple with in a trial marriage to later come back to their person and couple with again to see if distance made the heart grow fonder or if I prefer the person I left you for.  And during the choosing process, each person, the man first gets up and talks about all the reasons why he chose the person that he is going to couple with for this week or whatever. And the woman responds. So when she responded in front of God, Trey, all the white people, the production staff and the international Netflix viewing audience, she said that the white guy makes her want to have kids and makes her want to get married, somebody that she's known for a couple of days. And I'm supposed to feel bad for Trey. In that moment, you can see his face fall like, I've been trying to convince you of this this whole time.   And it's like, I want to say no offense, but it's with all due offense and with all due respect, because unfortunately, you don't have friends or family who care enough about you to tell you the truth. Or maybe they do and you weren't receptive enough to listen and act. And it wasn't until she embarrassed you publicly that now you see the light. He chose a white girl. That was supposed to be punny.   In closing, that show was an embarrassment, particularly with the black couples.  She's in the dominant role. He's in the feminine role. And it's not until she meets another dominant man from another couple that now she's enthusiastic about the potential of marriage. But again, brothers, we need to own the role that we play in incentivizing women's bullshit. We need to own the role that we're going to have to play for things to change. If you want to see more of this, please click that like button. It helps tremendously. And share this with somebody you think would gain value from the message and hit that subscribe button as well. Peace out y'all.


Yeah, it was after Haiti earthquake last year, we started thinking about things and have really started the development march last year and got to prototype stage by about July after some very crazy 80 hour weeks. And yeah, it's just plugging along really nicely. And I'll let you tell them all about that. Absolutely. Let me get myself organized here. We're using Android phones, but the interesting thing is Windows Mobile will probably actually be easier for us to get it to work on with the meshing without needing root access than Android, just as one of these strange things. So I'm quite happy to talk to Microsoft about this as well. We want it on every phone, really. Before I get started into the full-on talk, my first, if you like, mobile development is a genuine shoe phone. I'll get smart. So if anyone wants to have a look at some shoe phones after, they're here. And I'll just get the laptop sorted out. Everyone enjoying conference so far? Yeah. OK, let's get this happening. Do-do-do-do. Hello, computer. Oh, that's quite a bit to do that for me. OK. So as mentioned, talking about the several projects. So ads for other talks. This morning, I gave a talk talking about some of the back stories. So if you want to know where we've come from and my crazy approach to various things, you can grab the video online for that. Thursday morning, I'll be doing kind of the main talk about the project. And we'll go into some of the big picture. But I'll do a quick run through today. And assuming I can get all of the crazy stuff organized, I've been booking airspace with Brisbane Airport and trying to get helium and regulators. And most difficult of all, getting permission from QUT to have a balloon on a string. Granted, a 100-meter-long string and a one cubic-meter balloon. But nonetheless, we'll actually do a demonstration of this technology as a mock-up of getting mobile coverage back into a disaster area. So serverless is all about mesh networking. This thing isn't quite long enough. That's right. So what we're trying to do is, whether it's disaster or whether it's rural remote, any of these kind of situations, we want to be able to get telecommunications in and have it be resilient in the face of all manner of things. Whether that is disaster, it could simply be terrible geography. You go into the highlands of Papua New Guinea or into, I think, even East Timor. There's certainly issues with tall vegetation. And all of these sorts of things that can make mobile coverage difficult to maintain. So we thought, OK, let's come up with something that can work anywhere. And that actually made some very simple assumptions that we could make. So this is our assumption of logistic convenience and existing infrastructure. So basically, if it could work on the far side of the moon, then it would meet all of our other needs. In terms of user skills and user education, someone's long-dead grandmother is kind of the learning curve that we're pitching at. So it simply had to work like a normal telephone. So normal phone numbers and without anyone having to really kind of mess about and choose whether they're on mesh or on the public network or any of these things. And finally, we had to use existing phone numbers in a disaster environment in particular. So if someone actually just gave you a phone and you went, excellent, I've got a mobile phone and coverage again in a disaster zone. But if you didn't have your own phone number and the people that you cared about, your family, your friends, whoever, didn't have their existing phone numbers, it actually would not be very useful to you. Whereas if everyone kept their same number and you go, excellent, I can ring my family, they're alive, they're safe, fantastic. The emotional release of that is actually very significant. And it enables people, if you know that your family is safe and you can be in touch with them if they need you, you can then go on and help other people. So this is the kind of thing that we're looking to enable as well as infill with damaged infrastructure like here around Brisbane with the flooding where a number of cell towers got wet feet and were off for a while. And in actual fact, who's having trouble with their mobile phone coverage even now on conference? A few people, yeah, it's normal, is it? Like it's the normal level of badness? Wow, okay. Well, our technology has used in peace time as well then. So we just kind of flipped through. Then in thinking about those assumptions, we decided it had to be an ad hoc mesh. It had to be wireless. They're kind of obvious things. I mean, if you tried to do it any other way, it would be very, very bizarre. As much fun as it would be to have bits of string laying around the place. But also the self-claiming of phone numbers. Again, in a disaster zone, if your phone goes flat or squished or whatever and you get someone else's phone, it's really important that you can actually claim your phone number again. You can't wait for the phone company to be back up and running because the whole point is it's a disaster and they're not working. And let alone, that's the last thing they want to do is fending off half a million people trying to get their phone numbers back and prove that, please divert all my phone calls to this SIM card that I've got no idea what number it really is. So we've put a system into self-claim phone numbers very easily. So you go, okay, excellent, fantastic, all good. Oh, authentication. How do we authenticate this self-claiming of numbers so that it's actually vaguely sane? So we actually decided on a very, very simple solution. Simply let people claim their phone number but then get a voice print, a bit like voicemail.  It's much easier than doing some kind of whacked out high-tech digital solution. It's much easier to let people's wet wear in their brain work out whether they're talking to the right person or not. So it's just very, very simple. And it lets us do this incredibly powerful thing of actually letting people grab their own phone number immediately. And you could actually have, I mean, if only one of us in this room had a phone and there was a disaster here with our system, we could actually put all of our phone numbers into the phone. So if anyone rung any of those numbers, it would actually ring that one phone. And it might be that, you know, you might move to somewhere else, there might be a pay phone that's available. Again, you could actually then basically make your phone number follow you to where you're going. So it's really designed about empowering communication in any circumstance. So in terms of the calling and security model, we've decided to use public, private, sorry, blank happening here, asymmetric PKI cryptography. So we're using Elliptic Curve because it's got really nice short keys and is believed to be much more secure than RSA for any given bit length. Because there's no shortcuts for solving Elliptic Curve problem at the moment. So 160 bit key gets us pretty good security. So the private key you use to sign any transaction that the phone is authorizing. And then the public key is what people use to actually contact you. So it's a very simple, elegant solution. And you just, you roll your own private key. So there's no central authority for that PKI. Sure, we can layer that on top and sort of say that, you know, I vouched that your number is your number and you vouched that mine is mine and have a whole reputation system built around that. But that's a layer on top. So the subscriber ID is this public key. And then the phone numbers are separate from that so that you can move phone numbers around between subscriber IDs in a very portable kind of way. And when a phone call happens on the mesh, the phone starts by actually broadcasting, very much like ARP in fact, except instead of putting out an IP address and getting an ethernet address back, you put out a direct dial-in number and you get given a SIP address back. And that might be for local on the mesh or that might be a SIP address that actually goes to a PST and gateway of some kind. And if I actually turn these on now because they take a little while to boot, we can actually do a demo of that in a few minutes. And people are welcome to have a play with these after as well. Okay, and of course, once you've done the mapping from direct dial-in number through SID to get the SIP address, you can actually cache the SID for future reference. So it's, you know, we can simplify the call in future and in particular, the verification stage where we use that voice signature, you can actually skip.   So it's a very simple solution for, you know, for a best effort communications network, we have best effort authentication in the situation. But we can, as I say, bypass that for subsequent calls. So here's how our software stack looks on the phone. So SIP droid is actually providing the SIP client where she had to do a bit of hacking with SIP droid to make it behave. It was never designed to expect there to be a voice server on the phone itself. So, you know, we thought, okay, fine. You know, we've got everything on there. No SIM card in the phone. Put in <IP_ADDRESS> as the server address. It happily takes that. And then it told us, oh, you don't have a data connection. I can't connect to the server. And it's like, nah. So we had to hunt around and find where it was, you know, looking for the data connection and all of that kind of thing and adjust a few lines of code. And then we got all that working and then it wouldn't use any codecs. And we're like, what's going on now? And it turns out what it does is it finds out what speed your data connection is and filters the connections based on that. But of course, you know, it wasn't counting on the loop back interface actually being available. So it was a lot of effort to find the six lines of code that we actually needed to change in there. We need to get around to putting that patch back out actually. So that then feeds into an asterisk server, which is using the VillageTelco dialing model and configuration. So David Row is actually giving a talk on VillageTelco on Thursday. Immediately after, but in a different room to where I'll be presenting more on this project. So if you want to find out the ins and outs of the VillageTelco project, I think they're talking more about the deployment of it, but it's all really good stuff. So then we've got our special source, which is DNA, which is our distributed numbering architecture, which is what does this number mapping with the ARP style and the caching and all of that kind of thing. So for speed, we've made a plugin for Apache. So that basically there's an Apache function so you can do sDNA lookup and give it a phone number and get a SIP address straight back. So we can dial and connect in about a second, which is actually, if you think actually about how long it takes a mobile phone network to connect your call through these days, it's kind of silently extended over the years and it's not uncommon for it actually to be five to 10 seconds before a phone starts ringing on a mobile network. So back to DNA. So below the DNA plugin, we have the DNA Demon which actually sits there listening to the socket on the network and puts the requests out and handles all of that process and maintains a little database, very similar to the HLR database that exists on a GSM network insofar as it maintains the subscriber records. So with these phones, they've got plenty of storage so they can always fit their own record. But if you're using a mesh potato or another device that has only limited capacity and you try and get 400 people to register their number onto the device and it's got 16 megabytes of flash for everything, including the operating system, it may be that your subscriber record needs to get stored on an adjacent node on the network. So we have support for that. Then we're using the Batman mesh routing algorithm below that to do the actual meshing. And we've modified Android Wi-Fi tether to basically stop and start our demons and it was really nice to be able to make use of the Wi-Fi tether application because it turns out getting Android phones into an ad hoc mesh, A is unsupported and B is a blazing mess of different chip sets and different kernel modules and it's just disgusting. And it seems that no matter who complains to Google about this, there's actually no action on them actually providing an API for ad hoc mesh networking. Even, I mean, Froyo claims to have soft hotspot mode and all of these lovely advances in ad hoc Wi-Fi but it does not have actual ad hoc Wi-Fi which we're a bit cheesed about and I posted on the Android platform mailing lists about this issue and there's Android developers on the list and basically didn't even get a reply to say, that sounds lovely or no, we're not going to do it. So I think everyone is actually looking for Wi-Fi ad hoc on Android is feeling a little bit disappointed at the moment. So by all means, complain as loudly as you can to as many people at Google and Android as you can. And as I say, we're looking at other platforms where we can support that and Windows Phone actually is one, I certainly know for Windows Phone 6, it's pretty easy to do ad hoc mesh is what about Windows Phone 7? Do you know ad hoc mesh is? Okay, yep, so, okay, yep. So talking with, okay, so no at this stage in Windows Phone 7 but we'll have that discussion and I think Nokia as well with their Linux platform it's actually much, much easier to do this as well. So it's a little bit disappointing because Android is actually really nice in a variety of other ways for what we're doing but we want to support every mobile platform in any case. And then of course below that you've got all the fun of your Wi-Fi interfaces but also we can do it over wide ethernet. So the mesh potato devices have an ethernet port as well as Wi-Fi. So if you do have backhaul infrastructure we can tie into that in a nice kind of way. So this is one application of what we can actually do with this. So the green links of course are cellular links. So we've got a phone down there by the tower that has a direct connection. And then on the other side of the hill we've got a phone tower and I should have drawn some water in around the feet of that other phone tower to explain why it might not be working. But in any case, so there's a couple of phones on the ground that were in the reception of that cell tower that are no longer. So if we literally put one of our phones with our software and physically tie it to a balloon and float it up where it can see the other tower and see those phones it will gateway traffic to the global phone network and you can dial internationally from those phones on the mesh. And that's what we're going to do Thursday lunchtime. And I can demonstrate it here without a balloon as well which we'll do. So thinking more about that scenario. So if we have the gray cell as a dead cell even without any balloons at all we can kind of, phones that are near the edge we can see coverage in around the edges in a completely automatic way. One of the interesting things, mesh networking tends to be power hungry but take your any modern smartphone and take it out of phone coverage and see just how fast searching for a 3G signal depletes the battery. It turns out it's faster than using the mesh. We discovered this when we did our field trial at Arcarola last July because we did all our testing around where there was a signal and we were getting hours and hours and hours out of G1s particularly if you put a big battery on them. And we got up to Arcarola and we were getting like an hour out of the batteries and I'm like, what's gone wrong? What's eating all the power? And then it dawned on me afterwards that it was these phones yelling at four watts continuously switching bands at high bit rates and listening really, really hard with their input amplifiers turned up to try and find the phone network. So we can actually, with this now we can actually extend the battery life of phones in the dead cell and provide them with coverage and they can cooperatively look for the mobile phone signal because you don't need a hundred phones or a thousand phones in a cell looking for the signal continuously. They can actually share that around and it might be that on a 2% duty cycle the phones actually look for signal and then they can report to neighbouring phones. Oh yes, I've got signal. You might like to look on 1873 megahertz uplink or whatever the details are. So if we add the balloon in of course we can make the situation better. So from a good altitude you can get surprisingly long distance certainly with mobile coverage but even Wi-Fi. So the Village Telco guys just using their mesh potatoes which is standard 100 milliwatts devices with no directional antenna. They would easily get 2.1 kilometres and that was actually just between two jetties in Metropolitan South Australia so there's still actually background interference limiting that. But you can probably do six to ten kilometres from that range and one of the things of course is your Fresnel zones are nice and clear certainly around the phone at the balloon but also when you're actually on the ground if your signal is going mostly up of course your Fresnel zone is oriented up and you have a much better situation so that can help substantially and then hopefully we can tie in all of the phones in the mesh reduce the hop count and make life happy. If now you're in a real hardcore disaster zone where everything has gone out. Again say if we already had that balloon there and the rest of the network went out so that cells getting good internal coverage and people can call each other internally as well with this of course because the mesh can do the number resolution without reference to the internet which is a key point. And we can probably get a few neighbouring phones from other cells to participate but we're not going to get complete coverage. And then someone nice might come along maybe the Red Cross and put a big and satellite terminal in or something like that and again we can provide a gateway to the public switch telephone network. So a mesh potato with a big and terminal will do that job very nicely and for a less than $2,000 worth of equipment it's surprisingly cheap. And then if we get a few more party balloons up there or people with masks or anything that we can use to get the attitude we can then actually start seriously re-establishing mobile communications across a large area. And when you look at it literally all that we're using there is five balloons, one satellite terminal and a lot of mobile phones that are already in the area. And that community can communicate. And I think the effects that that can have for maintaining law and order in disaster zones I think you look at Haiti and the social breakdown that happened was in many ways exacerbated by the loss of communication. So the police couldn't self-organise. People on the ground couldn't self-organise to defend. I mean think about the horrific things whether it's Haiti or whether it's places in Africa or anywhere where you get rape gangs going around because they know that law and order really isn't happening. If those gangs knew that people in the area could phone people around them and within a minute that there'd be a whole pile of other people from that community there I reckon those rape gangs would be thinking twice about doing what they do. And you look at militias attacking villages and people and again the same thing. We can really mobilise people to defend themselves which is fantastic. And we can also look at getting people if you've got subsistence farmers if they can find out what the market price is and someone comes along and offers them 10% of market price and they can just ring instead of walking for two days to get there suddenly it's much more feasible to hop on the phone for a free or very, very cheap call and go oh so what are you going to pay me for corn or coconuts or chickens or mobile phones or whatever the commodity is that they're producing there and they go oh okay so that's the price oh this guy's offering me that and he can go back to the person there and say oh okay you've got transport costs and you need to make a profit too but I want 50% of market value. So those subsistence farmers can get several times the income that they might have got previously and really help to start bootstrapping themselves out of entrenched poverty. And I will be tickled pink if I can look back in 10 or 20 years time and say that I've played a key role in enabling people to escape entrenched poverty and improving law and order and safety in places around the world. But I'm ranting slightly. Now we've probably covered this a little bit already where we're talking about the process of number resolution. So we've got one phone up here is sort of thinking where can I find Paul Gardner's Stephen's mobile phone and my phone's looking over here on the mesh and says okay that's me here's my CIP address and we broadcast that over the mesh using Batman or alternatively the gateway might actually say I can connect you to that phone number on the public switch phone network and here's an address for that. And ideally the phone that's trying to ring me will go okay yep he's available on the mesh I'll try that first because that's free and cheapest and we're incorporating cost models into the protocol so that when you make a call you can choose based on price and link quality and a whole pile of other interesting things. Demo time, this was actually a week or two ago we went down underground in a cave and proved that we could make phone calls 90 meters underground which was very fun in and of itself. So let me, who'd like to get rung by a mesh phone? Who'd like to ring someone on a mesh phone? Okay, excellent. So this is the phone that has a SIM card in it so if someone just wants to hold that and pretend they're just using it as their phone. And hang on, I'll give you the wrong phone that is the phone that doesn't have a SIM in it this is the one that does. Holding it wrong. Yeah, that's right. So you can come up and look it's physically no SIM in it and it's in aeroplane mode as well to save power in fact to not search for their phone network. So at the moment that phone isn't running the mesh so if I try and ring the number it won't connect because there's no gateway so do you want your phone number known to all the world? Excellent, yep, yep. Five, six, four. What a number with lots of fours in it. And I may need to get that out of you again because this phone tends to forget things. Okay, let's try that again. Four, one, four. Yep. Four, six, five, six, four. Okay, they're prototypes and I forgot to start an important thing so it's trying to dial and it gives up after a while because it can't find the number on the mesh. So now on that phone if you touch the little several back phone icon that should be sort of top right ish below the search doodad. Excellent, now touch the green thing in the middle. Still very technical. And it should say it's running but you'll be able to tell you when it is because... It's running well started. Yep. Okay, and it's starting, it's running now because my phone is now telling me there's one other phone on the mesh reachable. So now if I go in there again and I try and ring that number assuming correct phase of moon and everyone's wearing the right colour underpants the call should go through. Dialing, dialing, dialing. Of course it depends on the phone network here actually carrying the data through. Oh, it thinks it's dialing. Your phone should be ringing in a minute. Whoops, saying no data. Let me just hang it up and try again. A May SIM which I think you're using Optus was just the cheapest, nastiest SIM that I could get for data. Okay, I'm just going to dial it again. Do-do-do-do-do. And I think we're having... Yeah. Yep, we might be being thwarted. Okay, let me, we'll try once more and then we'll officially give up. And we can do the demonstration outside where we're not effectively in a Faraday cage. This is why we need to put the balloon up on Thursday. So you can set the balloon up, right? Yeah, we're going to have a balloon on about 100 meter tether. Turns out it's easier to get air traffic control approval than it is to get a university to approve you to put a balloon on their oval. It's just phenomenal. Yes, it will. And it turns out that one of the ambulance volunteers is actually a Virgin pilot. He'll be flying back in when the notice to airmen will actually be in effect. So he's promised to keep us a copy. So, oh, okay. Okay, so I think we're officially going to give up on the basis that our gateway has a lack of signal. But hopefully you get the idea. So in terms of things that we're looking to do down the track, that lovely picture with a satellite uplink. Who's ever watched how much traffic SIPP generates? Yeah, like, I think my punt there at about a kilobyte a minute is probably a moderately conservative punt. A nice satellite terminal will cost you about $10 a megabyte. So one phone is going to cost you about $14 a day just to be available via SIPP. So this clearly doesn't work. So our mesh distributed numbering resolution protocol, we're making what we're calling air clutch, which basically terminates on either side of the satellite link. So the only traffic that you get is actually notification of new phones coming into the area, about 100 bytes for each phone that comes into the area. And then it's actually absolutely zero traffic while the phone is actually in the network there so that you can actually scale it up. I mean, you end up needing a lot of satellite terminals just to get a lot of phones associated with SIPP and contention and a whole pile of muck and we're running out of time. But the people who talked to me, yep, and people can talk to me about other things that we're looking to do down the track as well. Thank you. But when actually, can I ask one, am I like that? Yeah. And the balloons. Yes. How long do they stay up and how do the phones fair up in that rock in the sky like that with the sun beating down in the weather? For the kind of timeframe that you're talking about in a disaster response, all of them are going to be fine but really we're using balloons as an illustration. It could simply be that you find the nearest tall building or hill or anything that's going to give you that attitude. And in fact, if you've got enough people in the cell anyway, then you're just going to have the join the dots connection in any case. But putting a balloon up and label with you to get massive coverage very quickly and with a better reliability than you'll get with people on the ground. A helium balloon should probably stay up for something like a fortnight, if it's a decent balloon. Given that it will only be holding a few hundred grams of phone, you'd actually need to pull it down and up again periodically to actually recharge the phone would be the main issue. Or you could put some solar panels on or but then it's more weight and you need a bigger balloon. But the key thing is that basically, a pile of party balloons and anyone's phone will actually provide coverage. It's massively empowering for the actual communities. And that's what we're trying to do. Yep. Okay, yep. So. Okay, so the question is how are we going to get the the software onto everyone's phones ahead of a disaster as compared to two days after a disaster. And we would love to partner with mobile phone manufacturers. Certainly the first manufacturer to partner with us is going to have a massive competitive advantage by being able to offer a free calling service and a resilient calling service in the face of adversity. I think they are fantastic advantages for any carrier, sorry, for any handset manufacturer. And we're already talking with one manufacturer and trying to talk with as many others as we can. And in particular, we'd like to talk to the handset operating system vendors. So you've got Microsoft and Android and Apple if they'll let us, if they'll, you know, bend down low enough to talk to us. And, you know, at anyone else, we want it on every phone. And of course it'll be in app stores and all that kind of thing as well if we can wangle it. Yes? Okay, to port your number, yep. So what the key is here is that you can grab your number for use on the mesh. So anyone on the mesh will be able to call you on the mesh. Anyone who's off the mesh, if we can get the carriers to play nicely, like in a disaster, they may actually play nicely, then fantastic. But if not, what we'd actually do in public agencies would be advertising dial-in numbers to the mesh that would then prompt you for the number you want to call. So we figured that we couldn't depend on carriers, partly because they might actually be blown to bits by the disaster as well. And partly because there's not that much incentive for carriers to play nicely with this technology because it has the potential to be very disruptive to their business models. That's not to say that it will actually destroy their business models, but a bit like the shift to non-DRM protected music. It's an uncomfortable thought for carriers to entertain and move into this situation. But at some point, someone will do the technology. Hopefully it'll be us, but someone will do it and the carriers will have to adjust to the new world. Yes? Okay, so phone-to-phone range we're talking about? Range between phones we were talking about here. Sure. That's right. So we're using the Wi-Fi radio in the phones at the moment. We actually have plans to use more than that. There's some scale-duggery that we'd like to do with the baseband processor on the phones that actually doesn't require any spectrum allocations or anything to be made and fits entirely within the legal frameworks of many countries. That would give us potentially a four-watt transmitter, but in reality, a limited to one watt and at lower bit rates that would massively improve the link budget. So that should be able to get kilometers-type range in an urban area. As it is with Wi-Fi, you can get a couple of hundred meters line of sight between phones, but the really interesting thing is in a disaster, the whole point is no one's microwave ovens are working anyway. So the noise floor for Wi-Fi actually drops right down. So we found up at our Corolla when we were doing the field trial that three, four, 500 meters was happening without any real issues at all. And that's without having the elevation and if we can get the clear Fresnel zones and that's six or 10 dB, I'm not really a radio guy, but I think it's something like that which basically doubles your range that you can expect as well. Sure. Okay, yep, so yeah. Okay, so the question is about security of basically someone getting someone else's voice signature and presenting that to attract calls to them that are intended for the other person. Absolutely, it's an issue, but I think in a disaster, I'd rather run that risk than not be able to call anyone. But in a more civilized setting where we can make use of internet and peacetime to get ready ahead of time, envisage things like having the post office so you kind of rock up with your phone to the post office and you present some power bills and phone bill to show that you actually own the phone number and then the post office signs a certificate that goes onto your phone that says that basically, the post office believes that you really are the owner of that number and that PKI verification will go through to anyone calling you and they'll say, oh, look, they've been approved by the post office. We can't trust carriers to do it because again, there's no incentive for them to actually support us doing that. In fact, there are disincentives for them to be involved in that process, but the post office doesn't get as many people through its doors as they used to. So I reckon when we get a little bit further along that the post office will be a great place to explore.


Look at that little bit of confidence as you walk through this life that we're in as believers. It's tough out there and sometimes as a believer you've got these different things coming at you. Some things that may cause any doubt and sometimes even concern as to whether you are saved enough to make it. Let me give you a passage that we cover sometimes and we don't really flesh out what it really means to what it all is entailed in here. And this passage in Revelation 3.5 where we talk about someone may or may not being blotted out which by the way, the sweepers are clear, no one can be blotted out. And speaking of certain people who can't be blotted out and I wanna show you some of that part that we don't typically cover, but let's go to it. He says in Revelation 3.5 that he who overcomes will thus be clothed in white garments and I will not erase or blot out his name from the book of life. Now, a couple of things. Remember, he's not saying that there's a possibility. He's literally saying that I will not and he used emphatic negation which is that I will never ever ever blot out or erase that person's name. So we can't come back and say, well, there's a possibility if he can, if he says it will never blotted out that means it can be blotted out. Says the total opposite of that. But I wanna focus on something so that you can know that you are the person whose name will not be blotted out. That is indeed if you are an actual believer. Look what he says. He says he who overcomes and so this word for overcomes is Nikon now. Someone said, well, see, you have to overcome in order to make sure that your name is not blotted out but notice what he says. That said that you have to overcome. He says that this is what you are. You are and notice the tense of it. This is in the present active partisan meaning that you are overcoming. This is who you are. This is what you do. You are categorized or identified as someone who was overcoming. Where do we get this from? Why do we even have this terminology about someone who's an overcoming? How do you become an overcoming, an overcoming? Well, let's go to John. Let's see what John has to say on the matter. In 1st John 5.4, he says, for whatever is born of God, obviously it's who, overcomes the world. And there's that word in the Greek in Revelation. It was Nikon, same word but in this case it is the word for Nikai. Overcomes the world. And this is the victory that has overcome the world, our faith. So what causes us to overcome the world? Our faith, our faith in what? Obviously our faith in Christ. But notice what it says. Verse five, he says, who is or who is the one who overcomes the world? Notice the tense over here again. It is Nikon, the one who is overcoming. Again, it's a present active partisan but this is someone who is overcoming. That person that we've already discovered, John says in Revelation, that person that's overcoming will never have to worry about their name being blotted out. Of course, no one's name ever will be but that's something different. But the person that's overcoming, that's the one whose name will not be blotted out. Let's continue. Who is the overcoming one or the one who's overcoming the world? But he who believes that Jesus is the son of God. Notice the tense here. It is the hapistuan, the ones that's believing. It's the same tense of the verb that's used in John 3.16. So if you are believing, ask yourself a question. Are you a believer? Have you been born of the spirit? Are you, as we say, born again?  Now, how do we know that this is someone who is born again, who believes? Let's go back to the first part of first John five. Look what it says. Whoever believes, this is the pasapistuan, this is the same verb that's used in John 3.16, the believing ones, whoever that believing one is, that Jesus is the Christ, is born of God. And this word, this tense for the word born is in the perfect middle indicative. Now, let me explain this real quick. The perfect tense is a completed action in the past. It's a past completed action, meaning that it was done. And in this case, it's in the middle. It was done to you. Well, who did that? Well, that's obviously from God. We know that the person who was born of God, we find out in John 3, same John who's speaking of this, when Jesus says that you must be born of the spirit, not born of your own accord, as John says, not born of will of flesh or blood but of the will of God. And he says, just as the wind blows, where it wants to, you don't know where it's going where it's going, where it's coming from. So is everyone who is born of the spirit, born of God, born again.


All right Everyone Let's make sure everything's working technology Still showing Tiffany's video and not me Okay All right, you have a nice restful weekend what we mean. No, it wasn't because of me. Oh Well, I don't care about your other classes. I mean in relation to this class Yeah, you didn't have any assignments to work on this weekend It was a gift to all of you. Thank you. You are welcome Next time you'll have more so thank you But I wasn't fast enough Clearly need to learn about kissing up. Okay Cool moving forward so we will have to not keep you in this limbo where you're spending so much time on quote other classes We'll have a new module releasing today after class It's gonna be putting together what we've learned before of understanding HGP and Building a web server. So we're gonna be building a web server in x8664 yes After class today That's important you're not asking when you can start working on it We do Tuesday next Tuesday, so eight days and Then we can look at this is a nice graph of the last module So is the grades a daily grade in the last module at some type of midnight? We don't know what time zone midnight. This is This line here is the 70% line So you can see the none is people who haven't even started or solved one challenge, right? We're not even starting a challenge, right? Yeah, so it's not even a zero is you at least started a challenge and couldn't solve that one That's here This none is didn't even start So we can see this as we get closer Boom boom boom boom boom and what's this roughly so somewhere between these is roughly the grades right on the last module The last three bars are accurate All rough what maybe they didn't work past the deadline these are these students are dedicated to their assignments So yeah, pretty good. I think there's a good distribution. I was happy to that five percent. Just don't bother. Yes, that is correct That is how it goes Cool. Okay So if this doesn't tell you I don't know if you're in the on the left side of this line now a There's the late policy. So you get 50% credit to try to move over the line Be start early, right? So I think yes, this doesn't show it, but I'm certain the people that started like here Got to the far right by the time Assignment was due. All right Now let's talk about So we actually already covered system calls, right? Right remembering what we did on Wednesday in class We had class Wednesday. You watch the lectures for sure What did we talk about stuff? Yeah with one slide in okay We Let me double check that. I thought we went farther. Did we not? We got to here didn't we get to like all this table? Yeah Yeah, okay We talked about a lot of system calls Cool, okay, so we talked about all these system calls now we're gonna put it in action So I'll go over demo the very first module because or the demo of the very first level because it's honestly very easy And the assignment literally tells you how to do it. Okay. What's the first thing I should do? challenge run Okay In this series of challenges, you'll be writing assembly. Hey, we like assembly to interact with your environment Hey, we're learning how to interact with the environment And ultimately build a web server. Hey, we've using web clients now We get to build a web server In this challenge, you will exit a program the most fascinating of programs Okay, so to use this we're gonna do slash challenge run and give it the path to a web server And actually this is actually setting you up, but let's ignore this for now I'll start with this as a placeholder So let's start up with a server I'm gonna call You probably will not have this on your machine Okay S I hate lowercase s, but that's fine. We'll go with it. Okay, so I'm gonna delete this stuff So we know we're gonna have to do a system call. Yeah, correct It will be deployed after glasses the point is for you to pay attention to start You can do it later cool Okay, so we have some assembly code and it's telling us how to assemble What how is this one different than what we were doing last time? So we're using as to what is AS do? It assembles our assembly file to what? Yeah, an elf object file and then LD the loader turns that object file into what an executable that we can run Cool, so now we should have something dot server and segmentation of all core dumps, okay Let's run it with the challenge first and then we'll Cool, so it tells us again what our goal is and it's tongue It's what it expects in the format that we're gonna talk about in a second s trace So s trace is going to be your friend It traces the system calls that your process makes this actually is incredibly handy Even knowing that you can do this There were definitely some cases where you're trying to track down a bug and trying to see what's going on You can actually run s trace on any program And it will tell you all the system calls. So we have something like LS We can run s trace on LS And it's gonna tell us every single system call that the LS process made And you can see there's a lot. Why is there so much? Yeah, there's well, there's only that so there's it retrieving things about the directory Let's do it again and do LS L.A. Libby slash temp So that will run and now we can look for slash temp So we can actually see just the system calls that were related to slash temp So it's stat you can look up the man page for every single one of these system calls to understand exactly what's going on But stat tells you information about that it then tries to open slash temp It then calls f stat to get information about that Which this get dense? I think this gives all the directory information and then it's translating that and writing that out But this is actually just the start of the program There's actually all this other junk that has to happen And this is because programs are complex and things need to happen. So this is the first exec exec Vee LS Then all this stuff has to do the loader has to load it has to load in all the libraries that the LS process uses This is all that stuff, but you can see literally everything that a single process does. Let's check Okay, let's go back to challenge run So how do we parse this it says that we were expected to do an exec Vee of the exec Vee args This past so we can say yep, that's good, and then we're supposed to Call exit zero Okay, we didn't call exit zero. Why didn't we call exit zero louder? Yeah, I didn't write out what my let's look at the code, right? It's just a Sis call. So what system call is being called? How can I figure that out? Yeah, I could debug it I can see what's in the register or I have this program here. I can run S trace and It's telling me that it does an exec Vee and then it calls a read. So read zero null zero What was the somebody put it up the x86? System call table. I like the Chapman one So it was the read so we're calling read So read means which value had to have been an rx Zero and what was the file the script I passed in? Zero and what was rsi? No, and what was rdx? Also zero Right. So the seg fault is because we tried to read from null. I think although it's weird Why did it seg fault of it? Oh probably because there was nothing after it. Maybe that's what we want Okay So this is the wrong system call. Which system called do we want to call? Was it exit We want to call exit and we want to call exit zero so Let's go back in here. So if I want to call exit I'm gonna look for sis exit is 60. Thank you Move into what register? All right, X 60 and What do I want to exit on? What's the error code? So let's run it again Yeah, going back up to here So it's expects that I call exec Vee or sorry exit and then I pass it the argument zero Right so you can think of this as essentially C code right of the arguments So you can say okay the argument to exit must be zero I can look in the sis call table and say this This first table is RDI is the argument. So sis exit. So the error code goes in RDI So I should be able to then say Move into RDI zero so move zero into RDI Do the sis call Run it How can I check? How do I know before I run the challenge that I can check if I was successful? That's trace. How can I get a side fault here? Yeah, it was not because of that but because I exit the program the program literally stopped execution Nothing else happened. What happened before when I wasn't calling exit Was that what happens? So you call a sis call and then the next instruction gets executed So the problem was the next instruction after this was some garbage data that was attempted to be executed Cool Okay, now we can see with this we can see we have an exit zero here, which is great This is exactly what we wanted now if we run this challenge run Hey We get the flag so we can see the exit zero and success questions Yeah, yeah, so this is there's This is essentially a check that it's executing correctly So this isn't something so we can actually run the S trace and see this I want to say I believe this is an artifact of S trace that it does this and shows this system call because it's technically not happening from your program itself Right your program itself doesn't call an exec VE and execute execute another process So this is just a check in here that this is happening correctly So this should always pass and you shouldn't Worry about it, but this also means that it should be easy on the map what it expects to your trace of S trace Okay, now I were to go over to level two So one shortcut is I can just pass in my last program into here And we'll say in this challenge you'll create a socket so expected output the exec VE a socket now and Then an exit So we did The oh, it doesn't know that the exit was correct interesting We did an exec VE in the exit, but we failed because we're missing the socket call So how do we figure out how to make a socket call look on the syscall chart figure out what system call is is Socket put that in rix What would it be the next thing? Yeah, the parameters. This is where it gets slightly more tricky Because so when you write it in C code, you can actually just pass in If I net Sox stream IP proto IP. Why is that? Yeah, there's libraries and there's macros that are defined that defined exactly what these things are And I cannot remember where they are on here, but let's just grab there's several different ways we can do this We can Google for a if I net Linux We can actually literally look at the system call. Yeah, there we go include Linux socket H So we can look at the source code of Linux. Look at what it defines these values as What did I say AFI net? And this would be to You do have to be slightly careful that you're looking at the right thing BSD is another family of operating systems that implements a socket interface Right the whole point of using macros like this is your your C code doesn't is not hard coding the value to it's hard Coding this macro depending on what systems you're using it and what header files you're pointing it to it will work for your operating system So these values may be different. Let's say on a Mac versus a free VSD system versus a Linux system I believe we should be able to find this Here Let's see. This is just to find it because I don't know off the top my head Dash R want to sorry. I'm Usually I'm supposed to talk about what I'm doing. I want to When I'll put the file name that matches I think it's camera for such L. Yeah, lowercase l files with match So I want to laugh. Oh, I did dash L. Oh cool Okay, I'm getting a bunch of garbage no such file whatever so I can redirect Standard error the dev null Okay, I'm clearly my regular expression is busted Oh, but there I think is Do you know where it is? Yeah, I would go literal dots user lib Python user adluby Ruby Python 38 There's a lot of junk. Hey, there we go. Okay Cool, so let's see this matches up include Linux socket H So here we get complicated like this is defined as another one. So PFI net is defined as AFI net So PFI net Is also to yeah, cool. So we got here in both ways so you can For a lot of these you can look them up on your local file system using this file that we just found together You can also do things like S trace is good because it will show you what that name is if it knows it So when we call socket if it knows the exact argument It will give it to us in the text format so we can double-check this why you always want it If you're super confident, I guess you can just run it with the challenge Otherwise run S trace compare make sure it looks the same as it should and then you can run it against the challenge cool Okay, but let's look at the other system calls that we need to make so we did this We did this So we looked at open read and write system calls that allow us to interact with the file system now. We're gonna look at System calls that let us talk to the network So one of the key concepts that's used When using network programming is the concept of a socket later on will go into more in depth of what This means at the like TCP level But for now we can think of it so when we call open on a file, what if we get back from the operating system? Yeah, the file descriptor right and what was the file descriptor? Like if it told us this file descriptor three does I mean it was the third file on the system? Yeah, describe well It's I wouldn't necessarily say it describes the file Although it kind of does it tells it allows us to talk to the operating system about what file it is Right, so we asked the operating system. Hey open this file. It says, okay. Here's a file descriptor In some integer and when you want to read it right from that file give me this file descriptor again And I will let you read it right from that file so the socket is a similar concept that We Tell the operating system. Hey, I'm gonna want to do some network stuff Here's the file descriptor that I want to use Or sorry Here's the week. Let's go look at the To yeah, it's too So we have the domain the type and the protocol So this is as we saw it's a little bit not here. We even have some examples here So this is because there's different types of sockets that we can have We may want to talk on all different types of protocols and the operating system needs to know that Are we trying to talk on I internet like IPv4 protocols? Is it IPv6? Is it I actually don't even know what half of these things are Bluetooth? I guess we can talk Bluetooth on there VMware a Vsoc thing something to do with VMware all types of things. So this is the The domain argument is one of these domains where we tell it. Hey, this is the kind of communication. I'm gonna do Then from there we give it the type And this is slightly more Defines how we interact with this socket We'll again go when we go more details down into the Networking stack, but we can send Sockets can be stream sockets where we can send as much data as we want read as much data as we want Whereas a datagram socket is like you can maybe like a postcard we just send some data fixed amount of data to the other side and We can do raw network access That's interesting. I wonder what that is for Anyway, so we can specify the type we'll be using sock stream for almost everything that we do But we will we get a networking we'll look at UDP and that will have datagram packets And then we have the type sorry the protocol so protocol is where okay the protocol specifies a a Particular protocol that should be used with the socket normally only a single protocol exists as for a specific particular socket type Within a given protocol family in which case protocol can be specified as zero However, it is possible that any protocols may exist and such a blah blah blah blah Anyways, okay, so complicated, but most of the time we can ignore that and it'll just be zero And so when we do this it's going to get us back and return the operating system We set everything up correctly. We'll get everything going get everything ready for us to then make the final To make other calls to this, but this doesn't actually do any connections or do anything It just tells the operating system. Hey, I'm gonna do some networking stuff And I give me a final descriptor to talk about that cool, and that's when we get a bind system calls the idea here is We need to tell the operating system Depending on what specific type we're using but we We want to assign an address to it and we'll see what this looks like in a second. This is actually Very kind of interesting thing. So this takes in a socket FD Where did we get the sock FD from? From yes from the return value of calling socket. So we called socket. We got a return value Then we're gonna bind that to an address Let's look at the bind system call We pass it a sock FD, which we already saw then we pass it this struct and An address length. So when a socket is created with socket it exists. Oh, this is exactly what's on the slides Traditionally this operation is called assigning a name to a socket It is normally necessary to sign a local address using bind Before we can receive connections The rules vary between families Consult the entries in section seven for detailed information for AF I net which what we're gonna be using So if you want to like dig into this even more You can do seven IP and I think seven is Like more not actual functions, but descriptions of things like this is the Linux IPv4 protocol implementation So this tells you how to get a TCP socket or UDP socket. Anyways This would tell you more about that, but we don't need to do that for our purposes So the actual structure pass. This is what's kind of interesting the actual structure pass depends on the address family Different types of addresses have different sizes for things. So for instance, I think we briefly touched on this but in You've seen IPv4 addresses Yeah, what do they look like? Yeah, like one nine two dot zero dot zero dot one So each of those dots how many numbers can be within those? Zero to what? Yeah, zero to 255 so 256. So each of those is how many bytes? Sorry, each thing of suffice that each Between the dot right so one nine two dot blank dot blank dot blank if each of those 256 possible values, how many bytes is that? One bite and there's four of them. So how many bytes in an IPv4 address? Four bytes. There's how many bits? 32 look at this Think about where you were like four weeks ago. Now you're just bits and bytes powers of two like crazy. So IPv4 addresses are 32 bits. So if you're If you're trying to bind to a specific IP address You would give it something that's roughly 256, I'm sorry four bytes or 32 bits, but IPv6, well, what's the problem with IPv4 addresses? Anyone know? We've technically I think already run out depending on how you count. There's no free like IPv6 address space for YouTube use Where are you getting your IP addresses from they will usually have Extras that they can give you and So when they created an IPv6, don't ask me what happened IPv5. I don't know but when they created IPv6 They said okay, we want enough IP addresses that we're never gonna run out. So what did they do? So they double it Yeah, no, they quadrupled it. So IPv6 addresses are a hundred and twenty eight bits or 16 bytes So that's a lot. That's why they're They actually use hex hexadecimal Like this. Well, no, that's wrong. That's an Ethernet address. This does not have an IPv5 This one This one Says it's link ether. Does that mean it's a MAC address though? I'm slightly worried Three four five six. Yeah, it should be eight octets if it's a right Four four four four sixteen. Yeah, it should be sixteen. Okay, there we go There's an IPv6 address. Oh, yeah, that's right because they use the two bytes and then they if Things are zero between there. They have an empty colon So this is just the format for IPv6 addresses. It's not actually important You don't need to know this but it's cool to see this So anyways, it's just all getting the point across that like when you're talking to the operating system depending on what type of Socket you have you may have different sizes of address, right? And so that gets us to bind cool So when we bind another fun fact about this is that You can oh interesting Is this actually causes I found on operating systems this causes a lot of problems Having data structures where you have to specify. Hey, there's this address and this is the length Sometimes they'll get a structure and assume it's an IPv6 structure like a big structure But you passed it a small structure and so it ends up reading memory outside of where it was assigned or the reverse you say it's a You or another way you give it a small structure and it copies the big structure on there That's how you get an overwrite. So this causes like massive problems. Anyways, so We can dig further into this struct socked adder a Sock adder. Okay, so we got to start digging in Parsing these C structures because this is how we talk about these things. So this is a sock adder you first have this essay family and This tells it What type of sock adder this is and it's so it's the waiter Parsis is a you in so an unsigned int 16 is how many bits So how many bites is that to? Start testing you more Let's go It's okay, it happens. Yeah, so eight eight bits is a bite So you int eight is the same as a character like you used to thinking about one bite You in 16 two bites. So the first two bites says the family and the rest of it is how How to interpret this essay data. So one key question is what's the total size of the struct sock adder in Bites so how many bites for the essay family to and then how many for the rest 14 single bites. So a total of 16 bites. Yeah, cool. So sock adder underscore in so the underscore in is not like incoming. It's for internet like Abbreviation there and so You still have the same family 16 Bits so two bites for the family and then a port and then a 32 bit address and this corresponds exactly with what we're talking About with how big our IPv4 addresses four bites Which is how many bits? 32 which is exactly this s in adder. So socket internet address What are the ports for when you're talking about and learning about talking web, what port that you use? 80? Yeah, where there weighs why 80? Yeah, did you have to use 80? No, there was ways in the URL to specify different ports, right? So similarly here when we're binding to an address, we're gonna bind to a port and an IP address And specifically when we're doing a server, we're gonna bind because that's what we're gonna list it on for incoming connections So all the servers that you talked to on your browser All of them had to literally call socket to get a file descriptor with the right arguments And then call bind and pass in a sock adder of what they want to do pass in Okay, so what we're gonna want this Struct sock adder in to look like Is we're gonna want the The family the first two bites to be AFI net because this is part of the specification It's because we want anyone who looks at this to interpret this as an internet address and Then we have so why can't we use 80 here? For the port so we talked about port 80. Why do we want for 80? It's the default for HTTP. Yeah, so I get back into Endiness so you remind us what end in this means Yeah, so if the most significant bite is on the left or the right of a multi bite Address in memory and I kind of mentioned this I think when we talked about end in this that the CPUs use little end in order But network protocols use big end in order. So this H HH tons or Host to networks Will flip the bytes around for us and it also is a well This is a C wrapper that Will figure out if we are a little Indian or big Indian Nothing for little Indian flips the bytes around correctly So we'll need to make sure that when we do 80 that it's actually the two bites are in the right order Then we need 32 bits that represent The IP address of 127 dot zero dot zero dot one This is a special actually technically a range of IP addresses This is a special IP address that means local host and so that will be the sin adder and then the padding So we have eight bytes left over so if you what we say it was 16 bytes total for this sock adder in or serve for the Sock adder and so this should be two bytes for the family two bytes for the port another four bytes Or four four bytes for the address eight and then another eight is 16 which is exactly what the other one was so the size of those structures are the same Awesome, and then we can see this in memory of what this should look like. So this should be 16 bytes The first two bytes should be 0 to 0 0 Because we saw a affine it is to The next two bytes should be 80 I guess in hexes 50, but if it was normal 80 would be 50 0 0 But because it's big Indian those bytes are flipped around 0 0 5 0 and Then finally these are the if you do the translation. Oh, actually you can do this translation very easily how There's no Z's but 7f is what you mess up. Yeah And each of those right we said is a bite so you can easily convert each of those They call it dotted decimal format into a hexadecimal value We can just double check that Because who likes leaving things unspecified 127 converted there 7f zero converted to hexes and One converted to hexes Yeah, very easy. Thank you Cool. So we have 7f 0 0 1 and Then we finally have these eight bytes of zero So if we were like laying this out in memory, this is exactly how it looks like and so if we pass this as the If we pass the memory address here as the argument to bind It would then say okay, you have a socket I'm gonna start listening on local host 1 2 7 0 0 1 port 80 Well, I get the bind end listen. Oh, yeah, that's saying that you want to actually start listing the things, right? because bind says okay bind is address it checks to see because you You fundamentally can't have two different ports on To you can't be listening on two different ports of two different programs Because whenever your operating system gets a packet destined for that port it has to send it to some process So it needs to know where it goes So we bind Thank you We bind and then we start so then we've reserved that IP address and that port and Then we want to listen This said that okay, we are ready to start accepting incoming connections and Finally so we can look at what so the sock fd. We know that's the sock That's the file is super. We got back from socket backlog. Let's go check what the backlog is The backlog argument defines the maximum length to which the queue of pending connections may grow if a connection request arrives When the queue is full the client may receive an error Well, my bug fits in the request may be ignored so I later attempt at connection receives Guess I've never know what Okay, aha socket Bound to a local address with bind listen and then accept Okay, perfect So if the backlog argument is greater than whatever is in this value then it's silently truncated into that value so great So we can just put a very large value in there and then it doesn't matter and we'll just use that and we could ignore it Cool just large value in there And then finally This is everything to tell the operating system. Hey, this is I want to listen to this type of communication I want to listen on this specific IP address and port and then I'm ready to listen and then finally we can Call the accept system call Where we give it a file descriptor and It then will return a new okay So it extracts the first connection request on the queue of pending connections So I believe if we look it up, it'll say it's a blocking call So this means that your program sleeps until a request comes in Creates a new connected socket and returns a new file descriptor referring to that socket So how many after we get a connection? How many sockets do we have to what's the first one? the listening one yeah the socket that we set up to tell the OS that we wanted to bind and listen and then what's the second one the return value of accept So then accept is going to then return to us a new file descriptor That then we can we'll use that as we'll see to read and write To that file descriptor and that gets sent to the other side of the connection and we read from that file descriptor We are reading from the network connection. So this is how we can use this in order to listen to networks connections so we can walk through this whole process and Then we're yeah, we still got a half hour Cool. So to accept a network request. We first call socket. So This is how we get an IPv4 Socket that we care about AFI net Sockstream IP proto IP We call that the operating system finds in the file descriptor table of our process that oh file descriptor 3 is not being used Great, I'm gonna set up this socket We then bind called bind pass it in the file descriptor we got back and Pass it a pointer to that object that we just saw in memory Right, so this will then say So what's the difference between the previous examples I showed in this example in terms of the Sock adder well the address will death. Yes, which address we need to be more specific. There's memory addresses. There's Yeah, the IP address so zero zero zero zero is a very specific address This well, what would that be in bytes? So we know it's four bytes. What are those values gonna be? Yeah zero, right 32 32 bits all zeros But that's why it was in your computer. I thought it was your computer Oh, that's what yeah, something was beeping and I thought it came from this direction. I thought it was you This is bizarre Okay, just go on twitch and you can see my screen I'm slightly kidding, but we'll get it. We success like increase Okay, don't do that again bad system Okay, so we're talking about the IP address so This is actually a way of restricting Believe it's access to what IP addresses can access your socket. So what you're listening on So when you're listening on zero zero zero zero, it means that anybody can make a connection to you Whereas when you're listening from one two seven zero zero one This means that only requests that come from you from the local hosts will be Will be sent on this seems like a very trivial very generic Description, but it turns out this has a lot of implications. So if you are let's say Running a database on your local machine like because you're doing some web development stuff locally and you're running a mySQL server and You have a you can run the database and you can tell you this exact argument what IP address to use here If you use zero zero zero zero, it means that anyone on your local network could talk to your mySQL database If you don't have authentication set up because hey, it's your dev machine You don't want to specify all that stuff then anybody can connect to your database if you had customer data on there Anybody can access that similar things happen when you're developing a web server or sorry developing a web application locally you can specify this host like this the IP address and That will either allow other people to access it or restrict it. So this actually ends up being very important Okay, but we can do this bind. So do we pass the right number of bytes as the third argument here to bind? Yeah The 16 bytes that's what we said. We just counted the bytes right in each of those formats We can then call listen. I guess we can just pass zero here and it will set it to the max value. Okay Listen on the same file descriptor now. We've told the operating system. We are ready to listen We then call accept. Oh, we didn't talk about the other arguments to accept, but let's look at those real quick so this is a Struct socked adder pointer and a sock length pointer address length So sock length is just like an int. So why is it a pointer that we're passing it? But if we're just passing it in then why would we pass it a pointer to an int and I'll just pass the int in itself Say it again or so we can Correct. We want it to be modified, but we don't want to modify it. Who's gonna modify it? Yeah, the operating system the function whoever's calling this is one way when you're looking at like a Arguments to a function. This is how you reason about even without looking at the documentation. What is this for? Right, this is actually for the operating system to communicate back to us And to write out the values because if we just pass in an int there's no way for it to write out Remember, we said that the return value returns the file descriptor so What we'll see is what it's actually doing is it will give us a an address of the IP address of the other side of the connection This is how we can check what IP address that is where that's coming from But in order to do that we need to know how big that is we need to pass it a pointer here And this is just how to reason about this. I hope this will back me up Otherwise, this was like a hole the argument adder is a pointer to a sock adder structure The structure is filled in with the address of the peer socket as known to the communication layer So the peer being the other side of our communication The exact format of the dress returned is determined by these sockets address family Which we specified and the respective protocol man page when adder is null Nothing is filled in in this case adder length is not used and should also be null The adder length argument is a value result argument. The caller must initialize it to contain the size Interesting. So we actually are passing in stuff there The caller must initialize it to contain the size and bytes of the structure pointed to by address This way the operating system knows how many bytes to write in and that it's not going to write in more bites Don't we gave it because if we have an address structure of only eight bytes It is trying to write 16 bytes in they want me wants to know that On return it will contain the actual size of the peer address. This is interesting So we need if we were using this we need to know okay. I need to actually specify a value here I can't have it be a pointer to zero because that it won't rightly hang there. It means be a pointer to the actual size. Oh I guess well, let's see the blocking If no pending connections are present on the queue and the socket is not marked as non-blocking Except blocks the caller until a connection is present this means the operating system will literally like freeze our program and just Save it wait until there's a connection if the socket is marked non-blocking and no pending connections are present Then it fails with these specific error messages. So anyways by digging into these Documents we could learn exactly if we wanted to build an operating system that or a sorry A network server that doesn't lock on except it just checks every 10 seconds or something We could do that with this we have to figure out how to tell the OS that we want a non-blocking socket I'm sure by digging into those other man pages. We could find this valuable information Okay But for our purposes we can just call accept pass in three and Set the values as null and null meaning we don't care about the return values here. So when this returns it will return On the system call table file the script or for the operating system will set up in our process Okay for maps to this socket, which is now this peer connection. So this is the connection to the other side That we can then talk to Okay, so Let's do this. Okay before we dig in there. I want to talk about how we can actually pass in this sock adder Struct so we have this in C and I don't want to do something that's too close to the level. So let's say I'm gonna run this Okay, it wants me to call socket. I do really want to call socket though We'll use a different type of socket maybe Okay, because what I want to show is calling bind and I need a socket for that. So Somebody remind me what's the syntax here for comments? Is it semicolon or is it hash? Okay Okay, so that's the exit zero and now I want to call let's say bind AF Inet Six because this time I want an IPv6 because I'm not solving all these levels for you There's only 11. So if I just did one I did another one we're getting like up there and all the things that you'll be having fun with oh No, I need to call socket. Not mine. See we're already okay So I want to call socket on that. Let's see socket IPv6 Linux Cool. So I have another man page in here IPv6 There you go. I want AF inet six sock stream zero. So this is the system call that I'm going to try to make so I'll need to put something into our ex. How do I know the something? Look it up Look in the you said it's 41 Should we trust you? Oh? There you go. All right good good good Move 41 to our ex Move so now I need this AF inet six So I'm gonna open up a new terminal. What would we say that was? Can I do half a level? Yeah, I'm kind of doing it and here it just depends on how you look it's in the bits Include x86 64 then this actually makes sense if you think about it of like Why is there so there's a user include Linux and then a user include x86 64 Linux GNU and This AR 64 which have you looked at that that would actually be ARM based Linux Why those are different files because the exact layout of the bits and bytes varies between Architectures or or can so that's why we need to be there anyways. I net six is pf. I net six Which is 10 there we go All right, so what was it RDI? I think was 10 So that should be and the other thing I like to do as I'm doing this is document Like what these values are these random numbers that I'm just typing in here So that when I look at it later like you're doing a later challenge or you're modifying something You actually know what this value is and not just like you just did it for this one time Okay, and now I need the sock stream. Oh No sock stream. Okay, so I Cool, let's do another grip There we go and our bits socket type dot H. So socks sock stream equals one Let's go look at this file just to see what else is in there because we are Curious people here. We have different ones sock stream D gram raw RDM secret packet cool. So this was I actually can't remember what the another parameter is So this was the protocol So RDI RSI RDX Move into RDX to Is that correct or what did I just make that up?  Thank you move into So it's RDX zero. Should I add a comment that this is zero? No, it's useless. Don't do that Okay, so this is correct. I Should run this with S trace and see this exact socket call socket with AFI net six sock stream zero I wanted to run it with S trace. I thought I did No, sis call. Thank you None of you saw that when I was typing this out, so it's great when you're in front of you because then you can just always say it was a Teaching moment, okay calling socket AFI net six sock stream. What's this IP proto IP? It probably is zero like we don't know we didn't look it up I'm sure we could look it up and that just happens to be zero. We pass zero in for there It said we can just do zero so It's asking us for zero. It's totally fine If we really wanted to double check we could double check that but I'm very confident How do we know that this socket call was correct? What's not zero the equals three this specifically means the return value of the system call was three If we looked in the man page, we would see that any negative value indicates a error. So Where in my assembly code, where can I get this return value X? Yeah, just like that's what we talked about with system calls Okay, cool So now I have to remember. What was the whole point of this diversion?  I'm using an IPv6 So my struct, I think it's be a struct sock adder in six. Let's see. Yeah, there we go sick. Okay So this is what we're gonna need to do. So this is a family and then a port number So the port number should be the same size. I think this still should be 16 bits. So two bytes and Then a flow info. I actually don't remember what this is and then a struct in adders in six adder which is 16 characters how many bytes is a character? one and So it's an IPv6 addresses. How many bytes? 16 which is what we talked about earlier, right? So it went from four bytes for IPv4 to 16 bytes for IPv6 Okay, so let's look here a little bit sin six family is set to AFI net six Port is the protocol port see sin port in IPv6. So it's the same. It's gonna be two bytes Sin six flow info is the IPv6 flow identifier. Let's just put that as zero I actually don't know what that is, but we'll just put it as zero for now Sin six adder is the IP is the 128 bit IPv6 address Sin six scope ID is an ID depending on the scope of the address. Let's also set that to be zero It is new in Linux 2.4. Thank you Supports it only for link local addresses in which case it contains an interface index. All right Cool, the port space is shared with IPv4 and v6. That's great. Okay, so we can work with this So that's what we're trying to do So we're gonna bind to let's go back to the slide We're gonna call bind Where's our good friend bind? There we go. We're gonna be a bind on Oops. Well, hello, I don't use them. So I have no idea what that was Okay, let's say something like this FD equal socket and so that I can reuse that in my comments bind FD I get a pointer to this adder. So Let's call it IPv6 the address of IPv6 sock adder and And let's go back and figure out the size So the family is two bytes the ports two bytes the flow info is 32 which is four. So two two four four eight another four was that 12 plus 16 is 28 So probably 28 bytes. We'll see if that's wrong or right, but I think that's correct Okay now so First things first Need to figure out the bind. What's the bind? syscall number 49. Thank you. I already messed up. Wow. How did I mess up? Yeah, because right here after this syscall the FD is in RAX But the very first thing I did here was overwrite RAX and now I will never get back that syscall number. So Yeah, let's do that here Let's use I don't know Into RBX let's say RAX so now we're storing that into RBX Now I can safely remove it and now if so, let's come back to this RDI and Just a big socket thing and now we want to move our SI the third argument we're gonna move 28 into there Wait, that's wrong. Okay. This should be our SI This should be our DX That's the address there and into RDI. Which what do I want to be in the first argument? RBX so FD this will be the address of IPv6 And what do I got to end with which I messed up last time, but I remembered syscall Okay, should this work? So something online is on twitch is asking if there's any other source we can find the value that goes in if net The answer is no you have to use the header files There may actually exist a something out there Well, let's go. Let's move zero into here because this is definitely this should not work Compile it it compiles. It's kind of shocking. Okay So What does this at least tell us? Yeah, we called bind correctly. We correctly passed in the file descriptor We did correctly pass in null. We said zero today there. We set in 28 But what is the return value did bind execute correctly? No, because a return to negative one and if we want to check that we can check that in our code in Eax But we wanted to point to that giant structure. So how do we get this giant structure into our program? What are some options? What was that? The stack we can use the stack and put the bytes on to the stack and lay them out correctly What else? Yeah, we can use our programs memory, right? We can actually have a data section that we can put Think of it as global memory right global memory to our program so the stack is also useful to our program, but We actually know exactly what values we want to put in there Although I guess we didn't talk about what kind of IPv6 sock adder we want to do. So let's do that right now Linger a linger structure. That's interesting. Why was that needed? Okay.  So I'm looking for a sock adder in six that has the af inet six as the family so the first two bytes and Then the port let's do somebody give me another port number 81 Some 80 80. Okay. Perfect. I like no. I also don't like that because then oh, yeah, that'll work Okay, I was worried if the host network would be weird, but Okay, great. So flow info zero Then we need our unsigned So this is our IPv6 address. So we need 128 bits. Let's do something like this 0 0 1 1 2 2 3 3 5 6 6 7 7 8 Let's say 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Do I need another one? These addresses are way too large There we go, that makes more sense I actually think it's more like this, but whatever. All right, we'll do like that So we can easily translate this into bytes. These are hex values. So I'm just using this as shorthand to say I want the numbers to be from zero zero to ff zero zero one one as the Digits. All right, so that's the address and now I need a scope ID So my scope ID is gonna be zero And then finally that should be it. Okay, so that's our goal One side by side Okay So we can use that data So if we were to lay this out in memory We'd first want So the first was how many bytes? Two bytes. So our goal is what? Two bytes It should be what if I net six which we had here, which is 10. So it should be 10 two bytes 10 Okay, and if we I actually can't remember the assembler syntax six Directive so the same document. Yeah, there we go the same document that has all the directives The Rept n and stuff like that should have Yeah, so data grade There's a way to tell the assembler exactly which ones we want. Oh No, we're almost done a short is the same. Okay, great. Let's use dot short Cool. Okay. So we can use dot short Ten so this means I want as a short so a short is two bytes I have that and then I have the dot short the next short is going to be the bytes So this should be Let's see so 8080 in hex is 1f90 what do I have to be careful about here little Indians? I'm gonna flip them around The next one is 32 bits. So that's yeah D word. I think maybe L words How many words oh man this word thing is horrible, okay Yeah It's not in the docks. I'm not gonna show it Okay dot space. Oh, okay emits size bytes each of value fill Okay, that's not cool. Okay space. This probably is not the best way to do this, but Zero so four bytes of zero was this We'll do this one next, but let's just call it 12 ff and Dot space for zeros and I need to give this a label Call it big one and I think I should be able to just move Not like that. Oh my god that compiled. Oh, so close. Okay. I don't know. I guess I'll figure out Is it because I didn't do the address of it Oh There we go, oh just when you're leaving you thought it couldn't be done right at the buzzer SA family if I net-sick pork it hosts a never-short 8080 Whatever this thing is No, I did do all negative ones because I didn't want to do the actual stuff, but Sick all right we're done