-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libifc_create() for creating cloned interfaces #12
Comments
ifclonecreate() checks for special snowflake callbacks (listed below) and executes the first matching one if found. If none is found, it does a simple ioctl() call w/ SIOCIFCREATE2 and ifr.ifr_name having the requested interface name set. If the name was something like "bridge", ioctl() will assign an appropriately numbered interface name (say, bridge0) to the ifr.ifr_name member. Start with implementing the generic behaviour, then add special snowflake handling. The special snowflake handling should be invisible outside of the library, but should probably add some way for calling application to add their own callbacks for custom interfaces. Copy the ifconfig callback methology for this. Special snowflake callbacks:
|
Some interfaces need special handling, and this is not implemented yet.
Add initial support for creating interfaces. Issue #12
On further thought, the special snowflake handling should not be invisible to calling application, as they require specific data to be provided (which is probably why they're special snowflake). This means the calling application has to know how to deal with that anyway, and it's preferred to have less obfuscating abstractions. In conclusion: |
Allow creation of clonable interfaces, such as vlan, tap, etc.
Suggested pattern: int libifc_create(libifc_handle_t *h, const char *name, char **ifname);
Look at ifconfig's ifclone.c, around line 120. The interesting code is in ifclonecreate(...) and its support functions.
The text was updated successfully, but these errors were encountered: