mirror of
https://github.com/mfontanini/libtins
synced 2026-01-25 03:31:36 +01:00
Updated IP, PDU and PacketSender so as to send forged ip packets successfully
This commit is contained in:
@@ -22,12 +22,13 @@ uint32_t Tins::Utils::ip_to_int(const string &ip) {
|
||||
}
|
||||
if(bytes_found < 4 || (i < ip.size() && bytes_found == 4))
|
||||
throw std::runtime_error("Invalid ip address");
|
||||
return result;
|
||||
return ntohl(result);
|
||||
}
|
||||
|
||||
string Tins::Utils::ip_to_string(uint32_t ip) {
|
||||
ostringstream oss;
|
||||
int mask(24);
|
||||
ip = ntohl(ip);
|
||||
while(mask >=0) {
|
||||
oss << ((ip >> mask) & 0xff);
|
||||
if(mask)
|
||||
|
||||
Reference in New Issue
Block a user