Skip to content
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

Closed
Savagedlight opened this issue Jun 11, 2016 · 3 comments
Closed

libifc_create() for creating cloned interfaces #12

Savagedlight opened this issue Jun 11, 2016 · 3 comments
Assignees
Milestone

Comments

@Savagedlight
Copy link
Owner

Savagedlight commented Jun 11, 2016

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.

@Savagedlight Savagedlight added this to the v0.2 milestone Jun 11, 2016
@Savagedlight Savagedlight self-assigned this Jun 11, 2016
@Savagedlight
Copy link
Owner Author

Savagedlight commented Jun 16, 2016

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:

  • ifieee80211.c: clone_setdefcallback("wlan", wlan_create);
  • ifvlan.c: clone_setdefcallback("vlan", vlan_create);
  • ifvxlan.c: clone_setdefcallback("vxlan", vxlan_create);

Savagedlight added a commit that referenced this issue Jun 16, 2016
Some interfaces need special handling, and this is not implemented yet.
Savagedlight added a commit that referenced this issue Jun 16, 2016
Add initial support for creating interfaces. Issue #12
@Savagedlight
Copy link
Owner Author

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:
Create methods for the special snowflake creation (and destruction) routines which take the required parameters, hopefully making it simpler for application developers to see what's required to get the job done.

@Savagedlight
Copy link
Owner Author

As this issue requires a lot of work, I've split it up into several issues for further development:
vlan: #18
vxlan: #39
wlan: #40

Closing this issue.

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

No branches or pull requests

1 participant