Skip to content

Fix build on architectures with unsigned char#561

Merged
mrmonday merged 1 commit intolibpnet:masterfrom
pkubaj:patch-1
Apr 25, 2022
Merged

Fix build on architectures with unsigned char#561
mrmonday merged 1 commit intolibpnet:masterfrom
pkubaj:patch-1

Conversation

@pkubaj
Copy link
Copy Markdown
Contributor

@pkubaj pkubaj commented Apr 25, 2022

ARM and POWER are affected.

@stappersg
Copy link
Copy Markdown
Contributor

(Summary: the proposed patch did get human attention)

-        iface.ifr_name[i] = c as i8;
+        iface.ifr_name[i] = c as libc::c_char;

It is the libc:: that makes me wonder if that will block using libpnet in a no_std environment.

Would like to known if

-        iface.ifr_name[i] = c as i8;
+        iface.ifr_name[i] = c as c_char;

or even

-        iface.ifr_name[i] = c as i8;
+        iface.ifr_name[i] = c;

will compile (will work) on ARM and/of POWERPC.

(Feel free to render this comment as just noise.)

@pkubaj
Copy link
Copy Markdown
Contributor Author

pkubaj commented Apr 25, 2022

(Summary: the proposed patch did get human attention)

-        iface.ifr_name[i] = c as i8;
+        iface.ifr_name[i] = c as libc::c_char;

It is the libc:: that makes me wonder if that will block using libpnet in a no_std environment.

Would like to known if

-        iface.ifr_name[i] = c as i8;
+        iface.ifr_name[i] = c as c_char;

error[E0412]: cannot find type c_char in this scope

or even

-        iface.ifr_name[i] = c as i8;
+        iface.ifr_name[i] = c;

That indeed seems to work.

will compile (will work) on ARM and/of POWERPC.

(Feel free to render this comment as just noise.)

@infosechoudini
Copy link
Copy Markdown

can we push a new commit that doesnt have c_char?

@infosechoudini
Copy link
Copy Markdown

in the future, we'll look into other methods of building cross-os and cross-arch

@mrmonday mrmonday merged commit ce67226 into libpnet:master Apr 25, 2022
@mrmonday
Copy link
Copy Markdown
Contributor

Looks good thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants