• G
    slirp: Factorizing address translation · 5379229a
    Guillaume Subiron 提交于
    This patch factorizes some duplicate code into a new function,
    sotranslate_out(). This function perform the address translation when a
    packet is transmitted to the host network. If the packet is destinated
    to the host, the loopback address is used, and if the packet is
    destinated to the virtual DNS, the real DNS address is used. This code
    is just a copy of the existent, but factorized and ready to manage the
    IPv6 case.
    
    On the same model, the major part of udp_output() code is moved into a
    new sotranslate_in(). This function is directly used in sorecvfrom(),
    like sotranslate_out() in sosendto().
    udp_output() becoming useless, it is removed and udp_output2() is
    renamed into udp_output(). This adds consistency with the udp6_output()
    function introduced by further patches.
    
    Lastly, this factorizes some duplicate code into sotranslate_accept(), which
    performs the address translation when a connection is established on the host
    for port forwarding: if it comes from localhost, the host virtual address is
    used instead.
    
    This prepares for IPv6 support.
    Signed-off-by: NGuillaume Subiron <maethor@subiron.org>
    Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: NThomas Huth <thuth@redhat.com>
    Signed-off-by: NJason Wang <jasowang@redhat.com>
    5379229a
tftp.c 10.3 KB