• 0 Posts
  • 63 Comments
Joined 2 years ago
cake
Cake day: June 3rd, 2023

help-circle
  • To me, the potential point of confusion is referring to “sent by Ctrl+D” and things “received by the end process” as synonymous, ignoring the tty driver in between. When you Ctrl+d, you send a magic byte value to the tty master (which I would refer to as a EOF character, but I understand the argument against the terminology). On the other side of it the process doesn’t receive this value, but instead has its read call returned even if the buffer is 0.

    A simple example hopefully highlighting the difference

    Window1:
    nc -nvlp 5555 #"far nc"
    
    Window2:
    nc -nv 127.0.0.1 5555 #"local NC"
    Hi there[Enter]
    Hi [Ctrl+D]There[Ctrl+D][Enter]
    
    Window3:
    strace -p [pid of local nc]
    
    Window2:
    [Right arrow][Right arrow][Ctrl+D]
    [Ctrl+D]Uh oh[Enter]
    

    What we see is pretty much as described. From the first line, we see “Hi there\n” on the other side. For the second line, we first see "Hi " appear, then “There” then “\n”.

    From the third line, in the strace we can see the sequences representing the right-arrow key, and we can see the tty driver on the far side takes those sequences and interprets them to render the cursor two characters to the right.

    The fourth line is where it gets more interesting. We send the tty driver the EOF byte, and the tty driver interprets this and gives the current active tty client a 0-byte return to read() and assumes we have no more data to send. But unlike bash, nc doesn’t care about a 0-byte read and is still looking for more data (as we can see in the strace). But if we continue to type and send more data (the “Uh oh”), we can see in the strace that the tty never sends this to the nc. So, to some definition, we’re still sending data to the local nc, but the tty driver isn’t actually relaying it


  • I haven’t heard of that being what threading is, but that threading is about shared resourcing and memory space and not any special relationship with the scheduler.

    Per the wiki:

    On a multiprocessor or multi-core system, multiple threads can execute in parallel, with every processor or core executing a separate thread simultaneously; on a processor or core with hardware threads, separate software threads can also be executed concurrently by separate hardware threads.

    https://en.m.wikipedia.org/wiki/Thread_(computing)

    I also think you might be misunderstanding the relationship between concurrency and parallelism; they are not mutually exclusive. Something can be concurrent through parallelism, as the wiki page has (emphasis mine):

    Concurrency refers to the ability of a system to execute multiple tasks through simultaneous execution or time-sharing (context switching), sharing resources and managing interactions.

    https://en.m.wikipedia.org/wiki/Concurrency_(computer_science)



  • If what you said were true, wouldn’t it make a lot more sense for OP to be making a joke about how even if the source includes multi threading, all his extra cores are wasted? And make your original comment suggesting a coding issue instead of a language issue pretty misleading?

    But what you said is not correct. I just did a dumb little test

    import threading 
    import time
    
    def task(name):
      time.sleep(600)
    
    t1 = threading.Thread(target=task, args=("1",))
    t2 = threading.Thread(target=task, args=("2",))
    t3 = threading.Thread(target=task, args=("3",))
    
    t1.start()
    t2.start()
    t3.start()
    

    And then ps -efT | grep python and sure enough that python process has 4 threads. If you want to be even more certain of it you can strace -e clone,clone3 python ./threadtest.py and see that it is making clone3 syscalls.




  • Think about how quickly the entire WWWIII (Wizarding-World War III) would have ended if all of the good guys had simply armed up with good ol’ American hot lead. Basilisk? Let’s see how tough it is when you shoot it with a .470 Nitro Express. Worried about its Medusa-gaze? Wear night vision goggles. The image is light-amplified and re-transmitted to your eyes. You aren’t looking at it—you’re looking at a picture of it. Imagine how epic the first movie would be if Harry had put a breeching charge on the bathroom wall, flash-banged the hole, and then went in wearing NVGs and a Kevlar-weave stab-vest, carrying a SPAS-12. And have you noticed that only Europe seems to a problem with Deatheaters? Maybe it’s because Americans have spent the last 200 years shooting deer, playing GTA: Vice City, and keeping an eye out for black helicopters over their compounds. Meanwhile, Brits have been cutting their steaks with spoons.

    Remember: gun-control means that Voldemort wins. God made wizards and God made muggles, but Samuel Colt made them equal. Now I know what you’re going to say: “But a wizard could just disarm someone with a gun!” Yeah, well they can also disarm someone with a wand (as they do many times throughout the books/movies). But which is faster: saying a spell or pulling a trigger?

    Avada Kedavra, meet Avtomat Kalashnikova. Imagine Harry out in the woods, wearing his invisibility cloak, carrying a .50bmg Barrett, turning Deatheaters into pink mist, scratching a lightning bolt into his rifle stock for each kill. I don’t think Madam Pomfrey has any spells that can scrape your brains off of the trees and put you back together after something like that. Voldemort’s wand may be 13.5 inches with a Phoenix-feather core, but Harry’s would be 0.50 inches with a tungsten core. Let’s see Voldy wave his at 3,000 feet per second. Better hope you have some Essence of Dittany for that sucking chest wound. I can see it now…Voldemort roaring with evil laughter and boasting to Harry that he can’t be killed, since he is protected by seven Horcruxes, only to have Harry give a crooked grin, flick his cigarette butt away, and deliver what would easily be the best one-liner in the entire series: “Well then I guess it’s a good thing my 1911 holds 7+1.” And that is why Harry Potter should have carried a 1911.


  • Ah gotcha, I was wondering where I might’ve lost the thread. I would agree with everything you said there. But, putting a pin in that and going back to your original post, what are the lore changes that you dislike? I understand what you said regarding inter-species complications, but feel like I might have lost what you were saying after that.


  • Honestly, I’m a bit more confused now. I definitely agree that humans have a tendency to dehumanize others, but I wouldn’t consider this a good or healthy thing that we should just accept. So having a ruleset that says, canonically, “this group of sentient creatures is inherently evil” and not “this group of sentient creatures is believed to be evil by this other group” you are encouraging the players to take an unnuanced view of the world.

    However, as a gamemaster you have to allow your players to make two choices:

    1. Are the monsters we are fighting people or not?
    1. Does my character agree with me?

    Isn’t this what the lore changes encourage, by not making a factual statement about the groups, so the players should ask themselves this question on a case-by-case basis and not simply based on what type of creature they are? And I’m not sure how the changes would prevent the narrative approach you describe. Saying that goblins and orcs live in human-like societies doesn’t prevent you from telling a story that’s analogous to what has happened between human societies.

    Maybe we’re working off of different data points, what WotC material are specifically referring to for the changes?


  • A game about combat needs a world full of things for the players to mow down but also not feel bad about killing, and sometimes you need a bunch of Violent Dungeon Fodder that can think and plan and make tactical decisions and potentially be negotiated with.

    I’m a bit confused by this. Why not have them be any other species, or combination of them? If they’re capable of being negotiated with shouldn’t the players feel as bad about killing them as anyone else? I feel like “self-defense” can do a lot of heavy lifting in dungeon crawls, I’ve never really noticed my players feeling bad about killing bandit dwarves or whatnot.



  • Sorry, I was looking more specifically at that DNAT rule

    8   480 DNAT       6    --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:2222 to:192.168.101.4:22
    

    That rule exists in the host 192.168.86.73, correct? And from the guest, 192.168.101.4 you are attempting to ssh into 192.168.86.73:2222?

    It might not be your issue (or only issue), but that DNAT rule says that if a connection comes in on port 2222, instead send it to 192.168.101.4:22. So 192.168.101.4->192.168.86.73:2222->192.168.101.4:22. I would have thought you’d want it to be a DNAT to 192.168.86.73, functionally doing port bending, so it goes 192.168.101.4->192.168.86.73:2222->192.168.86.73:22.

    That doesn’t explain the connection refused, though, based on what you’ve said; there’s some fringe possibilities, but I wouldn’t expect for your setup if you hadn’t said (like your ~/.ssh/ssh_config defining an alternate ssh port for your guest OS than 22). It’s somewhat annoying, but it might be worthwhile to do a packet capture on both ends and follow exactly where the packet is going. So a

    tcpdump -v -Nnn tcp port 22 or tcp port 2222


  • For general awareness, not all flags can match all parts of an iptables command; the part you included there with “–to offset” is only valid with the string module, and not the DNAT action. That said after playing around with it a little, iptables actually does short flag matching, so ‘DNAT --to 1.2.3.4’ ‘DNAT --to-d 1.2.3.4’ and ‘DNAT --to-destination’ are all equivalent, so not the source of your issue.

    I am having trouble following the IP scheme, though. Is your Alma guest 192.168.101.4, or is that the host IP? If it’s Alma’s and you are attempting to ssh from that IP to the host with that iptables rule, what should happen is that DNAT would then redirect that connection back to Alma. If the guest doesn’t have a :22 listener, you’d get a connection refused from itself.


  • Your hook has

    /sbin/iptables -t nat -I PREROUTING -p tcp --dport $HOST_PORT -j DNAT --to $GUEST_IP:$GUEST_PORT

    But I’d didn’t think that “–to” was a flag for DNAT, I thought it was “–to-destination”

    If you ‘iptables -nvL’ and ‘iptables -t nat -nvL’ do you see both your DNAT and forwarding rules (although if the default is ACCEPT and you don’t have other rules, the FORWARD one isn’t needed), and do you see the packet count for the rules increase?